Beispiel #1
0
        // Start is called before the first frame update
        /// <summary>
        /// overides current update
        /// checks to see enemy this stwithces states
        /// </summary>
        /// <param name="boss"></param>
        /// <returns></returns>
        public override BossState Update(BossController boss)
        {
            boss.IsDead();

            if (boss.dead == true)
            {
                return(new BossStateDead());
            }

            BossController.time += Time.deltaTime;
            if (BossController.time < .3f)
            {
                boss.wasteFront.transform.Rotate(Vector3.right * boss.speed * Time.deltaTime);
                boss.wasteBack.transform.Rotate(Vector3.right * boss.speed * Time.deltaTime);
            }
            if (BossController.time <= .5f)
            {
                boss.MoveToTaregt(boss.tail, boss.tailRestPos, 25);
            }
            if (BossController.time > .5f)
            {
                BossController.time = 0;
                return(new BossStateIdel());
            }


            return(null);
        }
Beispiel #2
0
        // Start is called before the first frame update
        /// <summary>
        /// overides current update
        /// checks to see enemy this stwithces states
        /// </summary>
        /// <param name="boss"></param>
        /// <returns></returns>
        public override BossState Update(BossController boss)
        {
            boss.IsDead();

            if (boss.dead == true)
            {
                return(new BossStateDead());
            }
            if (!boss.dead)
            {
                Vector3 idel = new Vector3(0, .005f, .005f);
                BossController.time += Time.deltaTime;
                if (BossController.time < .5f)
                {
                    boss.transform.position -= idel;
                }
                if (BossController.time > .5f && BossController.time < 1.0f)
                {
                    boss.transform.position += idel;
                }
                if (BossController.time >= 1f)
                {
                    BossController.time = 0;
                }
                // boss.CanSeeAttackTarget();

                if (boss.CanSeeAttackTarget())
                {
                    //  boss.ItWorks();
                    return(new BossStateChase());
                }
            }
            return(null);
        }
Beispiel #3
0
        // Start is called before the first frame update
        /// <summary>
        /// overides current update
        /// checks to see enemy this stwithces states
        /// </summary>
        /// <param name="boss"></param>
        /// <returns></returns>
        public override BossState Update(BossController boss)
        {
            boss.IsDead();
            BossController.time += Time.deltaTime;
            if (boss.dead == true)
            {
                return(new BossStateDead());
            }

            if (BossController.time <= .5f)
            {
                boss.wasteFront.transform.Rotate(Vector3.right * boss.speed * Time.deltaTime);
                boss.wasteBack.transform.Rotate(Vector3.right * boss.speed * Time.deltaTime);


                boss.MoveToTaregt(boss.tail, boss.coilTail, 25);
            }
            else
            {
                boss.wasteFront.transform.Rotate(-Vector3.right * boss.speed * Time.deltaTime);
                boss.wasteBack.transform.Rotate(-Vector3.right * boss.speed * Time.deltaTime);
                if (BossController.attackTarget)
                {
                    boss.AttackTaregt(boss.tail, BossController.attackTarget, 25);
                }
            }


            if (BossController.time > 1.3f)
            {
                BossController.time = 0;
                return(new BossReturnBodyPartsToRest());
            }
            return(null);
        }
Beispiel #4
0
        // Start is called before the first frame update
        public override BossState Update(BossController boss)
        {//////////// State Behavior
            // move towards player
            Vector3 vectorToPlayer = boss.VectorToAttackTarget();

            /* Vector3 dirToPlayer = (boss.attackTarget.position - boss.transform.position).normalized;
             * boss.transform.position += dirToPlayer * boss.speed * Time.deltaTime;
             */boss.Follow();
            /////////////////////// transtions:
            if (EnemyHit.hit == true)
            {
                return(new BossStateDamged());
            }
            if (vectorToPlayer.sqrMagnitude < boss.pursueDistanceThreshold * boss.pursueDistanceThreshold) // if dis < htrshold

            {                                                                                              // transtion to attack
                return(new BossStateAttack());
            }

            if (!boss.CanSeeAttackTarget())  /// if we cant see player...
            {
                return(new BossStateIdel()); /// transtion to idle
            }
            return(null);
        }
