コード例 #1
0
ファイル: AIInput.cs プロジェクト: c13watts/BreakThrough
    // Quarter Circle Forward
    public void QCF()
    {
        // Step 1: Down movement
        if (AI.doingQCF == 1)
        {
            MaxInput.Crouch("Player2");
            AI.doingQCF   = 2;
            AI.delayTimer = .1f;
            AI.keepInput  = true;
        }
        // Step 2: Down Left/Right movement
        else if (AI.doingQCF == 2)
        {
            if (AI.faceLeft == true)
            {
                MaxInput.DownLeft("Player2");
            }
            else
            {
                MaxInput.DownRight("Player2");
            }
            AI.doingQCF   = 3;
            AI.delayTimer = .1f;
        }
        // Step 3: Left/Right movement
        else if (AI.doingQCF == 3)
        {
            MaxInput.DownMove("Player2");
            if (AI.faceLeft == true)
            {
                MaxInput.MoveLeft("Player2");
            }
            else
            {
                MaxInput.MoveRight("Player2");
            }
            AI.doingQCF   = 4;
            AI.delayTimer = .1f;
        }
        // Step 4: Pressing Attack button
        else if (AI.doingQCF == 4)
        {
            if (AI.keepAction == "Square")
            {
                MaxInput.Square("Player2");
            }
            if (AI.keepAction == "Triangle")
            {
                MaxInput.Triangle("Player2");
            }
            if (AI.keepAction == "Circle")
            {
                MaxInput.Circle("Player2");
            }
            if (AI.keepAction == "Cross")
            {
                MaxInput.Cross("Player2");
            }
            if (AI.keepAction == "RTrigger")
            {
                MaxInput.RTrigger("Player2");
            }
            if (AI.keepAction == "RBumper")
            {
                MaxInput.RBumper("Player2");
            }

            AI.doingQCF   = 0;
            AI.keepAction = "";
            AI.keepInput  = false;
        }
    }
コード例 #2
0
ファイル: PracticeMode.cs プロジェクト: c13watts/BreakThrough
    private void replay(string line)
    {
        float multiplier = 1;

        if (isFacingLeft() != faceLeft)
        {
            multiplier = -1;
        }

        string[] values = line.Split(' ');
        recordingFrame = Convert.ToInt32(values[0]);

        // Replaying movements
        MaxInput.setHorizontal("Player2", Convert.ToSingle(values[1]) * multiplier);
        MaxInput.setVertical("Player2", Convert.ToSingle(values[2]));

        // Replaying actions
        if (values[3] == "True")
        {
            MaxInput.Square("Player2");
        }
        if (values[4] == "True")
        {
            MaxInput.Triangle("Player2");
        }
        if (values[5] == "True")
        {
            MaxInput.Circle("Player2");
        }
        if (values[6] == "True")
        {
            MaxInput.Cross("Player2");
            hold = true;
        }
        else if (values[6] == "False" && values[7] == "True" && hold)
        {
            if (characterManager.P2Character == "Dhalia")
            {
                if (P2Input.attacking)
                {
                    MaxInput.Cross("Player2");
                }
                else
                {
                    hold = false;
                }
            }
            //else MaxInput.Cross("Player2");
        }

        if (values[8] == "True")
        {
            MaxInput.RBumper("Player2");
        }
        if (values[9] == "True")
        {
            MaxInput.RTrigger("Player2");
        }
        if (values[10] == "True")
        {
            MaxInput.LBumper("Player2");
        }
        if (values[11] == "True")
        {
            MaxInput.LTrigger("Player2");
        }
        if (values[12] == "True")
        {
            MaxInput.LStick("Player2");
        }
    }
