Example #1
0
 public IState changeState()
 {
     IState newState = null;
     if (timeElapsed > updateRating) {
         stateable.GetComponent<IMoveable> ().SetSpeed (Vector3.zero);
         timeElapsed = 0;
         newState = new Thinking(stateable);
     }
     return newState;
 }
Example #2
0
 private IEnumerator UpdateEnumerator()
 {
     while (enabled)
     {
         if (IsThinking)
         {
             Perception.Update();
         }
         Memory.Update();
         if (IsThinking && !IsThrow)
         {
             Thinking.Update();
         }
         if (!IsThrow)
         {
             Steering.Update();
         }
         SoundEmission.Update();
         yield return(new WaitForSeconds(0.05f));
     }
 }
Example #3
0
    public void Init()
    {
        if (IsThinking)
        {
            Perception = new Perception(this);
        }
        Memory = new Memory(this);
        if (IsThinking)
        {
            Thinking = new Thinking(this);
        }
        Steering      = new Steering(this);
        SoundEmission = new SoundEmission(this);

        InitPhysicsTraits();

        rb.velocity  = Vector3.zero;
        nav.velocity = Vector3.zero;
        nav.ResetPath();

        IsInit = true;
    }