Exemple #1
0
        protected override void IntervalShoot()
        {
            if (player == null)
            {
                player = FindObjectOfType <PlayerShip.PlayerShipWeaponryController>();
            }

            var projectile = PoolManager.instance.Spawn <ProjectileType>(null, transform);

            projectile.SetTagsToIgnore(tagsToIgnore);
            projectile.shotByPlayer = attachedToPlayer;

            if (projectile.GetComponentInChildren <PlasmaGunProjectile>() != null)
            {
                if (projectile.shotByPlayer)
                {
                    AudioManager.instance.Play(AudioBank.SFX_FIRE_PLASMA_GUN, projectile.gameObject);
                }
                else
                {
                    AudioManager.instance.Play(AudioBank.SFX_ENEMY_FIRE, projectile.gameObject);
                    if (!player.hullAlarmEnabled)
                    {
                        AudioManager.instance.Play(AudioBank.MUS_BATTLE, this.gameObject);
                    }
                }
            }

            InternalSetupShoot(projectile);

            if (OnProjectileLaunch != null)
            {
                OnProjectileLaunch(projectile);
            }
        }
        protected void Start()
        {
            if (waypoints == null)
            {
                Debug.LogWarning("waypoints is null.");
            }

            if (leftCannon == null)
            {
                throw new Exception("leftCannon is null.");
            }

            if (rightCannon == null)
            {
                throw new Exception("rightCannon is null.");
            }

            if (itemIncreaseHullPrefab == null)
            {
                throw new Exception("itemIncreaseHullPrefab is null.");
            }

            if (itemIncreaseShieldPrefab == null)
            {
                throw new Exception("itemIncreaseShieldPrefab is null.");
            }

            if (itemLaserAmmoPrefab == null)
            {
                throw new Exception("itemLaserAmmoPrefab is null.");
            }

            if (itemUnguidedMissileAmmoPrefab == null)
            {
                throw new Exception("itemUnguidedMissileAmmoPrefab is null.");
            }

            if (itemGuidedMissileAmmoPrefab == null)
            {
                throw new Exception("itemGuidedMissileAmmoPrefab is null.");
            }

            SetState(States.WaitingWaypointSystemToGetReady, true);

            PauseManager.OnPause   += Pause;
            PauseManager.OnUnpause += Unpause;

            player = FindObjectOfType <PlayerShip.PlayerShipWeaponryController>();
        }
        protected void Start()
        {
            if (waypoints == null)
                Debug.LogWarning("waypoints is null.");

            if (leftCannon == null)
                throw new Exception("leftCannon is null.");

            if (rightCannon == null)
                throw new Exception("rightCannon is null.");

            if (itemIncreaseHullPrefab == null)
                throw new Exception("itemIncreaseHullPrefab is null.");

            if (itemIncreaseShieldPrefab == null)
                throw new Exception("itemIncreaseShieldPrefab is null.");

            if (itemLaserAmmoPrefab == null)
                throw new Exception("itemLaserAmmoPrefab is null.");

            if (itemUnguidedMissileAmmoPrefab == null)
                throw new Exception("itemUnguidedMissileAmmoPrefab is null.");

            if (itemGuidedMissileAmmoPrefab == null)
                throw new Exception("itemGuidedMissileAmmoPrefab is null.");

            SetState(States.WaitingWaypointSystemToGetReady, true);

            PauseManager.OnPause += Pause;
            PauseManager.OnUnpause += Unpause;

            player = FindObjectOfType<PlayerShip.PlayerShipWeaponryController>();
        }