public EnemyAI.STATE Update()
    {
        EnemyAI.STATE ret = EnemyAI.STATE.ATTACK;

        if (this.isMissing)
        {
            timeElapsed += Time.deltaTime;
            if (timeElapsed >= lostTime)
            {
                ret = EnemyAI.STATE.SEARCH;
            }
        }
        else
        {
            timeElapsed = 0.0f;
            targetPos   = target.transform.position;
        }

        this.NavAgent.SetDestination(targetPos);
        //if(navMeshAgent.remainingDistance < this.dashDistance)
        //{
        //    this.navMeshAgent.speed = this.dashSpeed;
        //    this.navMeshAgent.angularSpeed = this.dashRotSpeed;
        //}
        //else
        //{
        //    this.navMeshAgent.speed = this.defaultSpeed;
        //    this.navMeshAgent.angularSpeed = this.defaultRotSpeed;
        //}

        return(ret);
    }
    public EnemyAI.STATE Update()
    {
        EnemyAI.STATE ret = nextState;

        this.timeElapsed += Time.deltaTime;

        if (timeElapsed >= breakInterval)
        {
            ret = EnemyAI.STATE.SEARCH;
        }

        return(ret);
    }
Example #3
0
    public EnemyStateBase Create(EnemyAI.STATE state)
    {
        EnemyStateBase ret = null;

        switch (state)
        {
        case EnemyAI.STATE.ATTACK:
            ret = new EnemyStateAttack(this.obj, this.finder, this.dashSpeed, dashRotSpeed);
            break;

        case EnemyAI.STATE.BREAKTIME:
            ret = new EnemyStateBreaktime(this.obj, this.finder, this.breakInterval);
            break;

        case EnemyAI.STATE.SEARCH:
            ret = new EnemyStateSearch(this.obj, this.finder, this.actionNum);
            break;
        }

        return(ret);
    }
    public EnemyAI.STATE Update()
    {
        EnemyAI.STATE ret = nextState;

        //次に行く場所を更新
        if (CheckInPoint(this.targetPos, this.Obj.transform.position))
        {
            DecidedNextPoint();
            ++this.actionCnt;
        }

        if (this.actionCnt == this.actionNum)
        {
            ret = EnemyAI.STATE.BREAKTIME;
        }

        this.NavAgent.SetDestination(targetPos);
        if (this.NavAgent.remainingDistance == 0)
        {
            DecidedNextPoint();
        }

        return(ret);
    }
 protected void Found(GameObject foundObject)
 {
     nextState = EnemyAI.STATE.ATTACK;
 }