public static PlayerConfigurationContainer getInstance()
 {
     if (_instance == null)
     {
         _instance = new PlayerConfigurationContainer();
     }
     return(_instance);
 }
Ejemplo n.º 2
0
    void Awake()
    {
        keyboardListenerPlayerOne = PlayerActions.CreateWithKeyboardBindingsForPlayerOne();
        keyboardListenerPlayerTwo = PlayerActions.CreateWithKeyboardBindingsForPlayerTwo();
        joystickListener          = PlayerActions.CreateWithJoystickBindings();

        var container = PlayerConfigurationContainer.getInstance();

        foreach (PlayerInputConfiguration config in container.Configurations)
        {
            CreatePlayer(config);
        }
    }
Ejemplo n.º 3
0
    void OnEnable()
    {
        container = PlayerConfigurationContainer.getInstance();
        players   = container.Configurations;
        players.Clear();

        InputManager.OnDeviceDetached += OnDeviceDetached;
        playerJoin = GetComponent <PlayerJoin> ();

        selectKeyboardListenerP1 = CharacterSelectActions.CreateWithKeyboardBindingsToSelectCharacter(Key.A, Key.D, Key.LeftShift);
        selectKeyboardListenerP2 = CharacterSelectActions.CreateWithKeyboardBindingsToSelectCharacter(Key.LeftArrow, Key.RightArrow, Key.RightShift);
        joinKeyboardListener     = CharacterSelectActions.CreateWithKeyboardBindingsToJoin();

        joystickListener = CharacterSelectActions.CreateWithJoystickBindings();

        keyboardP1 = PlayerActions.CreateWithKeyboardBindingsForPlayerOne();
        keyboardP2 = PlayerActions.CreateWithKeyboardBindingsForPlayerTwo();
    }
    void Start()
    {
        var container = PlayerConfigurationContainer.getInstance();

        Scores = new Dictionary <int, ScoreBarBehaviour> ();
        var count = container.Configurations.Count;

        foreach (var config in container.Configurations)
        {
            var instance = Instantiate(PlayerScorePrefabs[count - 2], this.transform.position, this.transform.rotation, this.transform);
            instance.transform.SetParent(this.transform);

            var image      = instance.GetComponent <Image>();
            var imageWidth = image.sprite.rect.width;
            instance.transform.position = new Vector3((Screen.width / count * (config.PlayerSuffix - 1)), 0, 1);

            var scoreBar = instance.GetComponent <ScoreBarBehaviour> ();
            scoreBar.PlayerColorIndex = config.PlayerColorIndex;
            scoreBar.PlayerSuffix     = config.PlayerSuffix;
            scoreBar.PlayerCount      = count;
            scoreBar.Score            = GetScore(scoreBar);
            Scores.Add(scoreBar.PlayerSuffix, scoreBar);
        }
    }
Ejemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     container          = PlayerConfigurationContainer.getInstance();
     anim               = GetComponent <Animator>();
     leftRightIndicator = this.transform.Find("ChangeIndicator").gameObject;
 }