예제 #1
0
    public void checkplayerUpgradePart(GameObject weapon)
    {
        try{
            //que local do player a parte continda na arma deverá ser spawnada/encaixada nele

            string     playerSpawPointTag = weapon.GetComponent <Weapon>().playerSpawPointTag();
            Transform  spawPoint          = player.findChildByTag(playerSpawPointTag);
            GameObject newPart            = weapon.GetComponent <Weapon>().getWeaponUpgradePart();
            if (!partWithTagAlreadyExists(newPart))//SERVE PRA LIDAR COM O CASO DA PARTE DA ARMA DEFAULT, APENAS
            {
                GameObject UpgradePart = Instantiate(newPart, spawPoint.position, Quaternion.identity);
                UpgradePart.transform.parent = player.transform;

                PlayerGlobalStatus.addPlayerUpgradePart(newPart);
            }
        }catch (System.Exception e) {
            Debug.LogWarning(e);
        }
    }