public void Shine() { GameObject parrySpark = Instantiate(Resources.Load("Prefabs/ParrySpark")) as GameObject; parrySpark.transform.position = transform.position; parrySpark.GetComponent <SpriteRenderer>().color = RPSX.StateColor(myState); }
public void Shine() { GameObject parrySpark = Instantiate(Resources.Load("Prefabs/ParrySpark")) as GameObject; parrySpark.transform.position = transform.position; parrySpark.GetComponent <SpriteRenderer>().color = RPSX.StateColor(myState); SoundManager sm = GameObject.Find("Manager").GetComponent <SoundManager>(); SoundManager.PlaySound(sm.CoinDink); }
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); } } } }
//RPS Controls public void ChangeRPSState(RPS_State rps) { currentState = rps; timeInState = 0; int frame = 0; if (rps == RPS_State.Scissors) { frame = 3; rpsColor = RPSX.scissorsColor; faded = RPSX.scissorsColorFaded; dark = RPSX.scissorsColorDark; } else if (rps == RPS_State.Rock) { frame = 1; rpsColor = RPSX.rockColor; faded = RPSX.rockColorFaded; dark = RPSX.rockColorDark; } else if (rps == RPS_State.Paper) { frame = 2; rpsColor = RPSX.paperColor; faded = RPSX.paperColorFaded; dark = RPSX.paperColorDark; } else { frame = 0; rpsColor = RPSX.basicColor; faded = RPSX.basicColorFaded; dark = RPSX.basicColorDark; } if (rps != RPS_State.Basic) { GameObject rpsEffect = Instantiate(Resources.Load("Prefabs/RPS_Effect")) as GameObject; rpsEffect.transform.position = transform.position; rpsEffect.GetComponent <SpriteRenderer>().color = RPSX.StateColor(rps); rpsEffect.GetComponent <RPSEffect>().state = rps; actionAudio.PlayOneShot(sounds.StateChangeSound); } foreach (SpriteMeshInstance mesh in meshes) { mesh.color = rpsColor; } sign.frame = frame; emblem.frame = frame; }
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); } } }
//Attack Controls void AttackControls() { if (Input.GetButtonDown("XButton_P" + playerNum) && !Dizzy()) { //Increments normals so that it goes into strong attack; normals++; //Reads stick input so we know direction. float stickInputX = Input.GetAxis("LeftStickX_P" + playerNum); float stickInputY = Input.GetAxis("LeftStickY_P" + playerNum); //Makes it so the player can switch directions while attacking. if (stickInputX > 0 && transform.localScale.x < 0 && !leaping) { transform.localScale = new Vector3(transform.localScale.x * -1, transform.localScale.y, transform.localScale.z); } if (stickInputX < 0 && transform.localScale.x > 0 && !leaping) { transform.localScale = new Vector3(transform.localScale.x * -1, transform.localScale.y, transform.localScale.z); } if (!grounded()) { rb.gravityScale = attackGrav; } string attackInput = RPSX.Input(stickInputX, stickInputY, grounded(), running, leaping, strong); Attack hitbox = GetComponent <AttackMoveset>().GetAttack(attackInput); hitbox.stickInputX = Mathf.Abs(stickInputX); hitbox.stickInputY = stickInputY * -1; hitbox.directionMod = directionMod; hitbox.myState = currentState; hitbox.playersHit.Clear(); hitbox.owner = this; hitbox.PlayInitSound(); //Sends info to the animator to tell it what attack animation to do. anim.SetTrigger(attackInput); if (leaping) { leaping = false; } } }
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; } }
//Functionality for bursts void Burst(RPS_State state) { IFrames = 0; PlayerManager.Undizzy(playerNum); loopingAudio.Stop(); if (Graced()) { PlayerManager.graceTimers[playerNum - 1] = PlayerManager.maxGraceFrames; } ChangeRPSState(state); burstComponent.myState = currentState; burstComponent.playersHit.Clear(); burstComponent.owner = this; GameObject parrySpark = Instantiate(Resources.Load("Prefabs/ParrySpark")) as GameObject; parrySpark.transform.position = transform.position; parrySpark.GetComponent <SpriteRenderer>().color = RPSX.StateColor(currentState); anim.SetTrigger("Burst"); actionAudio.PlayOneShot(sounds.BurstSound); }
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; } }
// Update is called once per frame void Update() { sr.color = RPSX.StateColor(myState); }
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; } }