Beispiel #5
0
        // Start is called before the first frame update
        /// <summary>
        /// overides current update
        /// checks to see enemy this stwithces states
        /// </summary>
        /// <param name="boss"></param>
        /// <returns></returns>
        public override BossState Update(BossController boss)
        {
            boss.transform.Rotate(Vector3.forward * boss.speed * 2 * Time.deltaTime);


            boss.transform.localPosition += new Vector3(0, .02f, 0);
            return(null);
        }
Beispiel #6
0
 // Start is called before the first frame update
 public override BossState Update(BossController boss)
 {
     Debug.Log("cooling off");
     timer += Time.deltaTime;
     if (timer >= 5)
     {
         return(new BossStateIdel());
     }
     return(null);
 }
Beispiel #7
0
        // Start is called before the first frame update
        /// <summary>
        /// overides current update
        /// checks to see enemy this stwithces states
        /// </summary>
        /// <param name="boss"></param>
        /// <returns></returns>
        public override BossState Update(BossController boss)
        {
            // Debug.Log("idle");
            //transstions

            if (boss.CanSeeAttackTarget())
            {
                return(new BossStatePrsue());
            }
            return(null);
        }
        public override BossState Update(BossController boss)
        {
            boss.Retreat();
            timer += Time.deltaTime;
            if (timer >= time)
            {
                return(new BossStateIdel());
            }

            return(null);
        }
 // Start is called before the first frame update
 public override BossState Update(BossController boss)
 {
     //Debug.Log("cooling off");
     timer += Time.deltaTime;
     if (timer >= 5)
     {
         return(new BossStateIdel());
     }
     if (EnemyHit.hit == true)
     {
         return(new BossStateDamged());
     }
     return(null);
 }
        public override BossState Update(BossController boss)
        {
            // Vector3 vectorToPlayer = boss.VectorToAttackTarget();

            /* if (vectorToPlayer.sqrMagnitude > boss.pursueDistanceThreshold * boss.pursueDistanceThreshold)// if dis < htrshold
             *
             * {                                                    // transtion to attack
             *   return new BossStatePrsue();
             * }*/

            Debug.Log("attack");

            spawn  = true;
            timer += Time.deltaTime;
            if (spawn == true & timer >= 3)
            {
                spawn = false;
                return(new BossStateCoolDown());
            }
            return(null);
        }
Beispiel #11
0
 public override BossState Update(BossController boss)
 {
     if (random == false)
     {
         attack = Random.Range(1, 4);
         random = true;
     }
     //  Debug.Log(attack);
     if (attack == 1)
     {
         boss.SpawnBasicEnemy();
         time = 5;
     }
     if (attack == 2)
     {
         boss.SpawnChargeEnmey();
         time = 2;
     }
     if (attack == 3)
     {
         boss.Charge();
         time = 1f;
     }
     //spawn = true;
     timer += Time.deltaTime;
     if (timer >= time)
     {
         random = false;
         return(new BossStateCoolDown());
     }
     if (EnemyHit.hit == true)
     {
         return(new BossStateDamged());
     }
     return(null);
 }
Beispiel #12
0
        // Start is called before the first frame update
        /// <summary>
        /// overides current update
        /// checks to see enemy this stwithces states
        /// </summary>
        /// <param name="boss"></param>
        /// <returns></returns>
        public override BossState Update(BossController boss)
        {
            boss.IsDead();

            if (boss.dead == true)
            {
                return(new BossStateDead());
            }
            float chase;

            chase = Random.Range(1, 5) + Random.Range(1, 5) + Random.Range(1, 5);

            BossController.time += Time.deltaTime;
            Vector3 vectorBetween = boss.VectorToAttackTarget();


            if (boss.CanSeeAttackTarget())
            {
                // boss.ItWorks();
                if (boss.chaseDis * boss.chaseDis < vectorBetween.sqrMagnitude)
                {
                    boss.MoveToTaregt(boss.me, BossController.attackTarget, 4);
                }
                if (BossController.time >= chase)
                {
                    BossController.time = 0;
                    return(new BossStateAttack());
                }
            }
            else
            {
                return(new BossStateIdel());
            }

            return(null);
        }
Beispiel #13
0
 public abstract BossState Update(BossController boss);
Beispiel #14
0
 public virtual void OnEnd(BossController boss)
 {
 }
Beispiel #15
0
 public virtual void OnStart(BossController boss)
 {
 }
Beispiel #16
0
 public override void OnStart(BossController boss)
 {
 }