public void netRot(Quaternion r) { NetQuaternion rotUpdate = new NetQuaternion(); rotUpdate.value = r; nm.nc.Send(900, rotUpdate); }
public void netArmRot(Quaternion r) { NetQuaternion armRotUpdate = new NetQuaternion(); armRotUpdate.value = r; nm.nc.Send(907, armRotUpdate); }
public static void Write(BinaryWriter w, NetQuaternion v) { w.Write(v.x); w.Write(v.y); w.Write(v.z); w.Write(v.w); }
public override void DoAbility(HeroManager hero) { Vector3 center = hero.characterController.bounds.center; Vector3 start = center + hero.transform.forward.normalized * 0.5f; NetVector3 netStart = new NetVector3(start); NetQuaternion quaternion = new NetQuaternion(Quaternion.identity); string spawnableResource = "Firebolt"; hero.heroCombat.CmdSpawnHomingAbility(netStart, quaternion, spawnableResource, hero.gameObject, hero.heroCombat.target.gameObject); }
public static NetQuaternion Read(BinaryReader r) { NetQuaternion v = new NetQuaternion(); v.x = r.ReadSingle(); v.y = r.ReadSingle(); v.z = r.ReadSingle(); v.w = r.ReadSingle(); return(v); }
public void CmdSpawnHomingAbility(NetVector3 vector, NetQuaternion quaternion, string spawnableResource, GameObject self, GameObject target) { GameObject firebolt = (GameObject)GameObject.Instantiate(Resources.Load(spawnableResource)); Ability ability; AbilityMap.masterAbilityMap.TryGetValue(spawnableResource, out ability); HomingAbility homingAbility = firebolt.GetComponent <HomingAbility>(); homingAbility.Initialize(vector.vector, quaternion.quaternion, ability, self.GetComponent <HeroManager>(), target.GetComponent <HeroManager>()); NetworkServer.Spawn(firebolt); }
public static NetQuaternion ToNet(this Quaternion qua) { NetQuaternion q = new NetQuaternion() { x = qua.x, y = qua.y, z = qua.z, w = qua.w }; return(q); }
void OnPlayerArmRot(NetworkMessage netMsg) { NetQuaternion netArmRot = netMsg.ReadMessage <NetQuaternion>(); PlayerQuaternion armRot = new PlayerQuaternion(); armRot.id = netMsg.conn.connectionId; armRot.quaternion = netArmRot.value; sendToAllExcept(netMsg.conn.connectionId, 917, armRot); /*foreach(User u in ConnectedUsers.FindAll(x => x.id != netMsg.conn.connectionId)){ * NetworkServer.SendToClient(u.id,910,playerRot); * }*/ }
void OnPlayerRotationChange(NetworkMessage netMsg) { NetQuaternion rotUpdate = netMsg.ReadMessage <NetQuaternion>(); PlayerQuaternion playerRot = new PlayerQuaternion(); playerRot.id = netMsg.conn.connectionId; playerRot.quaternion = rotUpdate.value; sendToAllExcept(netMsg.conn.connectionId, 910, playerRot); /*foreach(User u in ConnectedUsers.FindAll(x => x.id != netMsg.conn.connectionId)){ * NetworkServer.SendToClient(u.id,910,playerRot); * }*/ ConnectedUsers.Find(x => x.id == netMsg.conn.connectionId).rotation = rotUpdate.value; }
public static void Write(BinaryWriter w, NetHand h) { if (h.Fingers == null || h.Fingers.Count == 0) { w.Write(0); } else { w.Write(h.Fingers.Count); foreach (NetFinger f in h.Fingers) { NetFinger.Write(w, f); } } w.Write(h.IsLeft); NetVector.Write(w, h.PalmPosition); NetVector.Write(w, h.PalmNormal); NetQuaternion.Write(w, h.Rotation); NetVector.Write(w, h.XBasis); }
public static NetHand Read(BinaryReader r) { NetHand h = new NetHand(); int count = r.ReadInt32(); h.Fingers = new List <NetFinger>(); if (count > 0) { for (int i = 0; i < count; i++) { NetFinger f = NetFinger.Read(r); h.Fingers.Add(f); } } h.IsLeft = r.ReadBoolean(); h.PalmPosition = NetVector.Read(r); h.PalmNormal = NetVector.Read(r); h.Rotation = NetQuaternion.Read(r); h.XBasis = NetVector.Read(r); return(h); }
public static Quaternion ToUnity(this NetQuaternion qua) { Quaternion q = new Quaternion(qua.x, qua.y, qua.z, qua.w); return(q); }