コード例 #1
0
 public void SetTarget(Transform target)
 {
     player = target;
     RearviewCameraBehaviour.RequestRearviewOff();
     if (target.CompareTag("Player"))
     {
         RearviewCameraBehaviour.RequestRearviewOn();
     }
 }
コード例 #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
        ///////////////////////////////////////////////
        //// Attacking State //////////////////////////

        private void UpdateAttackState()
        {
            if (attackHive)
            {
                Debug.DrawLine(transform.position, hive.transform.position, Color.green);
            }
            else
            {
                Debug.DrawLine(transform.position, player.transform.position, Color.blue);
            }

            bool attackingPlayer = !attackHive && (distToPlayer <= minPlayerDistance);
            bool attackingHive   = attackHive && (distToHive <= minHiveDistance);

            if (!attackingPlayer && !attackingHive ||
                (Time.time - patrolStuckTimer) > 10f)
            {
                RearviewCameraBehaviour.RequestRearviewOff(); // attacking is done
                currState        = WaspFlyingState.Patrolling;
                patrolStuckTimer = Time.time;
            }

            anim.SetInteger(AnimState, 1);

            Vector3   toTarget = (player.transform.position - transform.position);
            Transform lookAt   = null;

            if (attackingPlayer)
            {
                toTarget   = player.transform.position - transform.position;
                lookAt     = player.transform;
                attackHive = false;
            }
            else if (attackingHive)
            {
                toTarget   = hive.transform.position - transform.position;
                lookAt     = hive.transform;
                attackHive = true;
            }

            if (lookAt != null)
            {
                MoveInDir(toTarget, attackSpeed);
                transform.LookAt(lookAt);
            }
        }
コード例 #4
0
        // This can be more fleshed out in future iterations of our game
        public void FinishSting(int score, int maxScore, GameObject target)
        {
            LevelManager   lm       = FindObjectOfType <LevelManager>();
            EnemyBehaviour targetEB = target.GetComponent <EnemyBehaviour>();

            if (targetEB == null)
            {
                targetEB = target.GetComponentInParent <EnemyBehaviour>();
            }

            stinging = false;
            // killing the wasps can definitely be improved upon
            if (score > maxScore * .9)
            {
                Debug.Log("Option1");
                lm.IncrementHealth(-minDamage);
                targetEB.EnemyDefeated();
            }
            else if (score > maxScore * .6)
            {
                Debug.Log("Option2");
                lm.IncrementHealth(-averageDamage);
                targetEB.EnemyDefeated();
            }
            else if (score > maxScore * .4)
            {
                Debug.Log("Option3");
                lm.IncrementHealth(-maxDamage);
                targetEB.EnemyDefeated();
            }
            else
            {
                Debug.Log("Option4");
                lm.IncrementHealth(-maxDamage);
            }

            stingIndicator.SetActive(false);
            RearviewCameraBehaviour.RequestRearviewOff();
            FindObjectOfType <PlayerControl>().StartBuzzSFX();
        }
コード例 #5
0
 private void OnDestroy()
 {
     RearviewCameraBehaviour.RequestRearviewOff();
 }