// OnTriggerEnter2D is called when the Collider2D other enters the trigger (2D physics only) private void OnTriggerEnter2D(Collider2D collision) { if (collision.GetComponentInParent <Player>() != null) { UI_shop.inventory = GenerateNewLoot(); UI_Stats.SwitchWindowStance(UI_Stats.WindowStance.shop); Destroy(gameObject); MusicPlayer.PlayBel(); } }
internal void ProcessHit(Enemy enemy) { if (UnityEngine.Random.value < doge) { Debug.Log("Doged the attack"); return; } float armor = equipment.Armor(); if (UnityEngine.Random.value < armor) { Debug.Log("Deflected the attack"); return; } hitpoints -= enemy.damage; Debug.Log("Hit. HP left: " + hitpoints); if (hitpoints <= 0) { gameOver.distance = transform.position.magnitude; UI_Stats.SwitchWindowStance(UI_Stats.WindowStance.gameOver); } }
// Use this for initialization void Start() { inventoryCanvas = GetComponent <UI_Inventory>(); uiStats = GetComponent <UI_Stats>(); uiMessages = GetComponent <UI_Messages>(); }