// Start is called before the first frame update void Start() { player = GameObject.FindWithTag("Player"); playerEquippedWithStaff = player.transform.Find("changeling-staff-equipped").gameObject; playerUnarmed = player.transform.Find("changeling-unarmed").gameObject; animControllerScript = player.GetComponent <SimpleAnimationStateController>(); if (playerEquippedWithStaff.activeSelf) { this.enabled = false; } }
public void EquipPickup() { Vector3 deathPos = this.gameObject.transform.position; Quaternion deathRot = this.gameObject.transform.rotation; player = GameObject.FindWithTag("Player"); Destroy(player); // search again after original player destroyed player = GameObject.FindWithTag("Player"); ddol = player.GetComponent <DontDestroyOnLoad>(); ddol.PlayerCheck(); GameObject _playerEquipped = Instantiate(playerEquippedWithItemPrefab, deathPos, deathRot); _playerEquipped.tag = "Player"; animControllerScript = player.GetComponentInChildren <SimpleAnimationStateController>(); animControllerScript.RefreshAnimatorController(); }