void OnCollisionExit2D(Collision2D collision) { this.InteractingObject = null; InteractingWith = null; Interacting = false; StoveInteractingWith = null; StoveInteracting = false; }
void OnCollisionEnter2D(Collision2D collision) { print(this.name + " has collided with " + collision.collider.name); // Get the interaction object if it exists this.InteractingWith = collision.collider.GetComponent <Interaction>(); this.InteractingObject = collision.collider.gameObject; if (InteractingWith != null) { Interacting = true; } // Or Get stove this.StoveInteractingWith = collision.collider.GetComponent <StoveScript>(); if (StoveInteractingWith != null) { StoveInteracting = true; } }
// private int totalWallCnt = 6; // private int currentWallCnt = 6; // private int currentHP; // private Image HPBarImage; // Use this for initialization void Awake() { instance = this; // currentHP = (totalWallCnt - 1) * HpPerWall; // HPBarImage = HPBar.GetComponent<Image>(); }