void CheckForPlayers() { List <Player> toJunk = new List <Player>(); foreach (Player p in killablePlayers) { if (!p.Dizzy()) { toJunk.Add(p); } else { RPS_Result result = RPSX.determineWinner(MyState, p.currentState); if (result != RPS_Result.Win) { toJunk.Add(p); } } } if (toJunk.Count != 0) { for (int i = 0; i < toJunk.Count; i++) { Player p = toJunk[i]; killablePlayers.Remove(p); } } for (int i = 0; i < PlayerManager.numberOfPlayers; i++) { Player p = PlayerManager.players[i]; if (p.Dizzy()) { RPS_Result result = RPSX.determineWinner(MyState, p.currentState); if (result == RPS_Result.Win) { killablePlayers.Add(p); } } } foreach (Player p in players) { RPS_Result result = RPSX.determineWinner(MyState, p.currentState); if (result == RPS_Result.Win) { if (p.Dizzy() && canKill()) { p.KillCharacter(bright); } } } }
public virtual void hitPlayer(Player player) { if (!player.Invincible()) { float effectiveKB = baseKnockback; RPS_Result result = RPSX.determineWinner(myState, player.currentState); float knockbackX = (baseKnockbackAngle.x + (stickInputX * KBInfluenceX)) * directionMod; float knockbackY = baseKnockbackAngle.y + (stickInputY * KBInfluenceY); Vector2 effectiveKBA = new Vector2(knockbackX, knockbackY); AudioClip clipToPlay = null; switch (result) { case RPS_Result.Tie: effectiveKB = baseKnockback; clipToPlay = normalHitSound; break; case RPS_Result.Win: effectiveKB = baseKnockback * winKnockbackGrownth; clipToPlay = superHitSound; if (PlayerManager.dizzyTotals[player.playerNum - 1] - dizzyDamage <= 0 && !player.Dizzy()) { SoundManager sm = GameObject.Find("Manager").GetComponent <SoundManager>(); player.impactAudio.PlayOneShot(sm.KOSound); player.loopingAudio.clip = sm.DizzySound; player.loopingAudio.Play(); } PlayerManager.TakeDizzy(dizzyDamage, player.playerNum); break; } if (result != RPS_Result.Loss) { player.TakeHit(effectiveKBA, effectiveKB, result); player.impactAudio.PlayOneShot(clipToPlay); } else { GameObject parrySpark = Instantiate(Resources.Load("Prefabs/ParrySpark")) as GameObject; parrySpark.transform.position = player.gameObject.transform.position; parrySpark.GetComponent <SpriteRenderer>().color = RPSX.StateColor(player.currentState); if (!player.Dizzy()) { player.Parry(effectiveKBA); PlayerManager.RecoverDizzy(dizzyDamage, player.playerNum); } owner.Stagger(effectiveKBA * -1, baseKnockback * 0.5f); } } }
void ArrowPoint() { RPS_Result result = RPSX.determineWinner(players[0].currentState, players[1].currentState); if (result == RPS_Result.Win) { arrow.transform.localScale = new Vector3(1, arrow.transform.localScale.y, arrow.transform.localScale.z); arrow.color = lerpingColors[0]; } else if (result == RPS_Result.Loss) { arrow.transform.localScale = new Vector3(-1, arrow.transform.localScale.y, arrow.transform.localScale.z); arrow.color = lerpingColors[1]; } else { arrow.color = Color.clear; } }
void FindPlayers() { RPS_Result result = RPSX.determineWinner(PlayerManager.players[0].currentState, PlayerManager.players[1].currentState); if (result == RPS_Result.Win) { owner = PlayerManager.players[0].transform; opponent = PlayerManager.players[1].transform; sr.color = RPSX.StateColor(PlayerManager.players[0].currentState); } else if (result == RPS_Result.Loss) { owner = PlayerManager.players[1].transform; opponent = PlayerManager.players[0].transform; sr.color = RPSX.StateColor(PlayerManager.players[1].currentState); } else { owner = GreenRoom; } }
void KeepTrackOfStates(int playerNum) { Player player = players[playerNum]; Player opponent = null; RPS_Result result = RPS_Result.Tie; Image emblem = emblemDisplays[playerNum]; Image stateTimer = stateTimers[playerNum]; Image stateBG = StateBG[playerNum]; Image portrait = portraits[playerNum]; Image heart = hearts[playerNum]; Image dizzyMeter = dizzyMeters[playerNum]; if (playerNum == 0) { if (numberOfPlayers > 1) { opponent = players[1]; } } else { opponent = players[0]; } result = RPSX.determineWinner(player.currentState, opponent.currentState); if (player.currentState == RPS_State.Rock) { emblem.sprite = emblems[1]; normal[playerNum] = RPSX.rockColor; bright[playerNum] = Color.blue; dark[playerNum] = RPSX.rockColorDark; faded[playerNum] = RPSX.rockColorFaded; } else if (player.currentState == RPS_State.Paper) { emblem.sprite = emblems[2]; normal[playerNum] = RPSX.paperColor; bright[playerNum] = Color.green; dark[playerNum] = RPSX.paperColorDark; faded[playerNum] = RPSX.paperColorFaded; } else if (player.currentState == RPS_State.Scissors) { emblem.sprite = emblems[3]; normal[playerNum] = RPSX.scissorsColor; bright[playerNum] = Color.red; dark[playerNum] = RPSX.scissorsColorDark; faded[playerNum] = RPSX.scissorsColorFaded; } else { emblem.sprite = emblems[0]; normal[playerNum] = Color.white; bright[playerNum] = Color.white; dark[playerNum] = Color.white; faded[playerNum] = Color.white; } lerpingColors[playerNum] = Color.Lerp(bright[playerNum], dark[playerNum], Mathf.PingPong(Time.time * UIFlashSpeed, 1)); if (result == RPS_Result.Win) { emblem.color = lerpingColors[playerNum]; stateTimer.color = lerpingColors[playerNum]; } else { emblem.color = bright[playerNum]; stateTimer.color = bright[playerNum]; } stateBG.color = faded[playerNum]; portraitBG[playerNum].color = faded[playerNum]; stateTimer.color = bright[playerNum]; portrait.color = normal[playerNum]; heart.color = normal[playerNum]; dizzyMeter.color = bright[playerNum]; healthDisplays[playerNum].text = PlayerManager.healthTotals[playerNum].ToString(); float currentFillAmount = PlayerManager.maxStateTime - player.timeInState; stateTimer.fillAmount = RPSX.fillAmount(currentFillAmount, PlayerManager.maxStateTime); if (players[playerNum].Dizzy()) { dizzyMeters[playerNum].fillAmount = PlayerManager.dizzyTimers[playerNum] / PlayerManager.maxDizzyTime; } else { dizzyMeters[playerNum].fillAmount = RPSX.fillAmount(PlayerManager.dizzyTotals[playerNum], players[playerNum].maxDizzyHits); } if (player.Dizzy()) { faces[playerNum].index = 2; } else if (player.hit) { faces[playerNum].index = 1; } else { faces[playerNum].index = 0; } if (PlayerManager.dizzyTotals[playerNum] > 6) { screenCracks[playerNum].index = 0; } else if (PlayerManager.dizzyTotals[playerNum] <= 6 && PlayerManager.dizzyTotals[playerNum] > 4) { screenCracks[playerNum].index = 1; } else if (PlayerManager.dizzyTotals[playerNum] <= 4 && PlayerManager.dizzyTotals[playerNum] > 2) { screenCracks[playerNum].index = 2; } else if (PlayerManager.dizzyTotals[playerNum] <= 2 && PlayerManager.dizzyTotals[playerNum] > 0) { screenCracks[playerNum].index = 3; } else { screenCracks[playerNum].index = 4; } }