Exemplo n.º 1
0
    public void CmdAddAmmo(GameObject Player, AmmoColors AmmoColor, float CooldownDuration, GameObject AmmoCrate)
    {
        WeaponManager WM = Player.GetComponent <WeaponManager>();

        switch (AmmoColor)
        {
        case AmmoColors.red:
            WM.AddAmmo(AmmoColor, 15);
            break;

        case AmmoColors.yellow:
            WM.AddAmmo(AmmoColor, 20);
            break;

        case AmmoColors.green:
            WM.AddAmmo(AmmoColor, 10);
            break;

        case AmmoColors.white:
            WM.AddAmmo(AmmoColor, 5);
            break;

        default:
            break;
        }

        StartCoroutine(Respawn(CooldownDuration, AmmoCrate));
    }
Exemplo n.º 2
0
 public void AddAmmo(int amount, PhotonPlayer player)
 {
     if (GetComponent <PhotonView>().owner == player)
     {
         playerWeaponManager.AddAmmo(amount);
     }
 }
Exemplo n.º 3
0
    public void OnTriggerEnter2D(Collider2D collider)
    {
        if (collider.gameObject.name == "Player")
        {
            WeaponManager wm = collider.GetComponent <WeaponManager>();

            if (wm.AddAmmo(this.ammoType, this.amount))
            {
                grabAmmoSound.Play();
                StartCoroutine(WaitForSoundAndDestroy());
            }
        }
    }