public void IncreaseOveralMultiplier(global::Event e) { Debug.Assert(e.GetType() == typeof(SwordContactEvent), "Non-SwordContactEvent in IncreaseOverallMultiplier"); SwordContactEvent swordEvent = e as SwordContactEvent; if (swordEvent.rb.transform.parent.gameObject.name == PLAYER_OBJ && swordEvent.collision.collider.gameObject.name == OPPONENT_OBJ + OPPONENT_SWORD_OBJ) { OverallMultiplier += overallIncrement; Services.Events.Fire(new NewSpeedEvent(OverallMultiplier)); if (Services.Speed.OverallMultiplier >= vulnerableMultiplier) { Services.UI.ChangeExplanatoryMessage(STRIKE_MSG); } } else if (swordEvent.collision.collider.gameObject.name.Contains(OPPONENT_OBJ) && Services.Speed.OverallMultiplier < vulnerableMultiplier) { Services.UI.ChangeExplanatoryMessage(SPEED_UP_MSG); } else if (swordEvent.collision.collider.gameObject.name.Contains(OPPONENT_OBJ) && Services.Speed.OverallMultiplier >= vulnerableMultiplier) { Services.UI.ChangeExplanatoryMessage(SUCCESS_MSG); } else if ((swordEvent.collision.collider.gameObject.name == PLAYER_OBJ + BODY_OBJ) || (swordEvent.collision.collider.gameObject.name == PLAYER_OBJ + HEAD_OBJ) && Services.Speed.OverallMultiplier >= vulnerableMultiplier) { Services.UI.ChangeExplanatoryMessage(LOSE_MSG); } }
/// <summary> /// This function has the opponent pull their sword back to the position it was in when they started the attack. /// </summary> /// <param name="e">A SwordContactEvent</param> protected virtual void WithdrawSequence(global::Event e) { Debug.Assert(e.GetType() == typeof(SwordContactEvent), "Non-SwordContactEvent in WithdrawSequence()."); SwordContactEvent contactEvent = e as SwordContactEvent; //make sure the contacting sword is this opponent's sword, not the player's sword, etc. if (contactEvent.rb.transform.parent.gameObject.name == opponentObjName) { Services.Tasks.AddTaskExclusive(new AdoptStanceTask(startStance, this)); } }