private void DoHandleBattleEvent(GetaPieceBattleEvent _Event)
    {
        if (null == _Event)
        {
            return;
        }

        // _Event.DEBUG_Print() ;

        var type = _Event.GetBattleType();

        switch (type)
        {
        case GetaPieceBattleEventType.Damage:
        {
            var targetString      = _Event.Target;
            var damageActionValue = _Event.AsInt();
            if ("Enemy" == targetString)
            {
                int damageFromPlayer = m_Enemy.CalculateSufferDamageSeperatedly(m_Player, damageActionValue);
                m_EnemyHPSinceBattleStart -= damageFromPlayer;

                UpdateHitPointEnemyFromInput(m_EnemyHPSinceBattleStart);

                if (null != m_HPVibrationEnemy)
                {
                    m_HPVibrationEnemy.ActiveVibration(1);
                }
            }
            else if ("Player" == targetString)
            {
                int damageFromEnemy = m_Player.CalculateSufferDamageSeperatedly(m_Enemy, damageActionValue);
                m_PlayerHPSinceBattleStart -= damageFromEnemy;

                UpdateHitPointPlayerFromInput(m_PlayerHPSinceBattleStart);

                if (null != m_HPVibrationPlayer)
                {
                    m_HPVibrationPlayer.ActiveVibration(1);
                }
            }
        }
        break;
        }
    }
Exemplo n.º 2
0
    private void DoHandleBattleEvent( GetaPieceBattleEvent _Event )
    {
        if( null == _Event )
        {
            return ;
        }

        // _Event.DEBUG_Print() ;

        var type = _Event.GetBattleType() ;
        switch( type )
        {
        case GetaPieceBattleEventType.Damage :
            {
                var targetString = _Event.Target ;
                var damageActionValue = _Event.AsInt() ;
                if( "Enemy" == targetString )
                {
                    int damageFromPlayer = m_Enemy.CalculateSufferDamageSeperatedly( m_Player , damageActionValue ) ;
                    m_EnemyHPSinceBattleStart -= damageFromPlayer ;

                    UpdateHitPointEnemyFromInput( m_EnemyHPSinceBattleStart ) ;

                    if( null != m_HPVibrationEnemy )
                    {
                        m_HPVibrationEnemy.ActiveVibration( 1 ) ;
                    }

                }
                else if( "Player" == targetString )
                {
                    int damageFromEnemy = m_Player.CalculateSufferDamageSeperatedly( m_Enemy , damageActionValue ) ;
                    m_PlayerHPSinceBattleStart -= damageFromEnemy ;

                    UpdateHitPointPlayerFromInput( m_PlayerHPSinceBattleStart ) ;

                    if( null != m_HPVibrationPlayer )
                    {
                        m_HPVibrationPlayer.ActiveVibration( 1 ) ;
                    }
                }

            }
            break ;
        }
    }