public override BossState Update(BossStateMachine boss)
        {
            ///////////////////////////// STATE BEHAVIOR:
            Vector3 vectorToPlayer = boss.VectorToAttackTarget();

            Vector3 dirToPlayer = vectorToPlayer.normalized;

            boss.transform.position += dirToPlayer * boss.speed * Time.deltaTime;



            //////////////////////////// TRANSITION:
            ///


            if (!boss.CanSeeAttackTarget()) // if we can't see the player..
            {
                // transition to idle
                return(new BossStateIdle());
            }
            else if (boss.DistanceToAttackTargt() < boss.attackDistanceThreshold)
            {
                return(new BossStateAttack());
            }
            else if (boss.DistanceToAttackTargt() < boss.pursueDistanceThreshold)
            {
                return(new BossStateShoot());
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        public override BossState Update(BossStateMachine boss)
        {
            Debug.Log("Pew Pew");

            timeUntilNextShot -= Time.deltaTime;

            if (timeUntilNextShot <= 0)
            {
                boss.ShootProjectile();
                timeUntilNextShot = timeBetweenShots;
            }

            //boss.ShootProjectile();

            if (!boss.CanSeeAttackTarget())
            {
                return(new BossStateIdle());
            }
            else if (boss.DistanceToAttackTargt() < boss.attackDistanceThreshold)
            {
                return(new BossStateAttack());
            }
            else
            {
                return(null);
            }
        }
        public override BossState Update(BossStateMachine boss)
        {
            //do stuff to the boss...

            Debug.Log("idle");

            // transitions to other states



            if (boss.DistanceToAttackTargt() < boss.visionDistanceThreshold)
            {
                return(new BossStatePursue());
            }



            return(null); // stay in current state
        }