void OnTriggerEnter2D(Collider2D hit) { if (hit.CompareTag("Star")) { totalStars++; playerInventoryDisplay.OnChangeStarTotal(totalStars); Destroy(hit.gameObject); } }
void OnTriggerEnter2D(Collider2D hit) { if (hit.CompareTag("Coin")) { totalStars++; UpdateStarText(); Destroy(hit.gameObject); } else if (hit.CompareTag("Banana")) { totalHp++; playerInventoryDisplay.OnChangeStarTotal(totalHp); Destroy(hit.gameObject); } if (hit.CompareTag("Coconut")) { carryingStar = true; UpdateStarImage(); Destroy(hit.gameObject); } }
public void AddStar() { starTotal++; playerInventoryDisplay.OnChangeStarTotal(starTotal); }
// Start is called just before any of the Update methods is called the first time void Start() { playerInventoryDisplay = GetComponent <PlayerInventoryDisplay>(); playerInventoryDisplay.OnChangeStarTotal(starTotal); }
//------------------------ // Ensure UI display matches this initial state // of whether we are carrying a star or not void Start() { playerInventoryDisplay.OnChangeStarTotal(totalStars); }
//------------------------ // Ensure UI display matches this initial state // of whether we are carrying a star or not void Start() { playerInventoryDisplay.OnChangeCarryingStar(carryingStar); playerInventoryDisplay.OnChangeStarTotal(totalStars); }
//---------------------------------- // get reference to display scripted instance object // and tell it to display the inital 'starTotal' void Start() { playerInventoryDisplay = GetComponent<PlayerInventoryDisplay>(); playerInventoryDisplay.OnChangeStarTotal(starTotal); }
void Start() { playerInventoryDisplay.OnChangeStarTotal(starTotal); }