コード例 #1
0
ファイル: BossAI.cs プロジェクト: Blaster391/LD48
 // Update is called once per frame
 void Update()
 {
     if (m_triggerableAI.Active() || m_health.IsDead())
     {
         UpdateBossState();
     }
 }
コード例 #2
0
ファイル: ShootingAI.cs プロジェクト: Blaster391/LD48
    // 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;
                }
            }
        }
    }
コード例 #3
0
 void Update()
 {
     if (m_player != null && m_triggerableAI.Active())
     {
         m_movement.MoveToPlayer();
     }
 }
コード例 #4
0
ファイル: Ghost.cs プロジェクト: Blaster391/LD48
    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);
            }
        }
    }
コード例 #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);
        }
    }