IEnumerator FreezeFrame3D(Beyblade p1, Beyblade p2, Vector3 bounceBack) { ResetLight(); p1.GetComponent <ClashEventModule>().enabled = false; p2.GetComponent <ClashEventModule>().enabled = false; //Unfreeze physics p1.GetComponentInChildren <MovementControls>().enabled = true; p1.GetComponentInChildren <TiltControls>().enabled = true; p2.GetComponentInChildren <MovementControls>().enabled = true; p2.GetComponentInChildren <TiltControls>().enabled = true; //TODO: Hard Coded Value p1.BounceBack(p2, bounceBack, 200); //UnFocus Camera m_cam.ResetCameras(); //Disable Shield p1.GetComponent <ShieldController>().enabled = false; p2.GetComponent <ShieldController>().enabled = false; yield return(new WaitForSeconds(m_delayTransition)); //Enable Pieces p1.EnableBeybladePieces(); p2.EnableBeybladePieces(); //Enable Controls p1.EnablePlayerInfluence(); p2.EnablePlayerInfluence(); //Reset Collision p1.ResetCollision(); p2.ResetCollision(); }
public void FreezeGameState() { //Disable Pieces p1.DisableBeybladePieces(); p2.DisableBeybladePieces(); //Disable Controls p1.DisablePlayerInfluence(); p2.DisablePlayerInfluence(); //Set Velocity to 0 p1.GetComponentInChildren <Rigidbody>().velocity = Vector3.zero; p2.GetComponentInChildren <Rigidbody>().velocity = Vector3.zero; }
IEnumerator FreezeFrame2D(Beyblade attacker, Beyblade defender, int comboCount, float clashSpeed) { //Freeze physics attacker.GetComponentInChildren <MovementControls>().enabled = false; attacker.GetComponentInChildren <TiltControls>().enabled = false; defender.GetComponentInChildren <MovementControls>().enabled = false; defender.GetComponentInChildren <TiltControls>().enabled = false; Vector3 a_velo = attacker.GetComponentInChildren <Rigidbody>().velocity; Vector3 d_velo = defender.GetComponentInChildren <Rigidbody>().velocity; //Set Velocity to 0 attacker.GetComponentInChildren <Rigidbody>().velocity = Vector3.zero; defender.GetComponentInChildren <Rigidbody>().velocity = Vector3.zero; //Initialize m_cevent.SetPlayers(attacker.GetComponent <ClashEventModule>(), defender.GetComponent <ClashEventModule>()); attacker.GetComponent <ClashEventModule>().enabled = true; defender.GetComponent <ClashEventModule>().enabled = true; //Disable Pieces attacker.DisableBeybladePieces(); defender.DisableBeybladePieces(); //Focused Camera m_cam.FocusMyCam(attacker.gameObject); yield return(new WaitForSeconds(m_delayTransition / 2)); attacker.BounceBack(defender, a_velo - d_velo); yield return(new WaitForSeconds(m_delayTransition / 2)); //Set Velocity to 0 attacker.GetComponentInChildren <Rigidbody>().velocity = Vector3.zero; defender.GetComponentInChildren <Rigidbody>().velocity = Vector3.zero; //Unfreeze physics attacker.GetComponentInChildren <MovementControls>().enabled = true; attacker.GetComponentInChildren <TiltControls>().enabled = true; defender.GetComponentInChildren <MovementControls>().enabled = true; defender.GetComponentInChildren <TiltControls>().enabled = true; //Disable Controls attacker.DisablePlayerInfluence(); defender.DisablePlayerInfluence(); //Designate Combo Count m_cevent.SetMaxCombo(comboCount); //Enable Shield defender.GetComponent <ShieldController>().enabled = true; //Set the Clash Speed if (clashSpeed > 0f) { m_cevent.SetAttackDuration(clashSpeed); } //Start the event m_cevent.enabled = true; }