示例#1
0
        public void PlayerInteraction()
        {
            //checks if Item is interactable and if the the "cost" text (converted to int) is an acceptable amount to reduce from Player rupee count
            //I'll probably rewrite this so its not a super long conditional
            if (interactable && Rupees.decreaseCount(System.Convert.ToInt32(Canvas.transform.GetChild(1).GetComponent <Text>().text)))
            {
                //Debug.Log("someone interacted with me :)");

                //Call function that gives approprach loot/action

                //Destroy the object
                Destroy(this.gameObject);


                //call the players collectitem function
                Player.SendMessage("collectItem", Upgrade);

                //the intial interaction of the Player causes his Attack and movement to stop working. This resets those values
                Player.canMove              = true;
                Player.canAttack            = true;
                Player.currentlyInteracting = false;

                //Chest has been opened and can never be used again
                interactable = false;

                return;
            }
            //if the object isnt interactable we still need regain control of Player
            Player.canMove              = true;
            Player.canAttack            = true;
            Player.currentlyInteracting = false;
        }
示例#2
0
        public void PlayerInteraction()
        {
            if (interactable)
            {
                //Call function that gives approprach loot/action

                //change the sprite to the open Chest
                GetComponent <SpriteRenderer>().sprite = ChestOpen;


                //call the players collectitem function
                Player.SendMessage("collectItem", InsideItem);

                //the intial interaction of the Player causes his Attack and movement to stop working. This resets those values
                Player.canMove              = true;
                Player.canAttack            = true;
                Player.currentlyInteracting = false;

                //Chest has been opened and can never be used again
                interactable = false;

                return;
            }
            //if the object isnt interactable we still need regain control of Player
            Player.canMove              = true;
            Player.canAttack            = true;
            Player.currentlyInteracting = false;
        }
示例#3
0
        public void PlayerInteraction()
        {
            //call the players collectitem function
            Player.SendMessage("collectItem", triforcePiece);
            Player.triforceCount++;

            //the intial interaction of the Player causes his Attack and movement to stop working. This resets those values
            Player.canMove              = true;
            Player.canAttack            = true;
            Player.currentlyInteracting = false;
            Destroy(this.gameObject);
            return;
        }