예제 #1
0
    public void reportPlayerAttackHit(int playerId, int minionId)
    {
        var message = new PlayerAttackMessage();

        message.playerId    = EntityId;
        message.minionIdHit = minionId;
        message.Damage      = _playerDataService.GetPlayerDamage(EntityId);
        _messageRouter.RaiseMessage(message);
    }
예제 #2
0
    private void OnPlayerAttackMessage(PlayerAttackMessage message)
    {
        _animator.Play("EnemyDamage", 0, 0);

        float damage = GetDamage(message.Attack);

        _characterStats.TakeDamage(damage);
        UpdateCharacterInfo();

#if DEBUG
        Debug.LogFormat("[HP: {0} AT: {1} DF: {2}] {3} took {4} damage",
                        _characterStats.Life, _characterStats.Attack, _characterStats.Defense, name, damage);
#endif

        if (_characterStats.Life <= 0)
        {
            StartCoroutine(EnemyKilled());
        }
    }
예제 #3
0
    private void OnPlayerAttack(PlayerAttackMessage message)
    {
        //Create a copy of the active minion list
        List <MinionData> tempMinionList = _activeMinions;

        //Check each minion in this temp list to see if it matches the ID from the player
        foreach (MinionData minion in tempMinionList)
        {
            if (minion.EntityId == message.minionIdHit)
            {
                //Reduce the minion's HP by the damage value on the message.
                minion.currentHP -= message.Damage;
                //here I would send out an UpdateHealthBar message with the entity ID
                UpdateHealthBar(minion.EntityId);
                if (minion.currentHP <= 0)
                {
                    //If the minion is dead, destroy the minion with that ID.
                    DestroyMinion(minion.EntityId);
                }
            }
        }
    }
예제 #4
0
 private void OnPlayerAttackMessage(PlayerAttackMessage message)
 {
     _shakeDuration = _playerShakeDuration;
     ShakeCamera();
 }