예제 #1
0
    void Update()
    {
        if (currentCooldown >= 0)
        {
            currentCooldown -= Time.deltaTime;
        }

        //Dead
        if (hc.isDead)
        {
            if (this.gameObject.name.Contains("Big Fish Enemy"))
            {
                SFXHelper.PlayEffect(SFXs.BigFishDeath);
            }
            if (this.gameObject.name.Contains("Jelly Fish Enemy"))
            {
                SFXHelper.PlayEffect(SFXs.JellyFishDeath);
            }

            Destroy(this.gameObject);
        }

        /* BEHAVIOUR ACTIONS */
        timeSinceLastAction += Time.deltaTime;
        if (timeSinceLastAction > TimeBetweenActions)
        {
            timeSinceLastAction = 0;
            currentBehaviour.BehaviorAction(this);
            //Flock adjustments
            CurrentDirection += AIHelper.FlockMainBehaviour(this).normalized;
        }

        UpdateVelocity();
        UpdateSpriteDirection();
        enemyBrain.CheckConditionsForNewBehaviours(this);
    }