void Start() { this.timeout = 1; this.currentWaitingTime = 0; this.currentEnumFlying = posEnumFlyingDinosour.FIRST; }
void instantiateDinosaur( ) { if (this.currentEnumFlying == posEnumFlyingDinosour.FIRST) { positionInstanteate = new Vector3(posInstantiateFirst.position.x, Random.Range(posInstantiateFirst.position.y, posInstantiateSecond.position.y), posInstantiateFirst.position.z); currentEnumFlying = posEnumFlyingDinosour.SECOND; } else if (currentEnumFlying == posEnumFlyingDinosour.SECOND) { float _random = UnityEngine.Random.Range(0, 100); if (_random < 50) { positionInstanteate = new Vector3(posInstantiateSecond.position.x, Random.Range(posInstantiateFirst.position.y, posInstantiateSecond.position.y), posInstantiateSecond.position.z); currentEnumFlying = posEnumFlyingDinosour.FIRST; } else { positionInstanteate = new Vector3(posInstantiateSecond.position.x, Random.Range(posInstantiateSecond.position.y, posInstantiateThird.position.y), posInstantiateSecond.position.z); currentEnumFlying = posEnumFlyingDinosour.THIRD; } } else { positionInstanteate = new Vector3(posInstantiateThird.position.x, Random.Range(posInstantiateSecond.position.y, posInstantiateThird.position.y), posInstantiateThird.position.z); currentEnumFlying = posEnumFlyingDinosour.SECOND; } Instantiate(dino, positionInstanteate, Quaternion.identity); //GameObject _fly = EnemyListControl.sharedEnemyList().addDisabledEnemy( EnemyType.Dino04MoveFly, positionInstanteate ); this.timeout = Random.Range(2.0f, 3.0f); }