2023-06-10 17:14:55 -04:00
|
|
|
using Godot;
|
2023-06-11 12:54:09 -04:00
|
|
|
using System.Collections.Generic;
|
2023-06-10 17:14:55 -04:00
|
|
|
|
|
|
|
public partial class base_building : Node3D
|
|
|
|
{
|
|
|
|
[Export]
|
|
|
|
public Node3D BlocksNode { get; set; } = null;
|
2023-06-11 12:54:09 -04:00
|
|
|
private List<building_block> _blocks = null;
|
2023-06-10 17:14:55 -04:00
|
|
|
|
|
|
|
[Export]
|
|
|
|
public string DisplayName { get; set; } = "base_building";
|
|
|
|
[Export]
|
2023-06-10 18:36:39 -04:00
|
|
|
public int KashCost { get; set; } = 1;
|
2023-06-11 12:54:09 -04:00
|
|
|
public bool IsPlaced { get; set; } = false;
|
|
|
|
|
2023-06-10 17:14:55 -04:00
|
|
|
public bool IsPlaceable
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2023-06-11 12:54:09 -04:00
|
|
|
if (_blocks == null || _blocks.Count < 1)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
foreach (building_block block in _blocks)
|
|
|
|
if (!block.IsPlaceable)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
2023-06-10 17:14:55 -04:00
|
|
|
}
|
|
|
|
}
|
2023-06-11 12:54:09 -04:00
|
|
|
|
2023-06-10 17:14:55 -04:00
|
|
|
public override void _Ready()
|
|
|
|
{
|
|
|
|
if (BlocksNode != null)
|
|
|
|
{
|
2023-06-11 12:54:09 -04:00
|
|
|
_blocks = new List<building_block>();
|
|
|
|
foreach (Node child in BlocksNode.GetChildren())
|
|
|
|
{
|
|
|
|
_blocks.Add((building_block)child);
|
|
|
|
}
|
2023-06-10 17:14:55 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void _Process(double delta)
|
|
|
|
{
|
2023-06-11 12:54:09 -04:00
|
|
|
// if (!IsPlaced)
|
|
|
|
//{
|
|
|
|
//if (IsPlaceable)
|
|
|
|
//{
|
|
|
|
////show green highlight
|
|
|
|
//}
|
|
|
|
//else
|
|
|
|
//{
|
|
|
|
////show red highlight
|
|
|
|
//}
|
|
|
|
//}
|
2023-06-10 17:14:55 -04:00
|
|
|
}
|
|
|
|
}
|