//For moves-before-bording only public QueuedCommand(Ship s, Hex3D h, int offset) { agent = s; targetHex = h; order = Command.Action.Move; shiptype = null; priority = 50 + offset; }
public static Shield creator = new Shield(); //i realize this is silly, but i couldnt figure out a compile time way to pass classes as parameters #endregion Fields #region Methods public override Ship CreateShip() { this.modelstring = "Shield"; this.buildTime = 3; this.cost = 100; //stats dont matter since we never create this Ship newship = new Ship(this); return newship; }
public Boolean LoadShip(Ship s) { if (!s.hex.getNeighbors().Contains(this.hex) || s is Carrier || load >= capacity) { return false; } s.hex.RemoveObject(); payload.Add(s); load++; return true; }
//Will cange to Ship ship when we have the class. public void build(Ship ship) { if (buildQueue.Count >= 4) { Game1.soundEffectBox.PlaySound("BuildQueueFull"); return; } int cost = ship.getCost(); if (affiliation.payMetal(cost)) { buildQueue.Add(ship); buildTimes.Add(ship.getTime()); } }
public static ColonyShip creator = new ColonyShip(); //i realize this is silly, but i couldnt figure out a compile time way to pass classes as parameters #endregion Fields #region Methods public override Ship CreateShip() { this.modelstring = "ColonyShip"; this.speed = 2; this.range = 4; this.damage = 1; this.cost = 100; this.shield = 1; this.capacity = 0; this.cancolonize = true; Ship newship = new Ship(this); return newship; }
public override Ship CreateShip() { this.modelstring = "MiningShip"; this.speed = 4; this.range = 4; this.damage = 1; this.cost = 100; this.shield = 2; this.buildTime = 3; this.capacity = 0; this.miningRobots = 3; this.cancolonize = true; Ship newship = new Ship(this); return newship; }
public static Telescope creator = new Telescope(); //i realize this is silly, but i couldnt figure out a compile time way to pass classes as parameters #endregion Fields #region Methods public override Ship CreateShip() { this.modelstring = "Telescope"; this.speed = 6; this.range = 4; this.damage = 1; this.cost = 300; this.shield = 1; this.capacity = 0; this.buildTime = 2; //this.canjump = true; Ship newship = new Ship(this); return newship; }
public Boolean UnloadShip(Ship s) { if (!payload.Contains(s)) return false; Hex3D target = null; foreach (Hex3D h1 in this.hex.getNeighbors()) { if (h1.passable && h1.GetGameObject() == null) { target = h1; break; } } if (target != null) { s.hex = target; payload.Remove(s); load--; target.AddObject(s); return true; } return false; }
public void UpdateSolar() { selectedhex.color = selectedcolor; ((SolarSystem3D)space).sun.color = ((SolarSystem3D)space).sun.defaultcolor; ////////mouse stuff//////// if (oldmousehex != null && !oldmousehex.Equals(selectedhex)) oldmousehex.color = oldmousehex.defaultcolor; mousehex = ((SolarSystem3D)space).GetMouseOverHex(); if ((mousestate.LeftButton == ButtonState.Pressed) && (oldmousestate.LeftButton == ButtonState.Released) && !shipmenu.Contains(mousestate.X, mousestate.Y) && !planetmenu.Contains(mousestate.X, mousestate.Y) && !galaxybutton.Contains(mousestate.X, mousestate.Y) && mousehex != null) { //selecting a hex if (clickedaction == Command.Action.None) { selectedhex = mousehex; } //selecting a target of a action if (clickedaction != Command.Action.None && !waiting) { Console.WriteLine("a command"); if (selectedhex.GetGameObject() is Ship && clickedaction == Command.Action.Move) { if (!((Ship)(selectedhex.GetGameObject())).GetReachable().Contains(mousehex)) { return; } ((Ship)(selectedhex.GetGameObject())).SetGhost(mousehex); } if (selectedhex.GetGameObject() is Warship && clickedaction == Command.Action.Fire) { if (!((Warship)(selectedhex.GetGameObject())).GetShootable().Contains(mousehex)) { return; } //((Ship)(selectedhex.GetGameObject())).SetGhost(mousehex); } if (selectedhex.GetGameObject() is Warship && clickedaction == Command.Action.Colonize) { if (!((Warship)(selectedhex.GetGameObject())).GetReachable().Contains(mousehex)) { return; } //((Ship)(selectedhex.GetGameObject())).SetGhost(mousehex); } if (selectedhex.GetGameObject() is Ship && clickedaction == Command.Action.Jump) { if (!((SolarSystem3D)(space)).GetWarpable().Contains(mousehex)) {} else if (!selectedhex.GetGameObject().hex.hexgrid.neighbors.Contains((SolarSystem3D)(space))) {} else { ((Ship)(selectedhex.GetGameObject())).SetGhost(mousehex); } Boolean vis = true; int thresh = 0; foreach (Hex3D h1 in ((SolarSystem3D)space).getHexes()) { if (!h1.visible) { vis = false; break; } thresh ++; if (thresh >= 10) { break; } } if (!vis) { space = galaxy; Console.WriteLine("BUMP"); } } middleman.AddCommand(new Command(selectedhex, mousehex, clickedaction)); clickedaction = Command.Action.None; selectedhex = nullhex; } } /////stuff to do if a ship is selected///// GameObject selectedobject = selectedhex.GetGameObject(); if (selectedobject != null && selectedobject is Unit) { statusmenu.Update((Unit)selectedobject); statusmenu.Show(); } else { statusmenu.Hide(); } if (selectedhex.GetGameObject() is Ship && clickedaction == Command.Action.Jump) { foreach (Hex3D h in ((SolarSystem3D)space).GetWarpable()) { h.color = Color.Blue; } } if (selectedobject != null && selectedobject is Ship && ((Ship)selectedobject).getAffiliation().Equals(player)) { shipmenu.Show(); } else { shipmenu.Hide(); } if (selectedobject != null && selectedobject is Warship) { foreach (Hex3D h in ((Warship)selectedobject).GetShootable()) { h.color = Color.Red; } } if (selectedobject != null && selectedobject is Ship) { Ship tmpShip = (Ship)selectedobject; if (oldShip != null && oldShip != tmpShip) { tmpShip.shiptype.PlaySelectSound(); } oldShip = tmpShip; foreach (Hex3D h in ((Ship)selectedobject).GetReachable()) { h.color = movecolor; } } ////VERY REDUNDANT, handles cases where range is smaller than speed if (selectedobject != null && selectedobject is Warship && ((Warship)selectedobject).GetRange() < ((Warship)selectedobject).getSpeed()) { foreach (Hex3D h in ((Warship)selectedobject).GetShootable()) { h.color = Color.Red; } } //planetmenu if (selectedobject != null && selectedobject is Planet && ((Planet)selectedobject).getAffiliation() != null && ((Planet)selectedobject).getAffiliation().Equals(player)) { planetmenu.Show(); } else { planetmenu.Hide(); } //Color the mousedover hex if (mousehex != null && !mousehex.Equals(selectedhex) && !shipmenu.Contains(mousestate.X, mousestate.Y)) { mousehex.color = mousecolor; } telescopemenu.Hide(); }
public void HopOn(Ship c) { throw new NotImplementedException(); }