예제 #1
0
    /// <summary>
    /// Receives the players position, assignes it to the variable <see cref="PlayerKickLocation"/> and transitions to <see cref="GnomeKickedState"/>
    /// </summary>
    /// <param name="eventInfo"> Contains information from <see cref="EventInfo"/></param>
    private void KickTheGnome(EventInfo eventInfo)
    {
        GnomeKickEventInfo gkei = (GnomeKickEventInfo)eventInfo;

        if (Vector3.Distance(gkei.playerPosition, transform.position) < kickRange)
        {
            UnregisterListeners();
            PlayerKickLocation = gkei.playerPosition;
            TransitionTo <GnomeKickedState>();
        }
    }
예제 #2
0
    /// <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);
        }
    }