/// <summary> /// Pets the cow and kicks away gnomes. /// </summary> private void Interact() { if (Input.GetButtonDown("Interact")) { PetCowEventInfo pcei = new PetCowEventInfo { playerPosition = Position.position }; EventHandeler.Current.FireEvent(EventHandeler.EVENT_TYPE.PetCow, pcei); GnomeKickEventInfo gkei = new GnomeKickEventInfo { playerPosition = Position.position }; EventHandeler.Current.FireEvent(EventHandeler.EVENT_TYPE.Gnomekick, gkei); } }
/// <summary> /// Allows the player to interact with the cow to bring up the cows name /// </summary> /// <param name="eventInfo"> contains infomation brought from <see cref="EventInfo"/></param> public void PetTheCow(EventInfo eventInfo) { PetCowEventInfo petCowEventInfo = (PetCowEventInfo)eventInfo; if (Vector3.Distance(petCowEventInfo.playerPosition, transform.position) < 3f && CurrentState.GetType() != typeof(CowFleeState)) { if (CurrentState.GetType() != typeof(CowCapturedState) && CurrentState.GetType() != typeof(CowFollowState)) { Debug.Log(CurrentState.GetType()); Called = true; TransitionTo <CowFollowState>(); } Debug.Log("The Player pets " + Name + ". She seems to enyoj it"); } }