Added final features for this release. Now only polishing (if needed) remains.
Features: Sacrifice-Node, Maintain-Node, Options for screen type, lightcolor and soundvolume, tied in sound effects, game pause when menu is open, visibly open up gate when opening it.
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
using Godot;
|
||||
|
||||
public class SacrificeNode : ProgramNode
|
||||
{
|
||||
public SacrificeNode()
|
||||
{
|
||||
DisplayText = "Sacrifice";
|
||||
}
|
||||
|
||||
public override NodeResult Execute(Robot robot, double delta)
|
||||
{
|
||||
Vector3I mapIndex = Pathfinding.GetClosestStartPoint(robot.Position);
|
||||
Tile tile = GameData.map[mapIndex.Y].tiles[mapIndex.X, mapIndex.Z];
|
||||
|
||||
if (!tile.containsResource || tile.resource == null)
|
||||
{
|
||||
lastExecutionMessage = "No resource on this tile";
|
||||
return NodeResult.FAILURE;
|
||||
}
|
||||
|
||||
if (tile.resource.IsEndless())
|
||||
{
|
||||
lastExecutionMessage = "Resource is already endless";
|
||||
return NodeResult.FAILURE;
|
||||
}
|
||||
|
||||
tile.resource.MakeEndless();
|
||||
GameData.robots.Remove(robot);
|
||||
robot.QueueFree();
|
||||
lastExecutionMessage = "";
|
||||
return NodeResult.SUCCESS;
|
||||
}
|
||||
|
||||
public override void ReadParameters(NodeDisplay display)
|
||||
{
|
||||
}
|
||||
|
||||
public override ProgramNode Duplicate()
|
||||
{
|
||||
SacrificeNode duplicate = new SacrificeNode();
|
||||
return duplicate;
|
||||
}
|
||||
|
||||
public override void Setup(NodeDisplay display)
|
||||
{
|
||||
}
|
||||
|
||||
public override string Save()
|
||||
{
|
||||
return $"Name: {DisplayText}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user