Beispiel #1
0
    // AI movement options
    void approach()
    {
        var rand = new System.Random();

        //If ai is not crouching, back dashing, or combo-ing, move in direction of player
        if (faceLeft)
        {
            MaxInput.MoveLeft("Player2");
            if (noMoveTimer <= 0 && difficulty <= 50)
            {
                holdMovement(.6f, -1);
            }
        }
        else
        {
            MaxInput.MoveRight("Player2");
            if (noMoveTimer <= 0 && difficulty <= 50)
            {
                holdMovement(.6f, 1);
            }
        }

        //Foward Dash
        if (rand.NextDouble() * distanceBetweenX * 100 >= 160)
        {
            if (faceLeft)
            {
                MaxInput.MoveLeft("Player2");
                MaxInput.LStick("Player2");
                if (noMoveTimer <= 0 && difficulty <= 50)
                {
                    holdMovement(.6f, -1);
                }
            }
            else
            {
                MaxInput.MoveRight("Player2");
                MaxInput.LStick("Player2");
                if (noMoveTimer <= 0 && difficulty <= 50)
                {
                    holdMovement(.6f, 1);
                }
            }
        }
    }
Beispiel #2
0
    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");
        }
    }