コード例 #1
0
        public override BossState Update(BossStateMachine boss)
        {
            //do stuff to the boss...

            Debug.Log("idle");

            // transitions to other states

            if (boss.CanSeeAttackTarget())
            {
                // transition to pursue state...
                AttackList();
            }
            if (currentAttack == 1 && isAttacking == true)
            {
                Debug.Log("ATTACK01");
                return(new BossStateShoot());
            }
            if (currentAttack == 2 && isAttacking == true)
            {
                Debug.Log("ATTACK02");
            }
            if (currentAttack == 3 && isAttacking == true)
            {
                Debug.Log("ATTACK03");
            }
            if (currentAttack == 4 && isAttacking == true)
            {
                Debug.Log("ATTACK04");
            }

            return(null); // stay in current state
        }
コード例 #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);
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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 (vectorToPlayer.sqrMagnitude < boss.pursueDistanceThreshold * boss.pursueDistanceThreshold) // if dis < threshold
            {
                return(new BossStatePursue());
            }

            if (!boss.CanSeeAttackTarget()) // if we can't see the player..
            {
                // transition to idle
                return(new BossStateIdle());
            }

            return(null);
        }
コード例 #5
0
        public override BossState Update(BossStateMachine boss)
        {
            if (currentAttack == 1 && isAttacking == true)
            {
                Debug.Log("ATTACK01");
            }
            if (currentAttack == 2 && isAttacking == true)
            {
                Debug.Log("ATTACK02");
            }


            return(null);
        }
コード例 #6
0
        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
        }
コード例 #7
0
 public abstract BossState Update(BossStateMachine boss);
コード例 #8
0
 public virtual void OnEnd(BossStateMachine boss)
 {
 }
コード例 #9
0
 public virtual void OnStart(BossStateMachine boss)
 {
 }
コード例 #10
0
 public override void OnEnd(BossStateMachine boss)
 {
     isAttacking = false;
 }
コード例 #11
0
 public override void OnStart(BossStateMachine boss)
 {
     ///pickAnAttack = Random.Range(1, 5);
     pickAnAttack = 1;
 }
コード例 #12
0
 public override BossState Update(BossStateMachine boss)
 {
     return(null);
 }
コード例 #13
0
 public override void OnEnd(BossStateMachine boss)
 {
     pickAnAttack  = 0;
     currentAttack = 0;
     isAttacking   = false;
 }