예제 #1
0
 public void IncrementSwordCount()
 {
     if (isLevelOne)
     {
         levelOneController.IncreaseSwordCount();
     }
 }
예제 #2
0
    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);
        }
    }