private void GameEvents_onCharacterRespawned(PlayerCharacterModel data)
        {
            if (!_activePlayers.ContainsKey(data.UserId))
            {
                throw new ArgumentException($"No character with userId \"{data.UserId}\" was found!");
            }

            _activePlayers[data.UserId].Movement.ResetToDefault(data);
        }
 public void ResetToDefaults(PlayerCharacterModel data)
 {
     MaxHealth = data.MaxHealth;
     CurrentHealth.SetValueAndForceNotify(data.MaxHealth);
     Damage = data.Damage;
     Position.SetValueAndForceNotify(data.Position.Value);
     Rotation = data.Rotation;
     OnReset?.Execute(this);
 }
Esempio n. 3
0
 public User(int id, string name, PlayerCharacterModel character)
 {
     Id        = id;
     Name      = name;
     Character = character;
 }
Esempio n. 4
0
 public static void CharacterRespawned(PlayerCharacterModel data)
 {
     onCharacterRespawned?.Invoke(data);
 }
Esempio n. 5
0
 public void ResetToDefault(PlayerCharacterModel data)
 {
     _lastRealPosition = data.Position.Value;
     _realPosition     = data.Position.Value;
     _user.Character.ResetToDefaults(data);
 }