Ejemplo n.º 1
0
 public void PutWeaponBack(AWeapon weapon)
 {
     weapon.transform.parent = null;
     weapon.gameObject.SetActiveRecursively(false);
     weapon.enabled = false;
     pool[weapon.GetType().ToString()].Enqueue(weapon);
 }
Ejemplo n.º 2
0
 public void PutWeaponBack(AWeapon weapon)
 {
     weapon.transform.parent = null;
     weapon.gameObject.SetActiveRecursively(false);
     weapon.enabled = false;
     pool[weapon.GetType().ToString()].Enqueue(weapon);
 }
Ejemplo n.º 3
0
    void EquipWeapon(int weaponIndex)
    {
        // First, we deactivate the previous weapon
        if (_weapon != null)
        {
            _weapon.gameObject.SetActiveRecursively(false);
            _weapon.enabled = false;
        }

        // We activate the new weapon
        _weapon = _weapons[weaponIndex];
        _weapon.gameObject.SetActiveRecursively(true);
        _weapon.enabled = true;
        _currentWeapon  = weaponIndex;

        _weapon.transform.localPosition = _weapon.positionInCamera;
        Vector3 weaponPosition = _weapon.transform.TransformPoint(Vector3.zero);
        Vector3 weaponPositionInPlayerSpace = this.transform.InverseTransformPoint(weaponPosition); // We retrieve the position of the weapon in the player's local space

        networkView.RPC("EquipWeaponRemote", RPCMode.OthersBuffered, _weapon.GetType().ToString(), weaponPositionInPlayerSpace);
    }
Ejemplo n.º 4
0
    void EquipWeapon(int weaponIndex)
    {
        // First, we deactivate the previous weapon
        if (_weapon != null) {
            _weapon.gameObject.SetActiveRecursively(false);
            _weapon.enabled = false;
        }

        // We activate the new weapon
        _weapon = _weapons[weaponIndex];
        _weapon.gameObject.SetActiveRecursively(true);
        _weapon.enabled = true;
        _currentWeapon = weaponIndex;

        _weapon.transform.localPosition = _weapon.positionInCamera;
        Vector3 weaponPosition = _weapon.transform.TransformPoint(Vector3.zero);
        Vector3 weaponPositionInPlayerSpace = this.transform.InverseTransformPoint(weaponPosition); // We retrieve the position of the weapon in the player's local space
        networkView.RPC("EquipWeaponRemote", RPCMode.OthersBuffered, _weapon.GetType().ToString(), weaponPositionInPlayerSpace);
    }