コード例 #1
0
ファイル: GunController.cs プロジェクト: himapo/Cas2014S
    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;
    }
コード例 #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;
    }
コード例 #3
0
 void ChangeGun(int gunIndex, PlayerGunType type)
 {
     GunController.ChangeGun(gunIndex, type);
 }
コード例 #4
0
ファイル: ShopGUI.cs プロジェクト: himapo/Cas2014S
 void ChangeGun(int gunIndex, PlayerGunType type)
 {
     GunController.ChangeGun(gunIndex, type);
 }