mercredi 6 septembre 2023

Architecture of the game when i have 2 different game modes

I have a game(bullet hell kind of game) already built where each attack has some out of many variables i.e speed, count, location, movementType. Now I want to add another mode a multiplayer mode.

In this mode there will be a UI scene where a player can cutomize his/her attack queue and send it to the opponent and the opponent will play against that _attackqueue.

The way I envisage the things is that the player will have many attacks to chose from and sliders to modify the value of the variables speed, count etc to increase or decrease the difficulty of the attacks.

Currently i have a scriptable object for each of the attribute speed, count etc. The attack script reads the value and then GameManager plays the level. Now I will have to modify the values in the Multiplayer Scene and when i go back to the game scene it should be set back to default as the moidifiable attacks are only available for multiplayer.

Moreover, I might even need to save the created queue with all the attacks and their modified values as it will be a pain for the player to create the customized queue again and again.

I need some advice as to how i can approach this problem. Sample Scriptable object code Sample Prefab

public class SpeedData : ScriptableObject
{
    public float defaultSpeed = 10f;
    public float multiplayerSpeed = 15f; 

    // Method to get the current speed based on the game mode
    public float GetCurrentSpeed(GameMode gameMode)
    {
        switch (gameMode)
        {
            case GameMode.Multiplayer:
                return multiplayerSpeed;
            default:
                return defaultSpeed;
        }
    }
}

I was thinking something on lines of this. _gameMode could be a static variable or a scriptableObject. I don't know, a bit confused. Need some advice. Thank you.

Aucun commentaire:

Enregistrer un commentaire