void OnTriggerEnter2D(Collider2D collider) { CombatParticipant participant = collider.GetComponent <CombatParticipant>(); if (participant != null && participant.combatState != CombatParticipant.CombatState.Dead && !collider.isTrigger) { this.gameObject.GetComponent <CombatParticipant>().SetTarget(participant); participant.SetTarget(this.gameObject.GetComponent <CombatParticipant>()); BeginCombat(this.gameObject); } }
void OnTriggerEnter2D(Collider2D collider) { CombatParticipant participant = collider.GetComponent <CombatParticipant>(); if (participant != null && participant != this.gameObject.GetComponent <CombatParticipant>() && !collider.isTrigger) { if (inventory.transform.GetChild(0).GetComponent <Potion>() != null) { this.gameObject.GetComponent <CombatParticipant>().SetTarget(participant); participant.SetTarget(this.gameObject.GetComponent <CombatParticipant>()); BeginCombat(this.gameObject); combatTut.BeginCombatTutorial(); } else { tutorial.SetTutorialText("You need a potion first! It's always best to have items before entering battle! Curing sadness isn't an easy task, you know!", 4f); } } }