Progress Report 1

16/09/2023

Began using the HInput Unity Asset as a controller input manager
Unity_X6ImPKvXuZ.gif|500

Controller Patterns

One of the main parts of the game is the use of the right joystick to dictate your move instead of pressing buttons like traditional fighting games
The way I achieve this is simple:

I map an array of 3x3 points on the controller joystick
Each point is called an index
I when the controller is not closest to index 4 (the centre position), I record each unique index in a long string

0  1  2
3  4  5
6  7  8

Since the controllers joysticks are circular, not square, the spacing looks a little closer to this:

   0 1 2
  3  4  5
   6 7 8

This is how I calculate it from the controller raw data using HInput

public int GetPositionIndex(Vector2 pos)
{
    // take the pos and return the nearest index
    if (pos.x < -.5f)
    {
        if (pos.y < -.5f)
        {
            return 6;
        }
        else if (pos.y > .5f)
        {
            return 0;
        }
        else
        {
            return 3;
        }
    }
    else if (pos.x > .5f)
    {
        if (pos.y < -.5f)
        {
            return 8;
        }
        else if (pos.y > .5f)
        {
            return 2;
        }
        else
        {
            return 5;
        }
    }
    else
    {
        if (pos.y < -.5f)
        {
            return 7;
        }
        else if (pos.y > .5f)
        {
            return 1;
        }
        else
        {
            return 4;
        }
    }

}

There is probably a better way to do it but this works for now

Once the input is complete I go through each StickEvents class and try to find a matching index
If found, its respective event is called, making for an easy was to invoke methods through the inspector with the events