Exemple #1
0
        private void EquipNewGun(BasePlanetGun newGun)
        {
            var transformToSpawn = currentGun.transform;

            Destroy(currentGun.gameObject);
            currentGun = Instantiate(newGun, transformToSpawn.position, transformToSpawn.rotation);
            currentGun.transform.SetParent(this.transform);
            gunComponent = currentGun.GetComponent <IShooting>();
        }
Exemple #2
0
        public void ActivePowerUp(BasePlanetGun newGun)
        {
            if (powerUpRoutine != null)
            {
                StopCoroutine(powerUpRoutine);
            }

            PowerUpPickUpedEvent?.Invoke();
            EquipNewGun(newGun);
            powerUpRoutine = StartCoroutine(PowerUpActiveRoutine());
        }
Exemple #3
0
 private void Awake()
 {
     moveComponent               = this.GetComponent <IMovable>();
     damageComponent             = this.GetComponent <IDamageable>();
     damageComponent.DeathEvent += OnDied;
     currentGun = Instantiate(startingPlanetGun, this.transform.position + new Vector3(0, 2, 0),
                              Quaternion.identity);
     currentGun.transform.SetParent(this.transform);
     gunComponent    = currentGun.GetComponent <IShooting>();
     healthComponent = this.GetComponent <ICurable>();
 }