Esempio n. 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
        }
Esempio n. 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)
        {
            ///////////////////////////// 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);
            }
        }
        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);
        }