Add multipy types of mobs support
This commit is contained in:
parent
f1486426ff
commit
bde8b8febe
@ -104,13 +104,14 @@ void OnTriggerEnter2D(Collider2D col)
|
|||||||
IEnumerator waiter()
|
IEnumerator waiter()
|
||||||
{
|
{
|
||||||
yield return new WaitForSecondsRealtime(0.5f);
|
yield return new WaitForSecondsRealtime(0.5f);
|
||||||
overMind.DeathGoToPull(gameObject, mobAddedTime);
|
//overMind.DeathGoToPull(gameObject, mobAddedTime);
|
||||||
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetupMob(OverMind.MobParameters mobParameters)
|
public void SetupMob(OverMind.MobParameters mobParameters)
|
||||||
{
|
{
|
||||||
characterObject = mobParameters.Character;
|
|
||||||
moveSpeed = mobParameters.MoveSpeed;
|
moveSpeed = mobParameters.MoveSpeed;
|
||||||
|
characterObject = mobParameters.Character;
|
||||||
overMind = mobParameters.OverMind;
|
overMind = mobParameters.OverMind;
|
||||||
health = mobParameters.Health;
|
health = mobParameters.Health;
|
||||||
damage = mobParameters.Damage;
|
damage = mobParameters.Damage;
|
||||||
|
@ -31,19 +31,28 @@ public struct SpawnRegions
|
|||||||
|
|
||||||
private SpawnRegions generatedSpawnRegions;
|
private SpawnRegions generatedSpawnRegions;
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
public struct MobParameters
|
public struct MobParameters
|
||||||
{
|
{
|
||||||
|
public string mobName;
|
||||||
|
public GameObject mobPrefab;
|
||||||
public float MoveSpeed;
|
public float MoveSpeed;
|
||||||
public GameObject Character;
|
public GameObject Character;
|
||||||
public OverMind OverMind;
|
public OverMind OverMind;
|
||||||
public float Health;
|
public float Health;
|
||||||
public float Damage;
|
public float Damage;
|
||||||
public float AddedTime;
|
public float AddedTime;
|
||||||
|
public int price;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SerializeField] private List<MobParameters> mobs;
|
||||||
|
// [SerializeField] private MobParameters standartMob;
|
||||||
|
// [SerializeField] private MobParameters lightMob;
|
||||||
|
// [SerializeField] private MobParameters heavyMob;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
PreHeaterSpawn();
|
//PreHeaterSpawn();
|
||||||
StartCoroutine (spawnMobsCourutine());
|
StartCoroutine (spawnMobsCourutine());
|
||||||
print(GenerateSpawnRegions().TopRegion);
|
print(GenerateSpawnRegions().TopRegion);
|
||||||
generatedSpawnRegions = GenerateSpawnRegions();
|
generatedSpawnRegions = GenerateSpawnRegions();
|
||||||
@ -96,27 +105,27 @@ private Vector4 PickRandomSpawnBorder()
|
|||||||
}
|
}
|
||||||
return _randomSpawnBorder;
|
return _randomSpawnBorder;
|
||||||
}
|
}
|
||||||
private void PreHeaterSpawn()
|
// private void PreHeaterSpawn()
|
||||||
{
|
// {
|
||||||
for (var i = 0; i < pullSize; i++)
|
// for (var i = 0; i < pullSize; i++)
|
||||||
{
|
// {
|
||||||
var newMob = Instantiate(mob,mobPull.transform);
|
// var newMob = Instantiate(mob,mobPull.transform);
|
||||||
//_mobsPull.Add(newMob);
|
// //_mobsPull.Add(newMob);
|
||||||
newMob.SetActive(false);
|
// newMob.SetActive(false);
|
||||||
|
//
|
||||||
var newMobParameters = new MobParameters
|
// var newMobParameters = new MobParameters
|
||||||
{
|
// {
|
||||||
MoveSpeed = mobMoveSpeed,
|
// MoveSpeed = mobMoveSpeed,
|
||||||
Character = characterObject,
|
// Character = characterObject,
|
||||||
OverMind = this,
|
// OverMind = this,
|
||||||
Health = mobHealth,
|
// Health = mobHealth,
|
||||||
Damage = mobDamage,
|
// Damage = mobDamage,
|
||||||
AddedTime = mobAddedTime
|
// AddedTime = mobAddedTime
|
||||||
};
|
// };
|
||||||
|
//
|
||||||
newMob.GetComponent<Mob>().SetupMob(newMobParameters);
|
// newMob.GetComponent<Mob>().SetupMob(newMobParameters);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
Vector3 GenerateRandomSpawnMobPoint()
|
Vector3 GenerateRandomSpawnMobPoint()
|
||||||
{
|
{
|
||||||
@ -135,16 +144,17 @@ IEnumerator spawnMobsCourutine()
|
|||||||
{
|
{
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
//Debug.Log ("OnCoroutine: "+(int)Time.time);
|
|
||||||
yield return new WaitForSeconds(1f);
|
yield return new WaitForSeconds(1f);
|
||||||
|
|
||||||
var mobToSpawn = mobPull.transform.GetChild(0);
|
//var mobToSpawn = mobPull.transform.GetChild(0);
|
||||||
|
//mobToSpawn.transform.position = GenerateRandomSpawnMobPoint();
|
||||||
mobToSpawn.transform.position = GenerateRandomSpawnMobPoint();
|
// mobToSpawn.parent = activeMobs.transform;
|
||||||
mobToSpawn.parent = activeMobs.transform;
|
// mobToSpawn.gameObject.SetActive(true);
|
||||||
|
|
||||||
mobToSpawn.gameObject.SetActive(true);
|
|
||||||
|
|
||||||
|
var mobToSpawn = mobs[Random.Range(0, mobs.Count-1)];
|
||||||
|
var mobToSpawnObject = Instantiate(mobToSpawn.mobPrefab ,activeMobs.transform);
|
||||||
|
mobToSpawnObject.transform.position = GenerateRandomSpawnMobPoint();
|
||||||
|
mobToSpawnObject.GetComponent<Mob>().SetupMob(mobToSpawn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
Base path: '/home/dart/Unity/Hub/Editor/2020.3.32f1/Editor/Data', plugins path '/home/dart/Unity/Hub/Editor/2020.3.32f1/Editor/Data/PlaybackEngines'
|
Base path: '/home/dart/Unity/Hub/Editor/2020.3.32f1/Editor/Data', plugins path '/home/dart/Unity/Hub/Editor/2020.3.32f1/Editor/Data/PlaybackEngines'
|
||||||
Cmd: initializeCompiler
|
Cmd: initializeCompiler
|
||||||
|
|
||||||
|
Cmd: preprocess
|
||||||
|
insize=2745 file=Assets/Scripts/SpriteCharacters.shader surfaceOnly=0 cachingPP=1 buildPlatform=24 pKW=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR dKW=UNITY_NO_DXT5nm UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_VIRTUAL_TEXTURING UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_ASTC_NORMALMAP_ENCODING SHADER_API_GLES30 error: 2 plat 25 at (47): Couldn't open include file 'UnityPaletteSwap.cginc'.
|
||||||
|
ok=0 outsize=1114
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user