public void Death() { if (playerScore == "Player1") { MatchStart.p2Score++; MatchStart.NextRound(); } else { MatchStart.p1Score++; MatchStart.NextRound(); } winnerScript.ShowWinningFx(); AudioS.clip = punchHit; AudioS.Play(); Compliment(); bDead = true; Destroy(hitBox); Destroy(attackVolumeRight); Destroy(attackVolumeLeft); Destroy(this); rb.isKinematic = false; rb.AddForce(transform.forward * -5000f); anim.SetBool("isDead", true); }
public MatchStateManager() { States = new[] { typeof(MatchStart), typeof(MatchTurn), typeof(PlayerTurn), typeof(EnemyTurn) }; Current = new MatchStart(); }
void Start() { if (Instance != null) { GameObject.Destroy(gameObject); } else { DontDestroyOnLoad(gameObject); Instance = this; } if (currentRound > 2) { currentRound = 0; } Instantiate(roundTitle[currentRound], new Vector3(0, 0, 0), Quaternion.identity); }
/// <summary> /// Runs the match. /// </summary> /// <returns>The match result.</returns> public Winner Run() { // Initially there's no winner Winner winner = Winner.None; // Notify listeners match is about to start MatchStart?.Invoke( matchConfig, new string[] { matchData.GetThinker(PColor.White).ToString(), matchData.GetThinker(PColor.Red).ToString() }); // Notify listeners that we have a new empty board BoardUpdate?.Invoke(board); // Game loop while (true) { // Next player plays winner = Play(); // Break loop if a winner is found if (winner != Winner.None) { break; } } // Notify listeners that match is over MatchOver?.Invoke( winner, solution, new string[] { matchData.GetThinker(PColor.White).ToString(), matchData.GetThinker(PColor.Red).ToString() }); // Return match result return(winner); }
async Task ProcessAsync(HttpListenerContext ctx) { if (ctx.Request.UserAgent != "osu!") { return; } if (ctx.Request.Url.AbsolutePath.StartsWith("/web/")) { return; } if (string.IsNullOrEmpty(ctx.Request.Headers["osu-token"])) { await Login.Handle(ctx); return; } Player p = Global.FindPlayer(ctx.Request.Headers["osu-token"]); if (p == null) // if they arent part of the player collection, force them to relogin { ctx.Response.StatusCode = 403; ctx.Response.OutputStream.Write(Packets.Packets.SingleIntPacket(5, -5)); ctx.Response.Close(); return; } using (MemoryStream ms = new MemoryStream()) using (BinaryReader r = new BinaryReader(ms)) { await ctx.Request.InputStream.CopyToAsync(ms); ms.Position = 0; while (ms.Position < ctx.Request.ContentLength64 - 6) { short Id = r.ReadInt16(); ms.Position += 1; int Length = r.ReadInt32(); if (ms.Position + Length > ctx.Request.ContentLength64) { break; } if (Id == 68 || Id == 79) { ms.Position += Length; continue; } byte[] Data = r.ReadBytes(Length); switch (Id) { case 4: p.Ping = DateTime.Now.Ticks; break; case 0: StatusUpdate.Handle(p, Data); break; case 1: IrcMessage.Handle(p, Data); break; case 2: Player.RemovePlayer(p); break; case 3: await StatsUpdateRequest.Handle(p); break; case 16: StartSpectating.Handle(p, Data); break; case 17: StopSpectating.Handle(p); break; case 18: SpectatorFrames.Handle(p, Data); break; case 25: IrcMessage.HandlePrivate(p, Data); break; case 29: Global.LeaveLobby(p); break; case 30: Global.JoinLobby(p); break; case 31: CreateMatch.Handle(p, Data); break; case 32: JoinMatch.Handle(p, Data); break; case 33: LeaveMatch.Handle(p); break; case 38: ChangeSlot.Handle(p, Data); break; case 39: MatchReady.Handle(p); break; case 40: SlotLock.Handle(p, Data); break; case 41: MatchSettings.Handle(p, Data); break; case 44: MatchStart.Handle(p, Data); break; case 49: MatchFinished.Handle(p); break; case 51: ModsChange.Handle(p, Data); break; case 52: MatchLoaded.Handle(p); break; case 54: NoBeatmap.Handle(p); break; case 55: MatchReady.Handle(p); break; case 56: MatchFailed.Handle(p); break; case 59: HasBeatmap.Handle(p); break; case 60: MatchSkip.Handle(p); break; case 63: ChannelJoinEvent.Handle(p, Data); break; case 70: ChangeHost.Handle(p, Data); break; case 73: AddFriend.Handle(p, Data); break; case 74: RemoveFriend.Handle(p, Data); break; case 77: ChangeTeam.Handle(p, Data); break; case 78: ChannelLeaveEvent.Handle(p, Data); break; case 85: StatsUpdateRequest.Handle(p, Data); break; case 90: MatchChangePassword.Handle(p, Data); break; default: Log.LogFormat($"%#FFFF%Unhandled Packet {Id} with {Length}"); break; } } } if (p.StreamLength != 0) { p.StreamCopyTo(ctx.Response.OutputStream); } ctx.Response.Close(); }
private void OnMatchStart(bool IsRematch) { MatchStart?.Invoke(IsRematch, EventArgs.Empty); }
private void Awake() { music = GameObject.FindObjectOfType <MusicManager> (); mtchstrt = GameObject.FindObjectOfType <MatchStart>(); }
protected virtual void OnMatchStart(EventArgs e) { MatchStart?.Invoke(this, e); }
private void Awake() { pauseMenu = GameObject.Find("PauseMenu"); mtchstrt = GameObject.FindObjectOfType <MatchStart>(); }