Beispiel #1
0
 // Update is called once per frame
 void Update()
 {
     if (m_triggerableAI.Active() || m_health.IsDead())
     {
         UpdateBossState();
     }
 }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        if (m_player != null && m_triggerableAI.Active())
        {
            if (m_move)
            {
                Vector2 playerPositionOffset = transform.position - m_player.transform.position;
                if (playerPositionOffset.magnitude > m_combatRange)
                {
                    m_movement.MoveToPlayer();
                }
            }

            if (m_attackSpeed > 0)
            {
                m_attackCooldown += Time.deltaTime;

                float attackRate = (1 / m_attackSpeed);
                if (m_attackCooldown > attackRate)
                {
                    Attack();
                    m_attackCooldown -= attackRate + Random.value * m_attackSpeedRand;
                }
            }
        }
    }
Beispiel #3
0
 void Update()
 {
     if (m_player != null && m_triggerableAI.Active())
     {
         m_movement.MoveToPlayer();
     }
 }
Beispiel #4
0
    void Update()
    {
        if (m_player != null && m_triggerableAI.Active())
        {
            m_age += Time.deltaTime;

            m_fader.SetFade(m_age / m_lifespan);

            if (m_age > m_lifespan)
            {
                Destroy(gameObject);
            }
        }
    }
Beispiel #5
0
    private void Update()
    {
        if (m_damage != null && m_damage.IsDead())
        {
            return;
        }

        if (m_wanderAlways || (m_wanderWhenInactive && !m_triggerableAI.Active()))
        {
            if (m_wanderTarget == Vector2.zero)
            {
                RandomWanderTarget();
            }

            float distanceToPosition = (new Vector2(transform.position.x, transform.position.y) - m_wanderTarget).magnitude;
            if (distanceToPosition < 0.5f)
            {
                RandomWanderTarget();
            }

            MoveToTarget(m_wanderTarget, m_wanderSpeedMod);
        }
    }