private void Awake() { playerMovement = GetComponent <PlayerMovement>(); playerCarry = GetComponent <PlayerCarry>(); camTransform = Camera.main.transform; }
private void Awake() { if (CarryInstance == null) { DontDestroyOnLoad(this); CarryInstance = this; } else { if (CarryInstance != this) { Destroy(gameObject); } } }
private void Start() { playerCarry = (PlayerCarry)FindObjectOfType(typeof(PlayerCarry)); List <string> playerUnlocks = playerCarry.getPlayerUnlocks(); foreach (string ball in playerUnlocks) { GameObject.Find(ball).tag = "Unlocked"; } itemSlotArray = GameObject.FindGameObjectsWithTag("Unlocked"); foreach (GameObject ball in itemSlotArray) { ball.transform.GetChild(1).gameObject.SetActive(true); } }
private void Start() { playerCarry = GameObject.Find("PlayerCarry").GetComponent <PlayerCarry>(); if (playerCarry.getPlayerUnlock() != null) { Debug.Log(playerCarry.getPlayerUnlock()); GameObject.Find(playerCarry.getPlayerUnlock()).tag = "Unlocked"; } itemSlotArray = GameObject.FindGameObjectsWithTag("Unlocked"); foreach (GameObject ball in itemSlotArray) { ball.transform.GetChild(1).gameObject.SetActive(true); } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { PlayerCarry player = other.GetComponent <PlayerCarry>(); if (player == null) { return; } if (!player.Carrying) { player.itemAvailable = this.gameObject; } } }
public void setBall(string ball) { PlayerCarry carry = (PlayerCarry)FindObjectOfType(typeof(PlayerCarry)); carry.GetComponent <PlayerCarry>().setPlayerChoice(ball); }