Esempio n. 1
0
    public void ChangeGun(int gunIndex, PlayerGunType type)
    {
        var gun = Instantiate(gunPrefabs[(int)type]) as GameObject;
        gun.transform.parent = weaponSlots[gunIndex].transform;
        gun.transform.localPosition = Vector3.zero;
        gun.transform.localRotation = Quaternion.identity;

        var oldGun = guns[gunIndex];
        var newGun = gun.GetComponent<PlayerGun>();

        foreach(var skill in oldGun.skills)
        {
            newGun.AddSkill(skill.Type);
        }

        Destroy(guns[gunIndex].gameObject);
        guns[gunIndex] = newGun;
    }
Esempio n. 2
0
    public void ChangeGun(int gunIndex, PlayerGunType type)
    {
        var gun = Instantiate(gunPrefabs[(int)type]) as GameObject;

        gun.transform.parent        = weaponSlots[gunIndex].transform;
        gun.transform.localPosition = Vector3.zero;
        gun.transform.localRotation = Quaternion.identity;

        var oldGun = guns[gunIndex];
        var newGun = gun.GetComponent <PlayerGun>();

        foreach (var skill in oldGun.skills)
        {
            newGun.AddSkill(skill.Type);
        }

        Destroy(guns[gunIndex].gameObject);
        guns[gunIndex] = newGun;
    }
Esempio n. 3
0
 void ChangeGun(int gunIndex, PlayerGunType type)
 {
     GunController.ChangeGun(gunIndex, type);
 }
Esempio n. 4
0
 void ChangeGun(int gunIndex, PlayerGunType type)
 {
     GunController.ChangeGun(gunIndex, type);
 }