Пример #1
0
 void Start()
 {
     playerInfluence = true;
     player          = GetComponent <Beyblade>();
     this.ChargeUltimateBar(0);
     //m_ultimateCollider = GetComponentInChildren<UltimateCollider>();
 }
Пример #2
0
    float ComputeCollisionResult(BeybladePiece thisPiece, BeybladePiece otherPiece)
    {
        Beyblade otherBey = otherPiece.m_parent;

        return(GetAttackMultiplier() * thisPiece.m_attack + GetDefenseMultiplier() * thisPiece.m_defense
               - (otherPiece.m_attack * otherBey.GetAttackMultiplier() + otherPiece.m_defense * otherBey.GetDefenseMultiplier()));
    }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     playerInfluence = true;
     rb     = GetComponent <Rigidbody>();
     ground = GetComponent <GroundCheck>();
     b      = GetComponent <Beyblade>();
 }
Пример #4
0
    // Initiate 2D Mode
    public void Initiate2D(Beyblade attacker, Beyblade defender, int comboCount, float clashSpeed = 0f)
    {
        if (!m_gameMode)
        {
            StartCoroutine(FreezeFrame2D(attacker, defender, comboCount, clashSpeed));
            m_gameMode = !m_gameMode;

            player1Canvas.worldCamera = m_cam.getMyCamera(attacker.gameObject);
            player2Canvas.worldCamera = m_cam.getMyCamera(attacker.gameObject);
        }
    }
Пример #5
0
    void BounceBack(Beyblade other, float collisionResult)
    {
        Vector3 collisionDir = (GetComponent <Rigidbody>().velocity - other.GetComponent <Rigidbody>().velocity).normalized;

        //TODO: FIX HARDCODED MINIMUM
        Vector3 bounceBack = m_mc.m_maxSpeed * Utilities.sigmoid(collisionResult, 4) * collisionDir;

        if (bounceBack.magnitude < 60)
        {
            bounceBack = 60 * collisionDir;
        }
        GetComponent <Rigidbody>().velocity       = -1 * bounceBack;
        other.GetComponent <Rigidbody>().velocity = bounceBack;
    }
Пример #6
0
    IEnumerator ActivateUltimate()
    {
        player.m_gameSystem.FreezeGameState();
        player.m_gameSystem.NoLight();
        yield return(new WaitForSeconds(m_animationTime));

        Beyblade otherPlayer = player.m_gameSystem.p1 == player ? player.m_gameSystem.p2 : player.m_gameSystem.p1;

        //Enable Ultimate collider
        otherPlayer.EnableBeybladePieces();
        m_ultimateCollider.gameObject.SetActive(true);

        //Let collision handle the rest
        LeanTween.move(gameObject, otherPlayer.gameObject.transform, 0.5f).setEase(LeanTweenType.easeInQuad).setDelay(1f);
    }
Пример #7
0
        public static void PostAttack(object sender, PostAttackEventArgs args)
        {
            if (Extension.BeybladeMode.Active)
            {
                Beyblade.OnPostAttack();
            }

            switch (Global.Orbwalker.Mode)
            {
            case OrbwalkingMode.Combo:
                Combo.OnPostAttack();
                break;

            case OrbwalkingMode.Laneclear:
                LaneClear.OnPostAttack();
                JungleClear.OnPostAttack();
                break;
            }
        }
Пример #8
0
 public void Initiate3D(Beyblade p1, Beyblade p2, Vector3 bounceBack)
 {
     if (m_gameMode)
     {
         //Enable Controls
         StartCoroutine(FreezeFrame3D(p1, p2, bounceBack));
         m_gameMode = !m_gameMode;
         Camera cam1 = m_cam.getMyCamera(p1.gameObject);
         Camera cam2 = m_cam.getMyCamera(p2.gameObject);
         if (cam1 == m_cam.m_leftCam)
         {
             player1Canvas.worldCamera = cam1;
             player2Canvas.worldCamera = cam2;
         }
         else
         {
             player1Canvas.worldCamera = cam2;
             player2Canvas.worldCamera = cam1;
         }
     }
 }
Пример #9
0
    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();
    }
Пример #10
0
 public void BounceBack(Beyblade other, Vector3 dir, float magnitude = 60)
 {
     dir = dir.normalized * magnitude;
     GetComponent <Rigidbody>().velocity       = -1 * dir;
     other.GetComponent <Rigidbody>().velocity = dir;
 }
Пример #11
0
 bool ClashEventDecision(Beyblade other, float collisionResult)
 {
     return((collisionResult >= m_ceventDamageThreshold ||
             GetComponent <Rigidbody>().velocity.magnitude + other.GetComponent <Rigidbody>().velocity.magnitude >= m_ceventVelocityThreshold) &&
            collisionResult > 0f);
 }
Пример #12
0
    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;
    }