public void IncrementSwordCount() { if (isLevelOne) { levelOneController.IncreaseSwordCount(); } }
public void DropOffWeapon(GameObject weaponDroppingOff) { Weapon weaponType = Weapon.None; if (weaponDroppingOff.name.Contains("Finished Axe")) { weaponType = Weapon.Axe; } else if (weaponDroppingOff.name.Contains("Finished Sword")) { weaponType = Weapon.Sword; } else if (weaponDroppingOff.name.Contains("Finished Shield")) { weaponType = Weapon.Shield; } if (weaponRequired == weaponType) { // Reward players // Play any feedback (audio, particle effects) EnemyLine enemyLine = this.GetComponentInParent <EnemyLine>(); enemyLine.SlowDownMovement(); // Increase weapon count LevelOneController levelOneController = GameObject.FindGameObjectWithTag("GameController").GetComponent <LevelOneController>(); if (levelOneController) { switch (weaponType) { case Weapon.Shield: levelOneController.IncreaseShieldCount(); break; case Weapon.Sword: levelOneController.IncreaseSwordCount(); break; case Weapon.Axe: levelOneController.IncreaseAxeCount(); break; } } Destroy(weaponDroppingOff); Destroy(this.gameObject); } }