Пример #1
0
    private void _SetAttackBox(StateMachineInfo.AttackBox attackBox, StateMachineInfo.Effect hit, int snapShotIndex = -1)
    {
        m_attackBox = attackBox;
        m_hitEff    = hit;

        m_hitEff.markedHit = true;

        m_bulletAttackInfo = m_attackBox.bulletAttackInfo;
        m_attackInfo       = m_attackBox.attackInfo;

        gameObject.SetActive(!m_attackBox.isEmpty);

        if (m_attackBox.isEmpty)
        {
            return;
        }

        if (m_attackBox.type == StateMachineInfo.AttackBox.AttackBoxType.Box)
        {
            var off = m_attackBox.start + m_attackBox.size * 0.5;
            if (!m_forward)
            {
                off.x = -off.x;
            }

            offset  = off;
            boxSize = m_attackBox.size;
            radius  = 0;
        }
        else
        {
            var off = m_attackBox.start;
            if (!m_forward)
            {
                off.x = -off.x;
            }

            boxSize      = Vector2_.zero;
            sphereOffset = off;
            radius       = m_attackBox.size.x;
        }

        #region Debug log
        #if (DEVELOPMENT_BUILD || UNITY_EDITOR) && DETAIL_BATTLE_LOG
        if (creature)
        {
            Logger.LogWarning("[{4}:{5}-{6}], Creature {0} attack box set to [{1},{2},{3},{7}], snap [{8},{9}]", creature.name, m_attackBox.attackInfo, m_attackBox.type, m_forward, Level.levelTime, creature.frameTime, creature.frameCount, snapShotIndex, enableSnapshot, m_snapShotCount);
        }
        #endif

        #if AI_LOG
        Module_AI.LogBattleMsg(creature, "[attack box set to [{0},{1},{2},{3}], snap [{4},{5}]", m_attackBox.attackInfo, m_attackBox.type, m_forward, snapShotIndex, enableSnapshot, m_snapShotCount);
        #endif
        #endregion
    }
Пример #2
0
    public void SetAttackBox(StateMachineInfo.AttackBox attackBox, StateMachineInfo.Effect hit, bool forward)
    {
        Clear();

        m_forward = forward;

        attackBox.start *= 0.1;
        attackBox.size  *= 0.1;

        _SetAttackBox(attackBox, hit);

        CreateSnapShot();
    }
Пример #3
0
    private void _Clear()
    {
        m_targetCount = 0;

        m_attackBox = StateMachineInfo.AttackBox.empty;
        m_hitEff    = StateMachineInfo.Effect.empty;

        m_bulletAttackInfo = 0;
        m_attackInfo       = 0;
        m_forward          = true;

        gameObject.SetActive(false);

        m_cols?.Clear();
    }
Пример #4
0
 public void Set(StateMachineInfo.AttackBox _attackBox, StateMachineInfo.Effect _hit, bool _isForward)
 {
     attackBox = _attackBox; hit = _hit;
     isForward = _isForward;
 }