Example #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>();
        }
Example #2
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>();
 }