コード例 #3
0
ファイル: AI.cs プロジェクト: c13watts/BreakThrough
    // AI attacking player, attacking has it's own internal state system
    void attack()
    {
        calculateAttackWeights();
        var rand = new System.Random().Next(101);                                        // Random int from 0 to 100

        var maxAttack = attackStates.Aggregate((l, r) => l.Value > r.Value ? l : r).Key; // Gets key with highest value

        Debug.Log(maxAttack);
        if (aiCharacter == "Dhalia")
        {
            // Attacks that hit low
            if (maxAttack == "Low")
            {
                // 5M
                if (rand <= 25 && triangleTimer <= 0)
                {
                    MaxInput.Triangle("Player2");
                    circleTimer = .5f;
                }
                else
                {
                    MaxInput.Crouch("Player2");

                    // 2L (doesn't actually hit low)
                    if (rand > 25 && rand <= 50 && squareTimer <= 0)
                    {
                        MaxInput.Square("Player2");
                        crossTimer = .5f;
                    }
                    // 2M
                    else if (rand > 50 && rand <= 70 && triangleTimer <= 0)
                    {
                        MaxInput.Triangle("Player2");
                        circleTimer = .5f;
                    }
                    // 2B
                    else if (rand > 70 && rand <= 85 && crossTimer <= 0)
                    {
                        MaxInput.Cross("Player2");
                        squareTimer = .5f;
                        if (noBreakTimer <= 0)
                        {
                            holdBreak(.8f);
                        }
                    }
                    // Head rush (63214M)
                    else if (rand > 85)
                    {
                        keepAction = "Triangle";
                        doingHCB   = 1;
                        AIInput.HCB();
                        if (noBreakTimer <= 0)
                        {
                            holdBreak(1.2f);
                        }
                    }
                    else
                    {
                        MaxInput.Square("Player2");
                    }
                }
            }

            // Attacks that hit mid
            if (maxAttack == "Mid")
            {
                // 5L
                if (rand <= 35 && squareTimer <= 0)
                {
                    doing5L_1 = 1;
                    AIInput.combo5L_1();
                    //MaxInput.Square("Player2");
                    crossTimer = .5f;
                }
                // 2H
                else if (rand > 35 && rand <= 60 && circleTimer <= 0)
                {
                    doing2H_1 = 1;
                    AIInput.combo2H_1();
                    triangleTimer = .5f;
                }
                // 5H
                else if (rand > 60 && rand <= 85 && circleTimer <= 0)
                {
                    MaxInput.Circle("Player2");
                    triangleTimer = .5f;
                }
                // 5B
                else if (rand > 85 && rand <= 98 && crossTimer <= 0)
                {
                    MaxInput.Cross("Player2");
                    squareTimer = .5f;
                    if (noBreakTimer <= 0)
                    {
                        holdBreak(.8f);
                    }
                }

                // Judgment Sabre
                else if (rand > 98 && !isAirborne)
                {
                    keepAction = "RBumper";
                    doingQCB   = 1;
                    AIInput.HCB();
                }
                else
                {
                    MaxInput.Square("Player2");
                }
            }

            if (maxAttack == "Overhead")
            {
                // 6B
                if (rand > 50)
                {
                    if (faceLeft == true)
                    {
                        MaxInput.MoveLeft("Player2");
                    }
                    else
                    {
                        MaxInput.MoveRight("Player2");
                    }
                    MaxInput.Cross("Player2");
                    if (noBreakTimer <= 0)
                    {
                        holdBreak(.8f);
                    }
                }
                // Blood brave (214H)
                else
                {
                    keepAction = "Circle";
                    doingQCB   = 1;
                    AIInput.QCB();
                }
            }

            // If very close to the player, attempt to grab
            if (maxAttack == "Grab")
            {
                MaxInput.LBumper("Player2");
            }

            // Attacking from a distance
            if (maxAttack == "Zone")
            {
                // Pastry Throw (236L)
                if (rand >= 1 && pastryTimer <= 0)
                {
                    keepAction = "Square";
                    doingQCF   = 1;
                    AIInput.QCF();
                    pastryTimer = 3f;
                }
                // Toaster (236HB)
                else if (rand < 1 && armor >= 2)
                {
                    keepAction = "RTrigger";
                    doingQCF   = 1;
                    AIInput.QCF();
                }
                // If a pastry is already out, just move forward
                else if (pastryTimer > 0)
                {
                    approach();
                }
            }
        }

        else if (aiCharacter == "Achealis")
        {
            // Attacks that hit low
            if (maxAttack == "Low")
            {
                MaxInput.Crouch("Player2");

                // 2L (doesn't actually hit low)
                if (rand <= 25 && squareTimer <= 0)
                {
                    MaxInput.Square("Player2");
                    crossTimer = .5f;
                }
                // 2M
                else if (rand > 25 && rand <= 50 && triangleTimer <= 0)
                {
                    MaxInput.Triangle("Player2");
                    circleTimer = .5f;
                }
                // 2H
                else if (rand > 50 && rand <= 75 && circleTimer <= 0)
                {
                    MaxInput.Circle("Player2");
                    triangleTimer = .5f;
                }
                // 2B
                else if (rand > 75 && rand <= 90 && crossTimer <= 0)
                {
                    MaxInput.Cross("Player2");
                    squareTimer = .5f;
                }
                // Level Hell (236M)
                else if (rand > 90)
                {
                    keepAction = "Triangle";
                    doingQCF   = 1;
                    AIInput.QCF();
                }
                else
                {
                    MaxInput.Square("Player2");
                }
            }

            // Attacks that hit mid
            if (maxAttack == "Mid")
            {
                // 5L
                if (rand <= 35 && squareTimer <= 0)
                {
                    doing5L_1 = 1;
                    AIInput.combo5L_1();
                    //MaxInput.Square("Player2");
                    crossTimer = .5f;
                }
                // 5M
                else if (rand > 35 && rand <= 70 && triangleTimer <= 0)
                {
                    MaxInput.Triangle("Player2");
                    circleTimer = .5f;
                }
                // 5H
                else if (rand > 70 && rand <= 90 && circleTimer <= 0)
                {
                    MaxInput.Circle("Player2");
                    triangleTimer = .5f;
                }
                // Heaven Climber (DP H/B)
                else if (rand > 90 && rand <= 95)
                {
                    doingDP = 1;
                    if (rand > 97)
                    {
                        keepAction = "Circle";
                    }
                    else
                    {
                        keepAction = "Cross";
                    }
                    AIInput.DP();
                }
                // Starfall (214B)
                else if (rand > 95 && isAirborne)
                {
                    keepAction = "Cross";
                    doingQCB   = 1;
                    AIInput.QCB();
                }
                else
                {
                    MaxInput.Square("Player2");
                }
            }

            if (maxAttack == "Overhead")
            {
                if (crossTimer <= 0)
                {
                    MaxInput.Cross("Player2");
                    squareTimer = .5f;
                }
            }

            // If very close to the player, attempt to grab
            if (maxAttack == "Grab")
            {
                MaxInput.LBumper("Player2");
            }

            // Attacking from a distance
            if (maxAttack == "Zone")
            {
                approach();
            }
        }
    }