예제 #1
0
 void OnTriggerEnter2D(Collider2D hit)
 {
     if (hit.CompareTag("star"))
     {
         carryingStar = true;
         playerInventoryDisplay.OnChangeCarryingStar(carryingStar);
         Destroy(hit.gameObject);
     }
 }
 void OnTriggerEnter2D(Collider2D hit)
 {
     if (hit.CompareTag("Star"))
     {
         totalStars++;
         playerInventoryDisplay.OnChangeCarryingStar(totalStars);
         Destroy(hit.gameObject);
     }
 }
예제 #3
0
    //--------------------------
    void OnTriggerEnter2D(Collider2D hit)
    {
        // IF we hit something tagged 'Star'
        if (hit.CompareTag("Star"))
        {
            // set our flag to TRUE
            carryingStar = true;

            // update the UI display of our star carrying status
            playerInventoryDisplay.OnChangeCarryingStar(carryingStar);

            // destroy the star object that we collided with
            Destroy(hit.gameObject);
        }
    }
예제 #4
0
 //------------------------
 // cache a reference to the PlayerInventoryDisplay object
 // that is in the parent GameObject
 //
 // and then ensure UI display matches this initial state
 // of whether we are carrying a star or not
 void Start()
 {
     playerInventoryDisplay = GetComponent <PlayerInventoryDisplay>();
     playerInventoryDisplay.OnChangeCarryingStar(carryingStar);
 }
 //------------------------
 // cache a reference to the PlayerInventoryDisplay object
 // that is in the parent GameObject
 //
 // and then ensure UI display matches this initial state
 // of whether we are carrying a star or not
 void Start()
 {
     playerInventoryDisplay = GetComponent<PlayerInventoryDisplay>();
     playerInventoryDisplay.OnChangeCarryingStar(carryingStar);
 }
예제 #6
0
 //------------------------
 // Ensure UI display matches this initial state
 // of whether we are carrying a star or not
 void Start()
 {
     playerInventoryDisplay.OnChangeCarryingStar(carryingStar);
     playerInventoryDisplay.OnChangeStarTotal(totalStars);
 }
 //------------------------
 // Ensure UI display matches this initial state
 // of whether we are carrying a star or not
 void Start()
 {
     playerInventoryDisplay.OnChangeCarryingStar(carryingStar);
 }