Ejemplo n.º 1
0
 /// <summary>
 /// Makes the cow run faster towards a point in front of the player but makes them stop following the player
 /// </summary>
 /// <param name="eventInfo"> contains infomation brought from <see cref="EventInfo"/></param>
 public void SendAwayCow(EventInfo eventInfo)
 {
     if (CurrentState.GetType() == typeof(CowMoveState))
     {
         SendAwayCowEvent sendAwayCowInfo = (SendAwayCowEvent)eventInfo;
         GoToLocation = sendAwayCowInfo.destination;
         Stopped      = true;
         TransitionTo <CowRunAheadState>();
     }
 }
Ejemplo n.º 2
0
    /// <summary>
    /// Trigger an event that makes following cows run ahead of the player at incerased speed.
    /// </summary>
    private void SendCowsAread()
    {
        if (Input.GetKeyDown(KeyCode.T))
        {
            runningDistance = Camera.main.transform.forward * 20 + Position.position;

            SendAwayCowEvent sace = new SendAwayCowEvent
            {
                destination = runningDistance
            };

            EventHandeler.Current.FireEvent(EventHandeler.EVENT_TYPE.SwedAwayCow, sace);
        }
    }