Exemplo n.º 1
0
 public InControlPlayerInputSource(PlayerConfig config)
 {
     this.config = config;
     TapDetector = new TapInputDetector();
     // TODO(james7132): Make this configurable
     controllerMapping = new PlayerControllerMapping();
 }
Exemplo n.º 2
0
        protected override void Preinitialize(PlayerConfig config, GameObject view)
        {
            var viewTransform = view.transform as RectTransform;

            if (viewTransform == null)
            {
                return;
            }
            viewTransform.SetParent(Container, false);
        }
Exemplo n.º 3
0
        public override async Task <IStateView <T>[]> CreateViews(PlayerConfig config)
        {
            var view = Instantiate(Prefab);

            view.name = $"{Prefab.name} ({config.PlayerID + 1})";
            Preinitialize(config, view);
            await view.Initialize(config);

            Postinitalize(config, view);
            return(view.GetComponentsInChildren <IStateView <T> >());
        }
Exemplo n.º 4
0
        IInputSource <PlayerInput> BuildPlayerInputSource(ref PlayerConfig config)
        {
            IInputSource <PlayerInput> inputSource = (T)Activator.CreateInstance(typeof(T), config);

            // Only override for player 1
            if (config.LocalPlayerID == 0)
            {
                inputSource = new KeyboardOverridePlayerInputSource(inputSource);
            }
            inputSource = new TapPlayerInputSource(inputSource);
            return(inputSource);
        }
Exemplo n.º 5
0
 public UnityPlayerInputSource(PlayerConfig config)
 {
     _config = config;
 }
Exemplo n.º 6
0
 protected virtual void Postinitalize(PlayerConfig config, GameObject view)
 {
 }
 public Task Initialize(PlayerConfig config, bool isView = false)
 {
     Config = config;
     return(Task.CompletedTask);
 }