Esempio n. 1
0
    void Start()
    {
        anim = GetComponent <Animator> ();


        botWander  = GetComponent <BOT_Wander>();
        bOT_Attack = GetComponent <BOT_Attack>();

        navMeshAgent = GetComponent <NavMeshAgent>();

        currentStateWander = BOT_FStateMachineWander.StartWander;
        currentStateAttack = BOT_FStateMachineAttack.LookForEnemy;
        currentMoveState   = BOT_FStateMachineMoveTowardsEnemy.Stopped;
        localSettings      = GameObject.Find("LocalSettings").GetComponent <LocalSettings>();
    }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
        if (!PhotonNetwork.isMasterClient)
        {
            return;
        }

        //if (!started) {
        //	hackytimer -= Time.deltaTime;
        //	if (hackytimer <= 0f) {
        //currentStateWander = BOT_FStateMachineWander.Wander;
        //StartWander();
        //		Debug.LogError ("aaa");
        //		started = true;
        //	}
        //}

        anim.SetFloat("InputV", speedTriggerThings.y);
        anim.SetFloat("InputH", speedTriggerThings.x);

        ///WANDER STATE
        switch (currentStateWander)
        {
        case BOT_FStateMachineWander.Stop:
            StopWandering();
            break;

        case BOT_FStateMachineWander.StartWander:
            StartWander();
            break;

        case BOT_FStateMachineWander.Wander:
            break;

        case BOT_FStateMachineWander.StoppedWandering:
            StoppedWandering();
            break;
        }

        ///ATTACK STATE
        switch (currentStateAttack)
        {
        case BOT_FStateMachineAttack.LookForEnemy:
            StartAttackState();
            break;

        case BOT_FStateMachineAttack.GetEnemyTeam:
            break;

        case BOT_FStateMachineAttack.Stop:
            break;
        }

        switch (currentMoveState)
        {
        case BOT_FStateMachineMoveTowardsEnemy.MoveTowardsEnemy:
            MoveToTheEnemy();
            break;

        case BOT_FStateMachineMoveTowardsEnemy.Stop:
            navMeshAgent.isStopped = true;
            currentMoveState       = BOT_FStateMachineMoveTowardsEnemy.Stopped;
            break;

        case BOT_FStateMachineMoveTowardsEnemy.Stopped:
            break;
        }
    }