Tree chopping only possible with axe.
parent
b6b11228a5
commit
ce53cdba6a
|
@ -11,6 +11,8 @@ public class Player : Entity, IInteractionInterface {
|
|||
|
||||
public int WoodCount;
|
||||
public int GoldCount;
|
||||
public bool HasAxe = false;
|
||||
|
||||
public TaskQueueComponent TaskQueueComponent;
|
||||
public NavigationComponent NavigationComponent { get; private set; }
|
||||
public InteractionComponent InteractionComponent { get; set; }
|
||||
|
@ -178,8 +180,10 @@ public class Player : Entity, IInteractionInterface {
|
|||
Debug.Assert(_toolAttachement != null);
|
||||
if (toolName == "Axe") {
|
||||
_toolAttachement.Visible = true;
|
||||
HasAxe = true;
|
||||
} else if (toolName == "") {
|
||||
_toolAttachement.Visible = false;
|
||||
HasAxe = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,6 +196,12 @@ public class Player : Entity, IInteractionInterface {
|
|||
GD.Print("Player Opening Box");
|
||||
stateMachine.Travel("Interaction");
|
||||
} else if (InteractionComponent.TargetEntity is Tree) {
|
||||
if (!HasAxe) {
|
||||
GD.Print("Not chopping tree, player has no Axe!");
|
||||
InteractionComponent.EndInteraction();
|
||||
return;
|
||||
}
|
||||
|
||||
GD.Print("Player Chopping Tree");
|
||||
stateMachine.Travel("Hit");
|
||||
}
|
||||
|
|
|
@ -397,6 +397,9 @@ generate_lightmap = false
|
|||
[node name="PirateAsset" parent="Geometry" instance=ExtResource( 8 )]
|
||||
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0 )
|
||||
|
||||
[node name="Skeleton" parent="Geometry/PirateAsset/Armature" index="0"]
|
||||
bones/4/bound_children = [ NodePath("ToolAttachement") ]
|
||||
|
||||
[node name="ToolAttachement" type="BoneAttachment" parent="Geometry/PirateAsset/Armature/Skeleton" index="5"]
|
||||
transform = Transform( 1, 7.13626e-08, -4.47035e-08, 1.64262e-07, -1, -1.00583e-07, 1.19209e-07, 1.18278e-07, -1, -0.72, 0.45, 1.78362e-08 )
|
||||
visible = false
|
||||
|
|
|
@ -415,6 +415,9 @@ WorldNode = NodePath("../World")
|
|||
[node name="WorldInfo" parent="Player" index="2"]
|
||||
WorldPath = NodePath("../../World")
|
||||
|
||||
[node name="Skeleton" parent="Player/Geometry/PirateAsset/Armature" index="0"]
|
||||
bones/4/bound_children = [ ]
|
||||
|
||||
[node name="ToolAttachement" parent="Player/Geometry/PirateAsset/Armature/Skeleton" index="5"]
|
||||
transform = Transform( 1, 7.13626e-08, -4.47035e-08, 1.64262e-07, -1, -1.00583e-07, 1.19209e-07, 1.18278e-07, -1, -0.72, 0.45, 1.78362e-08 )
|
||||
|
||||
|
|
|
@ -763,7 +763,6 @@ public class World : Spatial {
|
|||
|
||||
EmitSignal("TileHovered", tile);
|
||||
HexTile3D.TileTypeInfo tileTypeInfo = GetTileTypeInfoAtOffset(tile.OffsetCoords);
|
||||
GD.Print("Hover on TileType " + tileTypeInfo.Name + " color: " + tileTypeInfo.Color);
|
||||
}
|
||||
|
||||
public void OnBlockingSpatialRemoved(Spatial spatialNode) {
|
||||
|
|
Loading…
Reference in New Issue