public override void Process(Match match) { var round = match.GetCurrentRound(); var endEvent = new RoundEnd(); round.RoundEvents.Add(endEvent); }
public void CT_win(RoundEnd why) { if (isT) { if (isOnline) { if (!PhotonNetwork.IsMasterClient) { return; } sendRoundWin(why); } roundLose(why); Debug.Log("rl1"); } else { if (isOnline) { if (!PhotonNetwork.IsMasterClient) { return; } sendRoundLose(why); } roundWin(why); Debug.Log("rw1"); } }
public void LaunchEndRound() { RoundEnd?.Invoke(); Sequence sequence = DOTween.Sequence(); sequence.AppendInterval(2); sequence.OnComplete(() => RoundStart?.Invoke()); }
public static DiscordEmbed ToEmbed(this RoundEnd ev) { Translation translation = Bot.TranslationConfig.Translation; var embedBuilder = new DiscordEmbedBuilder(); embedBuilder.Title = translation.Elements["Round Summary"]; embedBuilder.Color = DiscordColor.Gold; if (Bot.BotConfig.EmbedConfigs.RoundSummaryConfig.ShowRoundLength) { embedBuilder.AddField($"{translation.Elements["Round Length"]}", TimeSpan.FromSeconds(ev.RoundSummary.RoundTime).ToString(), false); } if (Bot.BotConfig.EmbedConfigs.RoundSummaryConfig.ShowTotalKills) { embedBuilder.AddField($"{translation.Elements["Total Kills"]}", ev.RoundSummary.TotalKills.ToString(), true); } if (Bot.BotConfig.EmbedConfigs.RoundSummaryConfig.ShowTotalScpKills) { embedBuilder.AddField($"{translation.Elements["Kills By SCPs"]}", ev.RoundSummary.TotalKillsByScps.ToString(), true); } if (Bot.BotConfig.EmbedConfigs.RoundSummaryConfig.ShowTotalFragGrenadeKills) { embedBuilder.AddField($"{translation.Elements["Kills By Frag Grenades"]}", ev.RoundSummary.TotalKillsByFragGrenade.ToString(), true); } if (Bot.BotConfig.EmbedConfigs.RoundSummaryConfig.ShowTotalEscapedDClass) { embedBuilder.AddField($"{translation.Elements["Escaped D-Class"]}", ev.RoundSummary.TotalEscapedDClass.ToString(), true); } if (Bot.BotConfig.EmbedConfigs.RoundSummaryConfig.ShowTotalEscapedScientists) { embedBuilder.AddField($"{translation.Elements["Escaped Scientists"]}", ev.RoundSummary.TotalEscapedScientists.ToString(), true); } string aliasOrAddress = GetAlias(ev); if (Bot.BotConfig.EmbedConfigs.DisplayServerIpOrAlias) { embedBuilder.WithFooter($"{translation.Elements["Server"]}: {aliasOrAddress}"); } embedBuilder.Timestamp = ev.Time; return(embedBuilder.Build()); }
private void sendRoundLose(RoundEnd why) { Debug.Log("PhotonNetwork.IsMasterClient:" + PhotonNetwork.IsMasterClient); if (!PhotonNetwork.IsMasterClient) { return; } Debug.Log("I send now roundlose ct:" + ctScore + " t:" + tScore); online.sendEndRoundData(tScore, ctScore, false, why); }
public void onlineReceiveEndRound(int tScore, int ctScore, bool isRoundWin, RoundEnd why) { this.tScore = tScore; this.ctScore = ctScore; Debug.Log("I receive now round win: " + isRoundWin + " ct:" + ctScore + " t:" + tScore); if (isRoundWin) { roundWin(why); Debug.Log("rw2"); } else { roundLose(why); Debug.Log("rl3"); } }
private void roundWin(RoundEnd why) { Debug.Log("Round Win"); gameMoney.addMoney(gameMoney.ROUNDWIN_MONEY); giveScore(true); StartCoroutine(showDialogNextFrame(isT)); if (isT) { GetComponent <AudioSource>().PlayOneShot(T_Win_AC); } else { GetComponent <AudioSource>().PlayOneShot(why == RoundEnd.Defused ? bombHasBeenDefusedAC : CT_Win_AC); } endRound(); }
//Called when the round is over public void OnRoundEnd(RoundEnd evt) { if (evt.WinnerIndex == PlayerIndex) { hasWon = true; } else if (evt.Draw) { hasDraw = true; } else if (evt.LoserIndex == PlayerIndex && evt.TimeOut) { hasLost = true; } else if (evt.LoserIndex == PlayerIndex) { hasLost = true; } }
public static void InitializeForms() { _forms = new List <Form>(); createRoomView = new CreateRoomView(); gameEnd = new GameEnd(); gameView = new GameView(); homeView = new HomeView(); joinRoomView = new JoinRoomView(); roundEnd = new RoundEnd(); _forms.Add(createRoomView); _forms.Add(gameEnd); _forms.Add(gameView); _forms.Add(homeView); _forms.Add(joinRoomView); _forms.Add(roundEnd); foreach (Form form in _forms) { form.FormClosed += new FormClosedEventHandler((object sender, FormClosedEventArgs e) => { Environment.Exit(0); }); } }
public void RoundFinished_TwoPlayers(RoundEnd roundEnd) { DebugP("RoundFinished"); if (roundEnd == RoundEnd.killedByMonster) { this.LostGame(); this.RunRound(this.round); if (this.ToString() == "PlayerOne") // first player provides his calendar { form.playerTwo.FlushEventBuffer(); form.playerTwo.RegisterForeignCalendar(this); } } if (roundEnd == RoundEnd.taskFinished) { if (this.ToString() == "PlayerOne") { form.playerTwo.SendVictoryMessage(); this.model.calendar.IsEnabledAddingEvents = false; gameDesk.RegisterScene(new Scene_EndOfRound(150, gameDesk), this.StopGame); } } }
public void RoundFinished_SinglePlayer(RoundEnd roundEnd) { DebugP("RoundFinished"); gameDesk.logList.isLastFrameIsDeath = (roundEnd == RoundEnd.killedByMonster) ? true : false; if (roundEnd == RoundEnd.killedByMonster) { this.LostGame(); } // Let the player to simulate the positions of objects if (form.cbRecord.Checked) { // we need to stop game after finishing task if (roundEnd == RoundEnd.taskFinished) { finishedGame(); } form.ShowLoggingWindow(true, true); } else { if (roundEnd == RoundEnd.taskFinished) { this.model.calendar.IsEnabledAddingEvents = false; gameDesk.RegisterScene(new Scene_EndOfRound(150, gameDesk), this.RunNextRound); } } }
/// <summary> /// The method is called when round is finished and is true one of these conditions: /// 1] Sokoban got all boxes at their places. /// 2] Sokoban was killed by a monster. /// </summary> public void RoundFinished(RoundEnd roundEnd) { if (form.gameType == GameType.SinglePlayer) { RoundFinished_SinglePlayer(roundEnd); } else if (form.gameType == GameType.TwoPlayers) { RoundFinished_TwoPlayers(roundEnd); } }
private void HandleCurrentEvents() { foreach (BaseEvent baseEvent in currentTick.Events) { switch (baseEvent.Type) { case EventType.MatchStarted: MatchStarted?.Invoke(this, baseEvent); break; case EventType.RoundAnnounceMatchStarted: break; case EventType.RoundStart: RoundStart?.Invoke(this, (RoundStartEvent)baseEvent); break; case EventType.RoundEnd: RoundEnd?.Invoke(this, (RoundEndEvent)baseEvent); break; case EventType.WinPanelMatch: WinPanelMatch?.Invoke(this, baseEvent); break; case EventType.RoundFinal: break; case EventType.LastRoundHalf: break; case EventType.RoundOfficiallyEnd: RoundOfficiallyEnd?.Invoke(this, baseEvent); break; case EventType.RoundMVP: RoundMVP?.Invoke(this, (RoundMVPEvent)baseEvent); break; case EventType.FreezetimeEnded: FreezetimeEnded?.Invoke(this, baseEvent); break; case EventType.PlayerKilled: PlayerKilled?.Invoke(this, (PlayerKilledEvent)baseEvent); break; case EventType.PlayerTeam: PlayerTeam?.Invoke(this, (PlayerTeamEvent)baseEvent); break; case EventType.WeaponFired: WeaponFired?.Invoke(this, (WeaponFiredEvent)baseEvent); break; case EventType.SmokeNadeStarted: SmokeNadeStarted?.Invoke(this, (SmokeNadeStartedEvent)baseEvent); break; case EventType.SmokeNadeEnded: SmokeNadeEnded?.Invoke(this, (SmokeNadeEndedEvent)baseEvent); break; case EventType.DecoyNadeStarted: DecoyNadeStarted?.Invoke(this, (DecoyNadeStartedEvent)baseEvent); break; case EventType.DecoyNadeEnded: DecoyNadeEnded?.Invoke(this, (DecoyNadeEndedEvent)baseEvent); break; case EventType.FireNadeStarted: FireNadeStarted?.Invoke(this, (FireNadeStartedEvent)baseEvent); break; case EventType.FireNadeWithOwnerStarted: FireNadeWithOwnerStarted?.Invoke(this, (FireNadeWithOwnerStartedEvent)baseEvent); break; case EventType.FireNadeEnded: FireNadeEnded?.Invoke(this, (FireNadeEndedEvent)baseEvent); break; case EventType.FlashNadeExploded: FlashNadeExploded?.Invoke(this, (FlashNadeExplodedEvent)baseEvent); break; case EventType.ExplosiveNadeExploded: ExplosiveNadeExploded?.Invoke(this, (ExplosiveNadeExplodedEvent)baseEvent); break; case EventType.NadeReachedTarget: NadeReachedTarget?.Invoke(this, (NadeReachedTargetEvent)baseEvent); break; case EventType.BombBeginPlant: BombBeginPlant?.Invoke(this, (BombBeginPlantEvent)baseEvent); break; case EventType.BombAbortPlant: BombAbortPlant?.Invoke(this, (BombAbortPlantEvent)baseEvent); break; case EventType.BombPlanted: BombPlanted?.Invoke(this, (BombPlantedEvent)baseEvent); break; case EventType.BombDefused: BombDefused?.Invoke(this, (BombDefusedEvent)baseEvent); break; case EventType.BombExploded: BombExploded?.Invoke(this, (BombExplodedEvent)baseEvent); break; case EventType.BombBeginDefuse: BombBeginDefuse?.Invoke(this, (BombBeginDefuseEvent)baseEvent); break; case EventType.BombAbortDefuse: BombAbortDefuse?.Invoke(this, (BombAbortDefuseEvent)baseEvent); break; case EventType.PlayerHurt: PlayerHurt?.Invoke(this, (PlayerHurtEvent)baseEvent); break; case EventType.Blind: Blind?.Invoke(this, (BlindEvent)baseEvent); break; case EventType.PlayerBind: PlayerBind?.Invoke(this, (PlayerBindEvent)baseEvent); break; case EventType.PlayerDisconnect: PlayerDisconnect?.Invoke(this, (PlayerDisconnectEvent)baseEvent); break; case EventType.SayText: SayText?.Invoke(this, (SayTextEvent)baseEvent); break; case EventType.SayText2: SayText2?.Invoke(this, (SayText2Event)baseEvent); break; case EventType.PlayerJump: PlayerJump?.Invoke(this, (PlayerJumpEvent)baseEvent); break; case EventType.PlayerFootstep: PlayerFootstep?.Invoke(this, (PlayerFootstepEvent)baseEvent); break; case EventType.OtherDeath: OtherDeath?.Invoke(this, (OtherDeathEvent)baseEvent); break; case EventType.EntitySpawned: EntitySpawned?.Invoke(this, (EntitySpawnedEvent)baseEvent); break; case EventType.EntityRemoved: EntityRemoved?.Invoke(this, (EntityRemovedEvent)baseEvent); break; default: break; } } }
void Update() { Debug.Log("begining of update: play once =" + playOnce); if (playerNum == PlayerNum.Player1) { score = ScoreManager.RedScore; if (RoundEnd.Player2Win) { return; } } else if (playerNum == PlayerNum.Player2) { score = ScoreManager.BlueScore; if (RoundEnd.Player1Win) { return; } } // This huge chunk of code controls the emission of the landing particle system, // basically it only emits once the player lands after being airborne // USES THE LANDING PARTICLE SYSTEM Debug.Log("right before first if: play once =" + playOnce); //cont'd if (controller.collisions.below && playOnce) { landing.Emit(3); playOnce = false; } //cont'd Debug.Log("right after first if: play once =" + playOnce); if (controller.collisions.below != true) { playOnce = true; } Debug.Log("right after second if: play once =" + playOnce); //cont'd Debug.Log(playOnce); roundOver = RoundEnd.roundOver; arrowPivot.position = transform.position; if (ifMovedOnce == true) { arrowPivot.gameObject.SetActive(true); } else { arrowPivot.gameObject.SetActive(false); } Vector2 input = new Vector2(Input.GetAxisRaw(horizontalMove), Input.GetAxisRaw(verticalMove)); float targetVelocityX = input.x * currentSpeed; velocity.x = Mathf.SmoothDamp(velocity.x, targetVelocityX, ref velocityXSmoothing, (controller.collisions.below) ? accelerationTimeGrounded : accelerationTimeAirborne); //Debug.Log(velocity.x); anim.SetFloat("Speed", Mathf.Abs(velocity.x)); HandleSpriteDirection(); // if (roundOver){ // return; //} if (dashDuration > 0) { dashDuration -= Time.deltaTime; if (dashDuration < 0) { dashDuration = 0; } } //currentSpeed = Mathf.Lerp(currentSpeed, moveSpeed, 0.2f); int wallDirX = (controller.collisions.left) ? -1 : 1; //increase drag force // Code used to emit the moving particle system based on input on the // horizontal axis. Probably not going to be used since it doesn't work intended // USES THE MOVING PARTICLE SYSTEM if (Input.GetAxisRaw(horizontalMove) != 0) { if (controller.collisions.below) { moving.Emit(1); } } bool wallSliding = false; ////////////////////////////////////// float angle = Mathf.Atan2(Input.GetAxis(rightHorizontal), Input.GetAxis(rightVertical)) * Mathf.Rad2Deg; if (Input.GetAxis(rightHorizontal) != 0f || Input.GetAxis(rightVertical) != 0f) { arrowPivot.gameObject.SetActive(true); arrowPivot.rotation = Quaternion.Euler(new Vector3(0, 0, angle)); lastAngle = angle; } else { arrowPivot.rotation = Quaternion.Euler(new Vector3(0, 0, lastAngle)); } Debug.Log("last angle is:" + lastAngle); //Debug.Log(angle + "right horizontal: " + Input.GetAxis(rightHorizontal)); /////////////////////////////////////// //if(controller.collisions.below) //{ // anim.SetBool("Ground", true); //} //else { // anim.SetBool("Ground", false); //} if (anim.GetBool("Ground") != controller.collisions.below) { anim.SetBool("Ground", (controller.collisions.below)); //anim.SetTrigger("Jump"); } if ((controller.collisions.left || controller.collisions.right) && !controller.collisions.below) { wallSliding = true; if (velocity.y < -wallSlideSpeedMax) { velocity.y = -wallSlideSpeedMax; } if (timeToWallUnstick > 0) { velocityXSmoothing = 0; velocity.x = 0; if (input.x != wallDirX && input.x != 0) { timeToWallUnstick -= Time.deltaTime; } else { timeToWallUnstick = wallStickTime; } } else { timeToWallUnstick = wallStickTime; } } else { wallSliding = false; } if (anim.GetBool("WallSliding") != wallSliding) { anim.SetBool("WallSliding", wallSliding); } // Emits puffs of smoke based on the opponents score, the higher the number the more // puffs of smoke come out of the player ////// <summary> /// TELEPORTERS /// </summary> /// <returns><c>true</c>, if available was teleportered, <c>false</c> otherwise.</returns> // CheckTeleporter(); if (Input.GetButtonDown(teleport)) { Debug.Log("Trying to teleport"); if (teleporterAvailable() && teleporter == null) { int teleporterTimerIndex = 9999; for (int i = 0; i < teleporterTimers.Length; i++) { if (teleporterTimers[i] <= 0) { teleporterTimerIndex = i; break; } } teleporterTimers[teleporterTimerIndex] = teleporterCoolDownDuration; //make it only able to teleport when it has stoppped moving Vector3 MouseCords = Camera.main.ScreenToWorldPoint(Input.mousePosition); // Vector3 TeleporterRotation = new Vector3(MouseCords.x, MouseCords.y, 0f); Vector2 DirectionToMouse = MouseCords - transform.position; Vector2 dashDir = new Vector2(-1 * (Input.GetAxis(rightHorizontal)), Input.GetAxis(rightVertical)).normalized; DirectionToMouse.Normalize(); // float angleToMouse = Mathf.Rad2Deg * Mathf.Atan2(DirectionToMouse.y, DirectionToMouse.x) - 90; teleporter = Instantiate(TeleporterPrefab); //Physics2D.IgnoreCollision(teleporter.GetComponent<CircleCollider2D>(), playerCollider); for (int i = 0; i < playerColliders.Count; i++) { Physics2D.IgnoreCollision(teleporter.GetComponent <CircleCollider2D>(), playerColliders[i]); } teleporter.transform.position = new Vector3(transform.position.x, transform.position.y, 0); teleporter.transform.eulerAngles = new Vector3(0, 0, angle); teleporter.GetComponent <Rigidbody2D>().velocity = dashDir * TeleporterSpeed;; teleporterBurst.Emit(100); //isTeleporter = true; } else { if (teleporterAvailable() == false && teleporter == null) { source.PlayOneShot(empty, 0.15f); } if (teleporter != null) { source.PlayOneShot(Teleport, 0.5f); // Emits an after-image from the player's previous location, creating an 'omae wa mou' vibe // USES THE APPROPRIATE DASH FOR THE PLAYER teleportFade.Emit(fugma); transform.position = teleporter.transform.position; //teleporterBurst.Emit(100); // use it by teleporting Destroy(teleporter); teleporter = null; } } } //////////////////////////Teleporters ///////////////////////////// //////score handling////// for (int i = 0; i < scoreNums.Length; i++) { if (i == score) { scoreNums[i].gameObject.SetActive(true); } else { scoreNums[i].gameObject.SetActive(false); } } /////////////////////// Jumping //////////////////// if (Input.GetButtonDown(jump)) { if (wallSliding) { if (wallDirX == input.x) { velocity.x = -wallDirX * wallJumpClimb.x; velocity.y = wallJumpClimb.y; source.PlayOneShot(Jump, 0.5f); } else if (input.x == 0) { velocity.x = -wallDirX * wallJumpHop.x; velocity.y = wallJumpHop.y; source.PlayOneShot(Jump, 0.5f); } else { velocity.x = -wallDirX * wallJumpLeap.x; velocity.y = wallJumpLeap.y; source.PlayOneShot(Jump, 0.5f); } } if (controller.collisions.below) { velocity.y = maxJumpVelocity; source.PlayOneShot(Jump, 0.5f); } } if (Input.GetButtonUp(jump)) { if (velocity.y > minJumpVelocity) { velocity.y = minJumpVelocity; } } //emitting smoke for damage smoke.Emit(damage); ////////////////////////////////////////////// Jumping ////////////////////////// velocity.y += gravity * Time.deltaTime; dashDir = new Vector2(-1 * (Input.GetAxis(rightHorizontal)), Input.GetAxis(rightVertical)).normalized; if (isAiming() == true) { lastDashDir = dashDir; } if (ifMovedOnce == true) { CheckDash(); } if (dashDuration > 0) { Vector3 lineToDestination = destination - transform.position; lineToDestination.Normalize(); velocity = lineToDestination * dashSpeed; //WHAT CONTROLS THE DOPE ASS EFFECT ON THE DASH, IMPORTANT THAT YOU USE SUGMA FOR THIS dashParticles.Emit(sugma); // raycast check for damage (im gonna say the N-word) RaycastHit2D hit = Physics2D.Raycast(transform.position, lineToDestination.normalized, 2, enemyMask); Debug.DrawRay(transform.position, lineToDestination.normalized, Color.red); if (hit.collider != null) { Debug.Log("hit: " + hit.collider.gameObject.name + ", tag: " + hit.collider.gameObject.tag + ", this player's enemy is: " + enemy); if (hit.collider.gameObject.tag == enemy) { isDashing = true; var emitParams = new ParticleSystem.EmitParams(); emitParams.position = hit.collider.gameObject.transform.position; bolt.Emit(Random.Range(8, 12)); smoke.Emit(Random.Range(8, 9)); spark.Emit(Random.Range(11, 13)); source.PlayOneShot(Death, 1f); RoundEnd.EndRound(color); } } } controller.Move(velocity * Time.deltaTime, input); if (controller.collisions.above || controller.collisions.below) { velocity.y = 0; } ///Hit Pause Section if (hitPauseNow == true) { hitPauseTimer -= Time.deltaTime; if (hitPauseTimer <= 0) { DashNow(); } } Debug.Log("end of update: play once =" + playOnce); }
public void sendEndRoundData(int tScore, int ctScore, bool raundWin, RoundEnd why) { photonView.RPC(nameof(receiveEndRound), RpcTarget.Others, new byte[] { (byte)tScore, (byte)ctScore, (byte)(raundWin ? 1 : 0), (byte)(why == RoundEnd.Defused? 1 : 0) }); Debug.Log("Send New Round"); }