public void Start() { m_networkMove = GetComponent <PlayerNetworkMove>(); m_networkSkills = GetComponent <PlayerNetworkSkills>(); m_networkData = GetComponent <PlayerNetworkData>(); m_playerBeer = GetComponent <PlayerBeer>(); m_rigidbody = GetComponent <Rigidbody>(); m_animator = GetComponent <Animator>(); m_buffs = new List <Buff>(); }
public Snapshot(BitBuffer buffer) { _playersData = new Dictionary <int, PlayerNetworkData>(); var playersLengths = buffer.GetInt(); for (var i = 0; i < playersLengths; i++) { var playerId = buffer.GetInt(); var networkData = new PlayerNetworkData(buffer); _playersData.Add(playerId, networkData); } }
public void StunPlayer(GameObject player) { PlayerNetworkData playerNetData = player.GetComponent <PlayerNetworkData>(); if (playerNetData.PlayerTeam() == m_team) { return; } CharacterManager character = player.GetComponent <CharacterManager>(); character.AddBuff(new Buff(Buff.BuffTypes.Stun, 1)); GameObject.Destroy(gameObject); }
void FixedUpdate() { _acumTime += Time.deltaTime; if (_clientId != -1) { ManageInputs(); _snapshotManager.Interpolate(_players, _acumTime, _clientId); Snapshot currentSnapshot = _snapshotManager.CurrentSnapshot; if (currentSnapshot != null && !currentSnapshot.IsEmpty() && currentSnapshot.GetClient(_clientId) != null) { PlayerNetworkData meInSnapshot = currentSnapshot.GetClient(_clientId); _uiManager.SetData(meInSnapshot); _inputManager.RemoveAckInputs(meInSnapshot.MostBigInput); dummy.transform.position = meInSnapshot.Position; dummy.transform.rotation = meInSnapshot.Rotation; dummyHead.transform.rotation = meInSnapshot.Rotation; _inputManager.ExecuteConciliateInputs(dummy); _players[_clientId].Conciliate(dummy); } } }
public void SetData(PlayerNetworkData data) { _healthText.text = string.Format("Vida: {0}", data.Health); _pointsText.text = string.Format("Puntos: {0}", data.Points); }
public void Interpolate(PlayerNetworkData data, float time) { _entity.transform.position = Vector3.Lerp(_lastPosition, data.Position, time); _entity.transform.rotation = Quaternion.Lerp(_lastRotation, data.Rotation, time); // _head.transform.rotation = Quaternion.Lerp(_lastHeadRotation, data.HeadRotation, time); }