public void LaunchTo(Vector3 point, IPEndPoint ignore = null) { switch (Net.Status) { case Corsair.NetStatus.Server: NetData ns = Manager.CreateNetData(NetID, (byte)NetStatus.LaunchTo); ns.Write(point); NetServer.Send(ns, NetType.TCP, ignore); Main.LaunchTo(point); break; case Corsair.NetStatus.Client: NetData nc = Manager.CreateNetData(NetID, (byte)NetStatus.LaunchTo); nc.Write(point); NetClient.Send(nc); Main.LaunchTo(point); break; case Corsair.NetStatus.Null: Main.LaunchTo(point); break; } }
public void Hurt(AttackInfo a, IPEndPoint ignore) { switch (Net.Status) { case Corsair.NetStatus.Server: NetData ns = Manager.CreateNetData(NetID, (byte)NetStatus.Hurt); ns.Write(a.Position); ns.Write(a.Rotation); ns.Write(a.Value); NetServer.Send(ns, NetType.TCP, ignore); break; case Corsair.NetStatus.Client: NetData nc = Manager.CreateNetData(NetID, (byte)NetStatus.Hurt); nc.Write(a.Position); nc.Write(a.Rotation); nc.Write(a.Value); NetClient.Send(nc); break; case Corsair.NetStatus.Null: break; } _Hurt(a); }
public override void Hurt(AttackInfo a) { switch (Net.Status) { case Corsair.NetStatus.Server: NetData ns = Manager.CreateNetData(NetID, (byte)NetStatus.Hurt); ns.Write(a.Position); ns.Write(a.Rotation); ns.Write(a.Value); NetServer.Send(ns); break; case Corsair.NetStatus.Client: NetData nc = Manager.CreateNetData(NetID, (byte)NetStatus.Hurt); nc.Write(a.Position); nc.Write(a.Rotation); nc.Write(a.Value); NetClient.Send(nc); break; case Corsair.NetStatus.Null: break; } _Hurt(a); }
public override void Hurt(Corsair.AttackInfo a) { switch (Net.Status) { case Corsair.NetStatus.Server: NetData ns = Manager.CreateNetData(NetID, (byte)NetStatus.Hurt); ns.Write(a.Position); ns.Write(a.Rotation); ns.Write(a.Value); NetServer.Send(ns); break; case Corsair.NetStatus.Client: NetData nc = Manager.CreateNetData(NetID, (byte)NetStatus.Hurt); nc.Write(a.Position); nc.Write(a.Rotation); nc.Write(a.Value); NetClient.Send(nc); break; case Corsair.NetStatus.Null: break; } base.Hurt(a); //animator.Play("Hurt"); //attacks.prelude.gameObject.SetActive(false); }
public void Select(int i, IPEndPoint ignore = null) { switch (Net.Status) { case Corsair.NetStatus.Server: NetData ns = Manager.CreateNetData(NetID, (byte)NetStatus.Select); ns.Write(i); NetServer.Send(ns, NetType.TCP, ignore); _Select(i); break; case Corsair.NetStatus.Client: NetData nc = Manager.CreateNetData(NetID, (byte)NetStatus.Select); nc.Write(i); NetClient.Send(nc); _Select(i); break; case Corsair.NetStatus.Null: _Select(i); break; } index = i; }
private void Start() { #if UNITY_EDITOR levelId = Manager.GetCurrentLevel(); #endif Manager.SetPlayerIndex(Manager.Info.ID); Manager.SetGameStatus(GameStatus.Playing); switch (Net.Status) { case NetStatus.Server: break; case NetStatus.Client: NetData n = Manager.CreateNetData(Manager.NetID, (byte)Manager.NetStatus.GetGameObjects); NetClient.Send(n); break; case NetStatus.Null: break; } Player.PlayerAllDeathEvent += Fail; }
private void Start() { Manager.NetDataManager.Add(NetID, NetManager); switch (Net.Status) { case Corsair.NetStatus.Server: break; case Corsair.NetStatus.Client: NetClient.Send(Manager.CreateNetData(NetID, (byte)NetStatus.GetStatus)); break; case Corsair.NetStatus.Null: break; } }
public void PlayVictory(IPEndPoint ignore = null) { switch (Net.Status) { case Corsair.NetStatus.Server: NetServer.Send(Manager.CreateNetData(NetID, (byte)NetStatus.Victory), NetType.TCP, ignore); break; case Corsair.NetStatus.Client: NetClient.Send(Manager.CreateNetData(NetID, (byte)NetStatus.Victory)); break; case Corsair.NetStatus.Null: break; } PlayVictory(); }
public bool PlayAttack(int i, IPEndPoint ignore = null) { if (Time.time - attackLast[i] < attackCD[i]) { return(false); } attackLast[i] = Time.time; switch (Net.Status) { case Corsair.NetStatus.Server: NetData ns = Manager.CreateNetData(NetID, (byte)NetStatus.Attacking); ns.Write(i); NetServer.Send(ns, NetType.TCP, ignore); break; case Corsair.NetStatus.Client: NetData nc = Manager.CreateNetData(NetID, (byte)NetStatus.Attacking); nc.Write(i); NetClient.Send(nc); break; case Corsair.NetStatus.Null: break; } switch (i) { case 0: isLookAt = true; animator.Play(attackClip[0]); transform.LookAt(target, Vector3.up); break; case 1: isLookAt = false; animator.Play(attackClip[1]); break; case 2: isLookAt = true; animator.Play(attackClip[2]); transform.LookAt(target, Vector3.up); break; } return(true); }
public void PlayIdle(IPEndPoint ignore = null) { switch (Net.Status) { case Corsair.NetStatus.Server: NetServer.Send(Manager.CreateNetData(NetID, (byte)NetStatus.Idle), NetType.TCP, ignore); break; case Corsair.NetStatus.Client: NetClient.Send(Manager.CreateNetData(NetID, (byte)NetStatus.Idle)); break; case Corsair.NetStatus.Null: break; } animator.Play("Idle"); attacks.prelude.gameObject.SetActive(false); }
protected virtual void Start() { Manager.NetDataManager.Add(NetID, NetDataManager); switch (Net.Status) { case Corsair.NetStatus.Server: StartCoroutine(UpdateCor()); break; case Corsair.NetStatus.Client: NetClient.Send(Manager.CreateNetData(NetID, (byte)NetStatus.GetStatus)); break; case Corsair.NetStatus.Null: StartCoroutine(UpdateCor()); break; } }
public override void Death() { switch (Net.Status) { case Corsair.NetStatus.Server: NetData ns = Manager.CreateNetData(NetID, (byte)NetStatus.Death); NetServer.Send(ns); break; case Corsair.NetStatus.Client: NetData nc = Manager.CreateNetData(NetID, (byte)NetStatus.Death); NetClient.Send(nc); break; case Corsair.NetStatus.Null: break; } _Death(); }
public void Death(IPEndPoint ignore) { switch (Net.Status) { case Corsair.NetStatus.Server: NetData ns = Manager.CreateNetData(NetID, (byte)NetStatus.Death); NetServer.Send(ns, NetType.TCP, ignore); break; case Corsair.NetStatus.Client: NetData nc = Manager.CreateNetData(NetID, (byte)NetStatus.Death); NetClient.Send(nc); break; case Corsair.NetStatus.Null: break; } _Death(); }
private void FixedUpdate() { if (isMain) { switch (Net.Status) { case Corsair.NetStatus.Server: NetServer.Send(GetAvatar(), NetType.UDP); break; case Corsair.NetStatus.Client: NetClient.Send(GetAvatar(), NetType.UDP); break; case Corsair.NetStatus.Null: break; } } }
public void PlayDeath(IPEndPoint ignore = null) { switch (Net.Status) { case Corsair.NetStatus.Server: NetServer.Send(Manager.CreateNetData(NetID, (byte)NetStatus.Death), NetType.TCP, ignore); break; case Corsair.NetStatus.Client: NetClient.Send(Manager.CreateNetData(NetID, (byte)NetStatus.Death)); break; case Corsair.NetStatus.Null: break; } animator.Play("Death"); attacks.prelude.gameObject.SetActive(false); StopAllCoroutines(); base.Death(); }
public override void Death() { switch (Net.Status) { case Corsair.NetStatus.Server: NetServer.Send(Manager.CreateNetData(NetID, (byte)NetStatus.Death)); break; case Corsair.NetStatus.Client: NetClient.Send(Manager.CreateNetData(NetID, (byte)NetStatus.Death)); break; case Corsair.NetStatus.Null: break; } animator.Play("Death"); attacks.prelude.gameObject.SetActive(false); StopAllCoroutines(); base.Death(); }
private void Start() { SetTarget(UnityEngine.Random.Range(0, Player.Players.Count)); Manager.NetDataManager.Add(NetID, NetDataManager); switch (Net.Status) { case Corsair.NetStatus.Server: StartCoroutine(AICor()); break; case Corsair.NetStatus.Client: NetClient.Send(Manager.CreateNetData(NetID, (byte)NetStatus.GetStatus)); break; case Corsair.NetStatus.Null: StartCoroutine(AICor()); break; } }
private static IEnumerator AutoNetCor() { NetClient.Flush(); yield return(new WaitForSeconds(2f)); if (NetClient.Servers.Count > 0) { while (Net.Status != Corsair.NetStatus.Client) { NetClient.ConnectToServer(NetClient.Servers[0].IP); yield return(new WaitForSeconds(2f)); } NetData np = Manager.CreateNetData(NetID, (byte)NetStatus.GetPlayerIndex); NetClient.Send(np); NetData nl = Manager.CreateNetData(NetID, (byte)NetStatus.GetLevel); NetClient.Send(nl); } else { NetServer.Listen(); } }