public void PositionSelectorClone() { tlog.Debug(tag, $"PositionSelectorClone START"); var testingTarget = new PositionSelector() { All = new Position(100, 200), }; Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <PositionSelector>(testingTarget, "Should return PositionSelector instance."); try { var result = testingTarget.Clone(); tlog.Debug(tag, "result : " + result); } catch (Exception) { // System.InvalidCastException : Unable to cast object // of type 'Tizen.NUI.BaseComponents.Selector`1[Tizen.NUI.Position]' // to type 'Tizen.NUI.Components.PositionSelector' // To fix tlog.Debug(tag, $"PositionSelectorClone END (OK)"); Assert.Pass("Passed!"); } }
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 DWFrame() { players = new PlayerData[] { new PlayerData(), new PlayerData(), new PlayerData(), new PlayerData() }; disks = new DiskData[] { new DiskData(), new DiskData(), new DiskData(), new DiskData() }; playerQuadrants = new PositionSelector(); diskQuadrants = new PositionSelector(); scores = new int[] { 0, 0, 0, 0 }; }
/// <summary> /// The four of four in the chain of methods to return a frame /// for a given set of game conditions. This narrows the focus down by /// the set of positions where players are. /// </summary> /// <param name="positions">The positions of players, order doesn't matter</param> /// <returns>The frame corresponding to the situation described. /// It can be used to query for more specific information like player positions, /// disk positions, and gives access to the frames following it and the /// frames preceding it.</returns> public LinkedList<DWFrame> PlayerPositions(params Vector2[] positions) { currentPlayerPositions = positions; if (!knowledgeTree.ContainsKey(currentMap)) return new LinkedList<DWFrame>(); if (!knowledgeTree[currentMap].ContainsKey(currentPlayersAlive)) return new LinkedList<DWFrame>(); if(!knowledgeTree[currentMap][currentPlayersAlive].ContainsKey(currentDiskPositions)) return new LinkedList<DWFrame>(); if (!knowledgeTree[currentMap][currentPlayersAlive][currentDiskPositions].ContainsKey(currentPlayerPositions)) return new LinkedList<DWFrame>(); return knowledgeTree[currentMap][currentPlayersAlive] [currentDiskPositions][currentPlayerPositions]; }
/// <summary> /// The third of four in the chain of methods to return a list of frames /// for a given set of game conditions. This narrows the focus down by /// the set of positions where disks are. /// </summary> /// <param name="positions">The positions of disks, order doesn't matter</param> /// <returns>Ugly Dictionary. You don't to use this alone.</returns> public KnowledgeParser DiskPositions(params Vector2[] positions) { currentDiskPositions = positions; return this; }