public override void OnReSpawn() { // TODO read from last savepoint // read from database V3 pos = DefaultData.pos; Position = V3ToPoint3d(pos); currentHP = maxHP; SPlayerReSpawn msg = new SPlayerReSpawn(); msg.entityId = entityId; msg.HP = maxHP; msg.position = pos; Broadcast(msg); }
private void OnRecvPlayerReSpawn(IChannel channel, Message message) { SPlayerReSpawn msg = message as SPlayerReSpawn; NetworkEntity target = networkEntities[msg.entityId]; Vector3 position = Vector3.zero; position.x = msg.position.x; position.y = msg.position.y; position.z = msg.position.z; Quaternion rotation = new Quaternion(); rotation.x = msg.rotation.x; rotation.y = msg.rotation.y; rotation.z = msg.rotation.z; rotation.w = msg.rotation.w; target.gameObject.SetActive(true); target.behavior.ReSpawn(msg.HP, position, rotation); }
private void OnRecvPlayerReSpawn(IChannel channel, Message message) { SPlayerReSpawn msg = message as SPlayerReSpawn; NetworkEntity target = networkEntities[msg.entityId]; Vector3 position = Vector3.zero; position.x = msg.position.x; position.y = msg.position.y; position.z = msg.position.z; Quaternion rotation = new Quaternion(); rotation.x = msg.rotation.x; rotation.y = msg.rotation.y; rotation.z = msg.rotation.z; rotation.w = msg.rotation.w; target.gameObject.SetActive(true); target.behavior.ReSpawn(msg.HP, position, rotation); World.Instance.fPlayer.hp = World.Instance.fPlayer.health; World.Instance.fPlayer.selfController.GetComponent <Damageable>().currentHitPoints = World.Instance.fPlayer.selfController.GetComponent <Damageable>().maxHitPoints; GameObject.FindObjectOfType <HealthUI>().ChangeHitPointUI(null); }