public void Swing(SwingOrientation orientation, SwingPower power) { playerStatus = PlayerStatus.Swinging; GameObject ball = GameManager.Instance.ballSpawner.GetCurrentBall(); if (ball) { orientation = ball.transform.position.x >= transform.position.x ? SwingOrientation.Right : SwingOrientation.Left; } ChangeStrength(power); switch (orientation) { case SwingOrientation.Left: animator.SetBool("IsSwingingLeft", true); break; case SwingOrientation.Right: animator.SetBool("IsSwingingRight", true); break; default: throw new ArgumentOutOfRangeException("orientation", orientation, null); } if (PhotonNetwork.IsConnected) { photonView.RPC(nameof(PlaySwingEffect), RpcTarget.All); } else { PlaySwingEffect(); } }
private IEnumerator StartCharge() { chargedTime = 0; playerStatus = PlayerStatus.Charging; ReduceSpeed(SlowingType.Charge); // auraAnimator.gameObject.SetActive(true); // auraAnimator.SetBool("Charged", false); // Light Charge if (PhotonNetwork.IsConnected) { photonView.RPC(nameof(PlayAuraEffect), RpcTarget.All, "AuraBase"); } else { PlayAuraEffect("AuraBase"); } while (chargedTime <= swingType.lightSwingChargeTime && player.GetButton(RewiredConsts.Action.Charge) && playerStatus != PlayerStatus.Stunned) { //sprite.color = playerType.swingType.lightSwingColor; currentCharge = SwingPower.Light; chargedTime += Time.deltaTime; yield return(null); } // Strong Charge if (PhotonNetwork.IsConnected) { photonView.RPC(nameof(PlayAuraEffect), RpcTarget.All, "ChargedAura"); } else { PlayAuraEffect("ChargedAura"); } while (player.GetButton(RewiredConsts.Action.Charge) && playerStatus != PlayerStatus.Stunned) { //sprite.color = playerType.swingType.strongSwingColor; currentCharge = SwingPower.Strong; //auraAnimator.SetBool("Charged", true); yield return(null); } if (PhotonNetwork.IsConnected) { photonView.RPC(nameof(ReleaseCharge), RpcTarget.All); } else { ReleaseCharge(); } yield return(null); }
public void ReleaseCharge() { chargedTime = 0; playerStatus = PlayerStatus.None; currentCharge = SwingPower.Regular; if (aura && aura.childCount > 0) { foreach (Transform child in aura.transform) { Destroy(child.gameObject); } } // auraAnimator.SetBool("Charged", false); // auraAnimator.gameObject.SetActive(false); }
//Changes the strength of the next swing public void ChangeStrength(SwingPower newStrength) { switch (newStrength) { case SwingPower.Light: currentSwingStrength = swingType.lightSwing * arenaMultipliers.strength; break; case SwingPower.Regular: currentSwingStrength = swingType.regularSwing * arenaMultipliers.strength; break; case SwingPower.Strong: currentSwingStrength = swingType.strongSwing * arenaMultipliers.strength; break; default: currentSwingStrength = 0; break; } }