Initial commit
This commit is contained in:
1 parent
ee9615239e
commit
16feac691f
4093 files changed
+1030491
No files matched your search
+47
@@ -0,0 +1,47 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gaia
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple Spawn Extension for demo / debug purposes. Just writes some info to the console when being executed.
|
||||
/// </summary>
|
||||
public class DebugSpawnExtension : MonoBehaviour, ISpawnExtension
|
||||
{
|
||||
public string Name { get { return "DebugSpawnExtension"; } }
|
||||
|
||||
public bool AffectsHeights => false;
|
||||
|
||||
public bool AffectsTextures => false;
|
||||
|
||||
public GameObject testPrefab;
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Debug.Log("Spawn Extension is closing down.");
|
||||
}
|
||||
|
||||
public void Init(Spawner spawner)
|
||||
{
|
||||
Debug.Log("Spawn Extension starting up.");
|
||||
}
|
||||
|
||||
public void Spawn(Spawner spawner, Transform target, int ruleIndex, int instanceIndex, SpawnExtensionInfo spawnExtensionInfo)
|
||||
{
|
||||
Debug.Log("Spawn Extension spawning.");
|
||||
if (testPrefab != null)
|
||||
{
|
||||
GameObject newGO = GameObject.Instantiate(testPrefab, spawnExtensionInfo.m_position, spawnExtensionInfo.m_rotation);
|
||||
newGO.transform.localScale = spawnExtensionInfo.m_scale;
|
||||
newGO.transform.parent = target;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
Debug.Log("Spawn Extenison deleting.");
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 419cf668855b7724cb1db262f35227a2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gaia
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple Spawn Extension for demo / debug purposes. Just writes some info to the console when being executed.
|
||||
/// </summary>
|
||||
public class GeNaSpawnExtension : MonoBehaviour, ISpawnExtension
|
||||
{
|
||||
public string Name { get { return "GeNaSpawnExtension"; } }
|
||||
|
||||
public bool AffectsHeights => false;
|
||||
|
||||
public bool AffectsTextures => false;
|
||||
|
||||
public GameObject m_genaSpawnerPrefab;
|
||||
private GeNa.Spawner m_genaSpawnerInstance;
|
||||
|
||||
public void Close()
|
||||
{
|
||||
//Debug.Log("Spawn Extension is closing down.");
|
||||
if (m_genaSpawnerInstance != null)
|
||||
{
|
||||
DestroyImmediate(m_genaSpawnerInstance.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public void Init(Spawner spawner)
|
||||
{
|
||||
//Debug.Log("Spawn Extension starting up.");
|
||||
if (m_genaSpawnerPrefab == null)
|
||||
{
|
||||
Debug.LogWarning("GeNa Spawn Extension '" + Name + "' does not have a GeNa Spawner Prefab assigned.");
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject newGO = Instantiate(m_genaSpawnerPrefab);
|
||||
m_genaSpawnerInstance = newGO.GetComponent<GeNa.Spawner>();
|
||||
|
||||
if (m_genaSpawnerInstance == null)
|
||||
{
|
||||
Debug.LogWarning("Could not find a GeNa Spawner component on the prefab for GeNa Spawn Extension '" + Name + "'. Does this prefab use a GeNa Spawner component on the top level?");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void Spawn(Spawner spawner, Transform target, int ruleIndex, int instanceIndex, SpawnExtensionInfo spawnExtensionInfo)
|
||||
{
|
||||
//Debug.Log("Spawn Extension spawning.");
|
||||
if (m_genaSpawnerInstance != null)
|
||||
{
|
||||
|
||||
float scalarX = (spawnExtensionInfo.m_position.x - spawnExtensionInfo.m_currentTerrain.transform.position.x) / spawnExtensionInfo.m_currentTerrain.terrainData.size.x;
|
||||
float scalarZ = (spawnExtensionInfo.m_position.z - spawnExtensionInfo.m_currentTerrain.transform.position.z) / spawnExtensionInfo.m_currentTerrain.terrainData.size.z;
|
||||
Vector3 normal = spawnExtensionInfo.m_currentTerrain.terrainData.GetInterpolatedNormal(scalarX,scalarZ);
|
||||
m_genaSpawnerInstance.Initialise(target,"Gaia Spawn Extension Spawn",false);
|
||||
m_genaSpawnerInstance.m_parentName = target.name;
|
||||
m_genaSpawnerInstance.Spawn(spawnExtensionInfo.m_position, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa421c7b24a3d0b4a97bd7a94ccd7c29
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user