public InControlPlayerInputSource(PlayerConfig config) { this.config = config; TapDetector = new TapInputDetector(); // TODO(james7132): Make this configurable controllerMapping = new PlayerControllerMapping(); }
protected override void Preinitialize(PlayerConfig config, GameObject view) { var viewTransform = view.transform as RectTransform; if (viewTransform == null) { return; } viewTransform.SetParent(Container, false); }
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> >()); }
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); }
public UnityPlayerInputSource(PlayerConfig config) { _config = config; }
protected virtual void Postinitalize(PlayerConfig config, GameObject view) { }
public Task Initialize(PlayerConfig config, bool isView = false) { Config = config; return(Task.CompletedTask); }