Skip to content

Commit

Permalink
Finished implementing unit transpostation in transport unit
Browse files Browse the repository at this point in the history
Used Waifu2x to upcale endgame screen.
  • Loading branch information
Kahdeg-15520487 committed Jan 29, 2018
1 parent c745416 commit d545dae
Show file tree
Hide file tree
Showing 12 changed files with 1,289 additions and 1,274 deletions.
Binary file modified Wartorn/Content/sprite/GUI/endgame/Background1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Wartorn/Content/sprite/GUI/endgame/Background2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Wartorn/Content/sprite/GUI/endgame/Background3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Wartorn/Content/sprite/GUI/endgame/Background4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Wartorn/Content/sprite/GUI/endgame/Background5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Wartorn/Content/sprite/GUI/endgame/Background6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Wartorn/Content/sprite/GUI/endgame/Background7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Wartorn/Content/sprite/GUI/endgame/Background8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Wartorn/Icon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion Wartorn/Screens/EditorScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ private bool isMapPlayable() {
if (map[p].terrain == TerrainType.HQ) {
sidehq[owner]++;
}
if (map[p].terrain.isBuildingThatProduceUnit()) {
if (map[p].terrain.IsBuildingThatProduceUnit()) {
sidebuildingthatcanproduceunit[owner]++;
}
}
Expand Down
60 changes: 52 additions & 8 deletions Wartorn/Screens/MainGameScreen/GameScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ enum GameState {
UnitCommand,
BuildingSelected,
BuildingBuildUnit,
CameraPan
}

class GameScreen : Screen {
Expand Down Expand Up @@ -970,6 +971,7 @@ public override void Update(GameTime gameTime) {

Unit tempunit = map[selectedUnit].unit;
Point selectedTarget;
Func<Point, bool> filter;

switch (selectedCmd) {
case Command.Wait:
Expand Down Expand Up @@ -1046,7 +1048,6 @@ public override void Update(GameTime gameTime) {

isDrawTargetRange = false;

Func<Point, bool> filter;
if (tempunit.UnitType == UnitType.APC || tempunit.UnitType == UnitType.TransportCopter) {
filter = (Point p) => (map[p].unit != null && map[p].unit.UnitType.IsInfantryUnit());
}
Expand All @@ -1068,7 +1069,13 @@ public override void Update(GameTime gameTime) {
//do load unit stuff
selectedTarget = selectedMapCell;

//reset action point for the unit
map[selectedTarget].unit.UpdateActionPoint(Command.None);

//move the unit into the carrier
tempunit.carryingUnit = map[selectedTarget].unit;

//remove the unit from the map
map.RemoveUnit(selectedTarget);

//end command
Expand All @@ -1077,12 +1084,49 @@ public override void Update(GameTime gameTime) {

break;

case Command.Drop:
//show load range like attack range
//select unit to load in
//if not select, return to previous command
//if selected a unit, move unit from mapcell into the carrier
//end command
case Command.Drop: {
//show load range like attack range
//load range include free mapcell north,south,west,east to the carrier
//select mapcell to drop out
//if not select, return to previous command
//if selected a unit, move unit from the carrier into the selected mapcell
//end command

isDrawTargetRange = false;

//create filter
//free mapcell north,south,west,east to the carrier
//the carried unit can stand on
if (tempunit.UnitType == UnitType.APC || tempunit.UnitType == UnitType.TransportCopter) {
filter = (Point p) => (map[p].unit == null && tempunit.UnitType.GetMovementType().IsTraversable(map[p].terrain));
}
else {
filter = (Point p) => (map[p].terrain == TerrainType.Coast || map[p].terrain == TerrainType.Harbor);
}

//filter unit that the carrier can take
attackRange = selectedUnit.GetNearbyPoints(Direction.North, Direction.East, Direction.South, Direction.West).Where(filter).ToList();

isDrawTargetRange = true;

if (HelperFunction.IsLeftMousePressed()
&& attackRange.Contains(selectedMapCell)
&& map[selectedMapCell].unit == null) {
tempunit.UpdateActionPoint(Command.Drop);

//do drop unit stuff
selectedTarget = selectedMapCell;

//add the unit into the map
map.RegisterUnit(selectedTarget, tempunit.carryingUnit);

//remove the unit from the carrier
tempunit.carryingUnit = null;

//end command
goto finalise_command_execution;
}
}
break;

case Command.Rise:
Expand Down Expand Up @@ -1599,7 +1643,7 @@ private bool SelectBuilding() {
return (
//check if the currently selected have
//a building that can produce unit
temp.terrain.isBuildingThatProduceUnit()
temp.terrain.IsBuildingThatProduceUnit()
//check if there is no unit currently standing on said building
&& temp.unit == null
//check if this building is belong tu the current player
Expand Down
Loading

0 comments on commit d545dae

Please sign in to comment.