Ejemplo n.º 1
0
 public override void Tick()
 {
     base.Tick();
     //Do projectile for static tower
     if (TowerType == ETower.StaticCannon)
     {
         ProjectileStandard projectile = (ProjectileStandard)Instantiate(_standardProjectile, _spawn.transform.position, _spawn.transform.rotation);
         projectile.Type = ETower.StaticCannon;
         projectile.OnSpawnMove(4);
     }
 }
Ejemplo n.º 2
0
    private void OnTriggerStay(Collider other)
    {
        if (!_isDelaying)
        {
            switch (TowerType)
            {
            case ETower.StandardCannon:
            {
                Vector3 correctTarget = new Vector3(FollowClosestPlayer().transform.position.x, _standardTop.transform.position.y, FollowClosestPlayer().transform.position.z);
                _standardTop.transform.LookAt(correctTarget);
                ProjectileStandard sProjectile = (ProjectileStandard)Instantiate(_standardProjectile, _spawn.transform.position, _spawn.transform.rotation);
                sProjectile.Type = ETower.StandardCannon;
                sProjectile.OnSpawnMove(1);
                _isDelaying = true;
                StartCoroutine(WaitSeconds(1));
                break;
            }

            case ETower.Reverse:
            {
                Vector3 correctTarget = new Vector3(FollowClosestPlayer().transform.position.x, _reverseTop.transform.position.y, FollowClosestPlayer().transform.position.z);
                _reverseTop.transform.LookAt(correctTarget);
                ProjectileReverse rProjectile = (ProjectileReverse)Instantiate(_reverseProjectile, _spawn.transform.position, _spawn.transform.rotation);
                rProjectile.Type = ETower.Reverse;
                rProjectile.OnSpawnMove(0);
                _isDelaying = true;
                StartCoroutine(WaitSeconds(1f));
                break;
            }

            default:
            {
                break;
            }
            }
        }
    }