public override void AgentAction(float[] vectorAction, string textAction)
    {
        var num    = Mathf.FloorToInt(vectorAction[0]);
        var player = num / numOfActions;
        var action = (AllMoves)(num % numOfActions);

        var move = new MoveTransaction()
        {
            player = player, action = action, team = Team
        };

        FootballMatch.ScheduleTransaction(move);
    }
Exemple #2
0
    void ProcessMoves()
    {
        for (int i = 0; i < moveTransactions.Count; i++)
        {
            MoveTransaction move = moveTransactions[i];

            // @TODO: know if its a player, which color it is, and the obj
            blackPlayers[move.index] = new Player(move.endPos);

            move.obj.transform.position = Pos2DTo3D(move.endPos);
        }

        moveTransactions.Clear();
    }
Exemple #3
0
    public void ScheduleTransaction(MoveTransaction moveTransaction)
    {
        if (moveTransaction.team == Team.Blue)
        {
            bluePlayerMove = moveTransaction;
        }
        else
        {
            redPlayerMove = moveTransaction;
        }

        if (bluePlayerMove != null && redPlayerMove != null)
        {
            ExecuteMoves();
            bluePlayerMove = null;
            redPlayerMove  = null;
        }
    }
Exemple #4
0
    void CreateMoveTransactions(List <Player> players, List <GameObject> playerObjs, ActionType action)
    {
        Vector2 dir = ActionTypeToDirection(action);

        Debug.Log(dir);

        for (int i = 0; i < players.Count; i++)
        {
            Player p = players[i];

            MoveTransaction move = new MoveTransaction();

            move.index    = i;
            move.obj      = playerObjs[i];
            move.startPos = p.pos;
            move.endPos   = p.pos + dir;

            moveTransactions.Add(move);
        }

        // @TODO: create moves for pieces of both colors, and invalidate certain moves
        // What happens when you push against a structure that has a part that doesnt move?
        // Does nothing move, or do we allow the players to become separated? Could be interesting!
    }