// Activating a SubMap, either by clicking it or its paired Clickable in LeftPanel, will open that map's background public void ClickSubMap(SubMap submap) { bool foundMatch = false; foreach (GameObject mapobj in mapHolderList) { if (mapobj != null) { if (mapobj.transform.name == submap.transform.name) { submap.highlightObject.SetActive(false); UIController.Instance.leftUI.DestroyTerrainDataTileMap(); foundMatch = true; activeSubMap = submap; mapobj.SetActive(true); DisableGreaterMapView(); CameraController.Instance.SetWorldSectionView(); UIController.Instance.tabsSwitcher.toggleBottom1.isOn = true; UIController.Instance.RefreshUI(); foreach (Clickable clickable in mapClickablesList) { clickable.triggerSpriteObject.SetActive(false); } } } } if (foundMatch == false) { Debug.Log("Tried to open submap but did not find gameobject match: " + submap.transform.name); } }
public void TestConstructorMap() { Map <Object, Object> myMap = new LinkedHashMap <Object, Object>(); for (int counter = 0; counter < hmSize; counter++) { myMap.Put(objArray2[counter], objArray[counter]); } HashMap <Object, Object> hm2 = new HashMap <Object, Object>(myMap); for (int counter = 0; counter < hmSize; counter++) { Assert.IsTrue(hm.Get(objArray2[counter]) == hm2.Get(objArray2[counter]), "Assert.Failed to construct correct HashMap"); } try { Map <Object, Object> mockMap = new MockMap(); hm = new HashMap <Object, Object>(mockMap); Assert.Fail("Should throw NullReferenceException"); } catch (NullReferenceException) { //empty } HashMap <Object, Object> map = new HashMap <Object, Object>(); map.Put("a", "a"); SubMap <Object, Object> map2 = new SubMap <Object, Object>(map); Assert.IsTrue(map2.ContainsKey("a")); Assert.IsTrue(map2.ContainsValue("a")); }
private void Awake() { Instance = this; activeSubMap = initialSubMap; greaterMap.SetActive(false); LoadMapHoldersIntoList(); LoadSubMapsIntoList(); }
static void Main(string[] args) { Coords[] ShipCoords = new Coords[] { new Coords(100, 150), new Coords(120, 150), new Coords(140, 160), new Coords(160, 180) }; Map map = new Map(200, ShipCoords); MapBuilder bob = new MapBuilder(); SubMap subMap = bob.GenerateSubMap(map); //DISPLAY Console.Write(subMap.SideLength); Console.WriteLine(subMap.LowerLeftCoords); //DRAW BORDER for (int i = 0; i < subMap.SideLength; i++) { Console.Write('#'); //top } Console.CursorTop = subMap.SideLength - 1; Console.CursorLeft = 0; for (int i = 0; i < subMap.SideLength; i++) { Console.Write('#'); //Bootom } for (int i = 1; i < subMap.SideLength - 1; i++) //Left { Console.CursorLeft = 0; Console.CursorTop = i; Console.Write('#'); } for (int i = 1; i < subMap.SideLength - 1; i++) //Right { Console.CursorLeft = subMap.SideLength - 1; Console.CursorTop = i; Console.Write('#'); } foreach (Coords shipCoord in subMap.ShipCoord) { Console.CursorTop = subMap.SideLength - shipCoord.Y; Console.CursorLeft = shipCoord.X; Console.Write('A'); } Console.ReadLine(); }
/// <summary> /// Deserialize a ResultMap object /// </summary> /// <param name="node"></param> /// <param name="configScope"></param> /// <returns></returns> public static SubMap Deserialize(XmlNode node, ConfigurationScope configScope) { SubMap subMap = new SubMap(); NameValueCollection prop = NodeUtils.ParseAttributes(node, configScope.Properties); subMap.DiscriminatorValue = NodeUtils.GetStringAttribute(prop, "value"); subMap.ResultMapName = NodeUtils.GetStringAttribute(prop, "resultMapping"); return(subMap); }
public override bool BeginTransition(SubMap @from, SubMapBinder to, PlayedCharacter character) { if (!character.ChangeMap(MapNeighbour, cell => Cells == null || Cells.Length == 0 || Array.IndexOf(Cells, cell.CellId) != -1)) { logger.Error("Cannot proceed transition : cannot reach {0} map from {1} (submap:{2} to {3})", MapNeighbour, character.Map.Id, @from.GlobalId, to.GlobalId); return false; } return true; }
public override bool BeginTransition(SubMap @from, SubMapBinder to, PlayedCharacter character) { if (!character.ChangeMap(MapNeighbour, cell => Cells == null || Cells.Length == 0 || Array.IndexOf(Cells, cell.CellId) != -1)) { logger.Error("Cannot proceed transition : cannot reach {0} map from {1} (submap:{2} to {3})", MapNeighbour, character.Map.Id, @from.GlobalId, to.GlobalId); return(false); } return(true); }
// Called when switching to Greater in LeftPanel public void EnableGreaterMapView() { inGreaterMapView = true; greaterMap.SetActive(true); mapsHolder.SetActive(false); activeSubMap = null; foreach (GameObject mapobj in mapHolderList) { if (mapobj != null) { mapobj.SetActive(false); } } CameraController.Instance.SetWorldSectionView(); UIController.Instance.worldUI.ClosePanels(); UIController.Instance.RefreshUI(); }
public void DisableGreaterMapView() { if (inGreaterMapView == true) { inGreaterMapView = false; greaterMap.SetActive(false); mapsHolder.SetActive(true); UIController.Instance.RefreshUI(); if (activeSubMap == null) { activeSubMap = initialSubMap; } foreach (GameObject mapobj in mapHolderList) { if (mapobj != null) { if (mapobj.transform.name == activeSubMap.transform.name) { mapobj.SetActive(true); } } } } }
public virtual void OnTransitionEnded(SubMap from, SubMapBinder to, bool success) { TransitionEndedHandler evnt = TransitionEnded; if (evnt != null) evnt(this, from, to, success); }
public abstract bool BeginTransition(SubMap from, SubMapBinder to, PlayedCharacter character);
public SubMapEntrySet(SubMap source) { mSource = source; }
public SubMapKeySet(SubMap source) { mSource = source; }
protected override TurnActionInfo <Coordinate2D, Metric2D, int> OnTurn(SubMap <Coordinate2D, Metric2D, int> submap) { List <Fighter> lst = new List <Fighter>(); //foreach(Cell<Coordinate2D, Metric2D, int> c in submap.Cells) foreach (Fighter f in submap.Objects) { if (f == this) { continue; } if (back.CanSee(Location.X, Location.Y, f.Location.X, f.Location.Y, SightLength, Angle, SightAngle)) { lst.Add(f); } } //FighterControllerData move = controller.MakeTurn(this, lst, back.Eth[Team]); FighterControllerData move = controller.MakeTurn(this, lst, ether.Get <string[]>(Team.ToString())); TurnActionInfo <Coordinate2D, Metric2D, int> inf = new TurnActionInfo <Coordinate2D, Metric2D, int>(); if (Dead) { DeadCountDown--; if (DeadCountDown == 0) { Dead = false; inf.hasMoved = true; inf.moveTo = submap.ToLocal(new Coordinate2D(BirthLocation.X, BirthLocation.Y)); } } else { if (move.shot) { if (Mana >= ShotCost) { Mana -= ShotCost; for (int dx = -Radius; dx <= Radius; dx++) { for (int dy = -Radius; dy <= Radius; dy++) { if (back.Inside(move.shotPoint.X + dx, move.shotPoint.Y + dy)) { Cell <Coordinate2D, Metric2D, int> cl = submap.GetCell( submap.ToLocal(new Coordinate2D(move.shotPoint.X + dx, move.shotPoint.Y + dy))); foreach (Fighter f in cl) { f.HP -= move.damage; } } } } } } if (back.CanGo(Location.X, Location.Y, move.newLocation.X, move.newLocation.Y, Speed)) { inf.hasMoved = true; inf.moveTo = submap.ToLocal(new Coordinate2D(move.newLocation.X, move.newLocation.Y)); } else { inf.hasMoved = false; } Angle = move.newAngle; LastEth = move.msg; } return(inf); }