private void UpdateAggression()
        {
            aggression.UpdateTrait(UPDATE_AGRESSION_TIMER);
            if (Time.time < lastAttackTime + ATTACK_REFRACTORY_PERIOD)
            {
                return;
            }

            if (Player.main == null || Player.main.currentSub == null || Player.main.currentSub.gameObject.GetComponent <Content.Submarine>() == null)
            {
                return;
            }

            if (Vector3.Distance(Player.main.currentSub.transform.position, transform.position) < TARGET_VALID_RANGE && Vector3.Distance(Player.main.currentSub.transform.position, creature.leashPosition) < MAX_LEASH_DISTANCE)
            {
                aggression.Add(AGGRESSION_GAINED_PER_SECOND * UPDATE_AGRESSION_TIMER);
                Utilities.Log.Print("New Aggression: " + aggression.Value);
            }

            if (isAttacking)
            {
                currentTarget = Player.main.currentSub.gameObject;
                UpdateAttackPoint();
                lastTarget.SetLockedTarget(currentTarget);
            }
        }
Beispiel #2
0
 public override void StartPerform(Creature creature)
 {
     SafeAnimator.SetBool(creature.GetAnimator(), "attacking", true);
     lastTarget.SetLockedTarget(Player.main.currentSub.gameObject);
 }