示例#1
0
 public override void Start()
 {
     base.Start();
     fly = GetComponent <BirdFlyingState>();
     aud = GetComponent <AudioSource>();
     DifficultyManager.inst.onDifficultyChange.AddListener(UpdateWaitTime);
 }
示例#2
0
        // bird has been diving for set amount of time or hit the player
        private void ExitDive()
        {
            if (!attackHive)
            {
                RearviewCameraBehaviour.RequestRearviewOff();
            }

            attackDelay = Random.Range(attackDelayMin, attackDelayMax);

            // back to timing how long the player is in range
            attackTimer = Time.time;
            attackDelay = Random.Range(attackDelayMin, attackDelayMax);

            attackHive = false;
            currState  = BirdFlyingState.Returning;
        }
示例#3
0
        private void UpdateReturnState()
        {
            float dist = Vector3.Distance(transform.position, lastPatrolPos);

            if (dist < tipToCenter)
            {
                currState = BirdFlyingState.Patrolling;
            }

            SetTimeSlider(false, attackDelay);


            float step = Time.deltaTime;// * (attackSpeed);

            nextPoint = lastPatrolPos;

            ctlr.Move((nextPoint - transform.position) * step);
            FaceTarget(nextPoint, false);
        }
示例#4
0
        ///////////////////////////////////////////////
        //// Basic Movement States ////////////////////

        public override void UpdatePatrolState()
        {
            // figure out if the player is in the circle
            if (distToPlayer <= circleRadius)
            {
                if (!playerInRange)
                {
                    RearviewCameraBehaviour.RequestRearviewOn();
                    playerInRange = true;
                    attackTimer   = Time.time; // time how long the player is in range
                }

                SetTimeSlider(true, (Time.time - attackTimer));
            }
            else
            {
                SetTimeSlider(false, 0);
                playerInRange = false;
            }

            // State Logic
            if (playerInRange && Time.time - attackTimer > attackDelay)
            {
                currState     = BirdFlyingState.Diving;
                attackTimer   = Time.time; // time how long the bird is diving
                playerInRange = false;
                attackHive    = false;
            }
            else if (distToHive <= attackHiveDist && Time.time - attackTimer > attackDelay)
            {
                currState     = BirdFlyingState.Diving;
                attackTimer   = Time.time;
                playerInRange = false;
                attackHive    = true;
            }

            currAngle += circleSpeed * Time.deltaTime;
            currAngle %= 360;

            MoveInCircle(currAngle);
        }
示例#5
0
 //Defeated
 public override void EnemyDefeated()
 {
     currState = BirdFlyingState.Dying;
     transform.Translate(Vector3.down * (Time.deltaTime * 10), Space.World);
     Invoke(nameof(DestroyBird), 1f);
 }