public void StartCharacterBuild(Action <FightingGameCharacter> fgCharCallback = null)
            {
                foreach (KeyValuePair <int, ICharacterBuilder> charBuilder in selectedFGChars)
                {
                    int playerId = charBuilder.Key;
                    FightingGameCharacter builtFGChar = buildService.Build(charBuilder.Value);

                    fgChars.Add(playerId, builtFGChar);

                    HumanInputController humanInputController = inputService.GetInputController(playerId);
                    if (humanInputController != null)
                    {
                        humanInputController.ConnectToCharacter(builtFGChar);
                    }

                    fgCharCallback?.Invoke(builtFGChar);
                }

                foreach (KeyValuePair <int, FightingGameCharacter> curr in fgChars)
                {
                    List <FightingGameCharacter> othersList = new List <FightingGameCharacter>();
                    foreach (KeyValuePair <int, FightingGameCharacter> other in fgChars)
                    {
                        if (curr.Value != other.Value)
                        {
                            othersList.Add(other.Value);
                        }
                    }
                    otherChars.Add(curr.Key, othersList);
                }
            }
Example #2
0
            public void SetUpControllers()
            {
                for (int n = 0; n < playerService.GetMaxPlayers(); ++n)
                {
                    if (persistenceService.GetControllerIndex(n) >= 0)
                    {
                        HumanInputController humanInput = GameObject.Instantiate <HumanInputController>(prefab, inputs.transform);
                        humanInput.SetControllerId(n);

                        controllers.Add(n, humanInput);
                    }
                }
            }