public void Start() { if (instance == null) { instance = this; } }
public void UnSubscribeDirectionEventHandlers() { ds = DirectionSelector.instance; ds.UpButton.onClick.RemoveAllListeners(); ds.DownButton.onClick.RemoveAllListeners(); ds.LeftButton.onClick.RemoveAllListeners(); ds.RightButton.onClick.RemoveAllListeners(); ds.UpLeftButton.onClick.RemoveAllListeners(); ds.UpRightButton.onClick.RemoveAllListeners(); ds.DownLeftButton.onClick.RemoveAllListeners(); ds.DownRightButton.onClick.RemoveAllListeners(); }
public void SubscribeDirectionEventHandlers() { ds = DirectionSelector.instance; ds.UpButton.onClick.AddListener(delegate { ChooseDirection(MovementDirection.UP); }); ds.DownButton.onClick.AddListener(delegate { ChooseDirection(MovementDirection.DOWN); }); ds.LeftButton.onClick.AddListener(delegate { ChooseDirection(MovementDirection.LEFT); }); ds.RightButton.onClick.AddListener(delegate { ChooseDirection(MovementDirection.RIGHT); }); ds.UpLeftButton.onClick.AddListener(delegate { ChooseDirection(MovementDirection.UPLEFT); }); ds.UpRightButton.onClick.AddListener(delegate { ChooseDirection(MovementDirection.UPRIGHT); }); ds.DownLeftButton.onClick.AddListener(delegate { ChooseDirection(MovementDirection.DOWNLEFT); }); ds.DownRightButton.onClick.AddListener(delegate { ChooseDirection(MovementDirection.DOWNRIGHT); }); }
public Player Init(Vector2 startingPosition, int index) { Debug.Log("Player.Init"); _startingPosition = startingPosition; Index = index; GameObject positionSelectorObject = GameObject.Find("P" + Index + "PositionSelector"); PositionSelector = positionSelectorObject.GetComponent <PositionSelector>(); DirectionLabel = GameObject.Find("P" + Index + "DirectionLabel"); GameObject directionSelectorObject = GameObject.Find("P" + Index + "DirectionSelector"); DirectionSelector = directionSelectorObject.GetComponent <DirectionSelector>(); GameObject distanceSelectorObject = GameObject.Find("P" + Index + "DistanceSelector"); DistanceSelector = distanceSelectorObject.GetComponent <DistanceSelector>(); return(this); }
public SelectWaitDirectionState(Actor currActor) { this.currActor = currActor; newDirection = currActor.actorData.directionFacing; directionArrow = Globals.GetBoardManager().ui.dirSelector; }