Ejemplo n.º 1
0
    new public void ChangeState <T>() where T : CatAIState
    {
        CatAIState nextState = GetState <T>();

        nextState.catAI = this;
        CurrentState    = nextState;
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (isAIEnabled && !isProcessing)
        {
            AttributeType attributeType = SelectNextAttribute();
            //Debug.Log("Next Attribute " + attributeType);
            CatAIState catAIState = SelectNextAIState(attributeType);
            //Debug.Log("Next AI state " + catAIState);

            NextAction(catAIState);
        }
    }
Ejemplo n.º 3
0
    public void NextAction(CatAIState state)
    {
        currentAIState = state;
        isProcessing   = true;
        switch (state)
        {
        case CatAIState.Idle:
            StartNoneTargetAction(typeof(IdleAction));
            break;

        case CatAIState.Eat:
            StartNoneTargetAction(typeof(EatAction));
            break;

        case CatAIState.Drink:
            StartNoneTargetAction(typeof(DrinkAction));
            break;

        case CatAIState.PlayWithCustomer:
            // TODO need to craete customer
            PlayToyAction();
            break;

        case CatAIState.Sleep:
            StartNoneTargetAction(typeof(SleepAction));
            break;

        case CatAIState.PlayToy:
            PlayToyAction();
            break;

        default:
            break;
        }
        currentAction.notifyActionEnd += OnActionEnd;
    }
Ejemplo n.º 4
0
 private void OnActionEnd(Action action)
 {
     //Debug.Log("OnActionEnd " + action.name );
     currentAIState = CatAIState.None;
     isProcessing   = false;
 }