diff --git a/Game.gd b/Game.gd deleted file mode 100644 index 8a949c9..0000000 --- a/Game.gd +++ /dev/null @@ -1,32 +0,0 @@ -extends Node2D - - -onready var SimpleEntity = preload("res://entities/SimpleEntity.tscn") -onready var WanderingEntity = preload("res://entities/WanderingEntity.tscn") -onready var player_movable_target_label = $UI/PlayerMovableTarget -onready var player = $PlayerEntity -onready var entities = $Entities - -signal world_location_clicked - -# Called when the node enters the scene tree for the first time. -func _ready(): - pass - - -func _process(delta): - player_movable_target_label.text = str(player.movable_component.target) - - -func _on_AddEntityButton_pressed(): - var entity_instance = SimpleEntity.instance() - var viewport_rect = get_viewport_rect() - entity_instance.transform.origin = Vector2(randf() * viewport_rect.size[0], randf() * viewport_rect.size[1]) - entities.add_child(entity_instance) - -func _on_AddWanderingEntity_pressed(): - var entity_instance = WanderingEntity.instance() - var viewport_rect = get_viewport_rect() - entity_instance.transform.origin = Vector2(randf() * viewport_rect.size[0], randf() * viewport_rect.size[1]) - entities.add_child(entity_instance) - entity_instance.set_target(Vector2(randf() * viewport_rect.size[0], randf() * viewport_rect.size[1])) diff --git a/Game.tscn b/Game.tscn deleted file mode 100644 index bf64dd0..0000000 --- a/Game.tscn +++ /dev/null @@ -1,131 +0,0 @@ -[gd_scene load_steps=10 format=2] - -[ext_resource path="res://entities/SimpleEntity.tscn" type="PackedScene" id=1] -[ext_resource path="res://entities/PlayerEntity.tscn" type="PackedScene" id=2] -[ext_resource path="res://assets/white.png" type="Texture" id=3] -[ext_resource path="res://materials/PhysicsObjects.tres" type="Material" id=4] -[ext_resource path="res://utils/CollisionLine.gd" type="Script" id=5] -[ext_resource path="res://Game.gd" type="Script" id=6] - -[sub_resource type="RectangleShape2D" id=1] -extents = Vector2( 57.5347, 51.5794 ) - -[sub_resource type="RectangleShape2D" id=2] - -[sub_resource type="SegmentShape2D" id=3] -a = Vector2( 37, 302 ) -b = Vector2( 34, 570 ) - -[node name="Game" type="Node2D"] -script = ExtResource( 6 ) - -[node name="Control" type="HBoxContainer" parent="."] -margin_left = 30.0 -margin_top = 30.0 -margin_right = 40.0 -margin_bottom = 40.0 - -[node name="AddEntityButton" type="Button" parent="Control"] -margin_right = 77.0 -margin_bottom = 20.0 -text = "Add Entity" -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="AddWanderingEntity" type="Button" parent="Control"] -margin_left = 81.0 -margin_right = 190.0 -margin_bottom = 20.0 -text = "Add Wandering" -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Entities" type="Node2D" parent="."] - -[node name="SimpleEntity" parent="Entities" instance=ExtResource( 1 )] -position = Vector2( 360, 118 ) - -[node name="SimpleEntity2" parent="Entities" instance=ExtResource( 1 )] -position = Vector2( 157, 306 ) - -[node name="PlayerEntity" parent="." instance=ExtResource( 2 )] - -[node name="World" type="Node2D" parent="."] - -[node name="Wall" type="KinematicBody2D" parent="World"] -position = Vector2( 582, 817 ) -scale = Vector2( 7.56, 1 ) -__meta__ = { -"_edit_group_": true -} - -[node name="Sprite" type="Sprite" parent="World/Wall"] -material = ExtResource( 4 ) -position = Vector2( 0.965286, 0.579379 ) -scale = Vector2( 115, 104 ) -texture = ExtResource( 3 ) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="World/Wall"] -position = Vector2( 0.465286, 0.57938 ) -z_as_relative = false -shape = SubResource( 1 ) - -[node name="RigidBody2D" type="RigidBody2D" parent="World"] -position = Vector2( 649, 227 ) -__meta__ = { -"_edit_group_": true -} - -[node name="CollisionShape2D" type="CollisionShape2D" parent="World/RigidBody2D"] -rotation = -0.432491 -scale = Vector2( 11.5039, 4.3795 ) -shape = SubResource( 2 ) - -[node name="Sprite" type="Sprite" parent="World/RigidBody2D/CollisionShape2D"] -material = ExtResource( 4 ) -use_parent_material = true -scale = Vector2( 20.002, 19.4893 ) -texture = ExtResource( 3 ) - -[node name="Wall2" type="KinematicBody2D" parent="World"] -position = Vector2( 896, 386 ) -scale = Vector2( 7.56, 1 ) -__meta__ = { -"_edit_group_": true -} - -[node name="Sprite" type="Sprite" parent="World/Wall2"] -material = ExtResource( 4 ) -position = Vector2( 0.965286, 0.579379 ) -scale = Vector2( 115, 104 ) -texture = ExtResource( 3 ) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="World/Wall2"] -position = Vector2( 0.465286, 0.57938 ) -z_as_relative = false -shape = SubResource( 1 ) - -[node name="CollisionLine" type="KinematicBody2D" parent="World"] -position = Vector2( 221, 205 ) -script = ExtResource( 5 ) - -[node name="CollisionShape2D" type="CollisionShape2D" parent="World/CollisionLine"] -shape = SubResource( 3 ) - -[node name="UI" type="CanvasLayer" parent="."] - -[node name="PlayerMovableTarget" type="Label" parent="UI"] -margin_right = 40.0 -margin_bottom = 14.0 -text = "Blaaa" -__meta__ = { -"_edit_use_anchors_": false -} - -[connection signal="pressed" from="Control/AddEntityButton" to="." method="_on_AddEntityButton_pressed"] -[connection signal="pressed" from="Control/AddWanderingEntity" to="." method="_on_AddWanderingEntity_pressed"] - -[editable path="Entities/SimpleEntity"] -[editable path="Entities/SimpleEntity2"] diff --git a/Globals.cs b/Globals.cs index 68a5670..72c9641 100644 --- a/Globals.cs +++ b/Globals.cs @@ -1,5 +1,9 @@ +using System; + public static class Globals { public const float EpsPosition = 0.01f; - public const float EpsPositionSquared = 0.01f * 0.01f; + public const float EpsPositionSquared = EpsPosition * EpsPosition; + public const float EpsRadians = 0.1f * Godot.Mathf.Pi / 180f; + public const float EpsRadiansSquared = EpsRadians * EpsRadians; } \ No newline at end of file diff --git a/GodotComponentTest.csproj b/GodotComponentTest.csproj index 845d179..4dba522 100644 --- a/GodotComponentTest.csproj +++ b/GodotComponentTest.csproj @@ -13,4 +13,8 @@ + + + + diff --git a/components/Component.cs b/components/Component.cs new file mode 100644 index 0000000..ab720c2 --- /dev/null +++ b/components/Component.cs @@ -0,0 +1,6 @@ +using Godot; + +public class Component : Node +{ + +} \ No newline at end of file diff --git a/components/GroundMotionComponent.cs b/components/GroundMotionComponent.cs index cf3e78a..c7594b8 100644 --- a/components/GroundMotionComponent.cs +++ b/components/GroundMotionComponent.cs @@ -6,12 +6,14 @@ using Vector3 = Godot.Vector3; /// /// -public class GroundMotionComponent +public class GroundMotionComponent : Component { public float Accel = 50; public float Damping = 0.2f; public float MaxSpeed = 8; + public float RotationSpeedRadPerSecond = 270 * Mathf.Pi / 180; + private void CalcPlaneVelocity(float delta, Entity entity, Vector3 targetPosition) { @@ -19,13 +21,14 @@ public class GroundMotionComponent targetPosition.z - entity.GlobalTranslation.z); float targetDistance = planeTargetVector.Length(); Vector2 planeTargetDirection = planeTargetVector / targetDistance; + Vector2 planeOrientation = new Vector2(entity.GlobalTransform.basis.z[0], entity.GlobalTransform.basis.z[2]); Vector2 planeVelocity = new Vector2(entity.Velocity.x, entity.Velocity.z); // GD.Print("-- Step: distance: " + targetDistance + " dir: " + planeTargetDirection + " speed: " + planeVelocity.Length() + " vel dir: " + planeVelocity.Normalized()); planeVelocity -= planeVelocity * Damping; // GD.Print(" damp : speed: " + planeVelocity.Length() + " vel dir: " + planeVelocity.Normalized()); - if (targetDistance < 0.01) + if (targetDistance < 0.01 || planeOrientation.Dot(planeTargetDirection) < 0.9) { planeVelocity = Vector2.Zero; } else { @@ -79,15 +82,46 @@ public class GroundMotionComponent } - public void PhysicsProcess(float delta, Entity entity, Vector3 targetPosition, TileWorld tileWorld) + public void PhysicsProcess(float delta, Entity entity, Vector3 targetPosition, Quat targetOrientation, TileWorld tileWorld) { + CalcAndApplyOrientation(delta, entity, targetPosition, targetOrientation); CalcPlaneVelocity(delta, entity, targetPosition); - CalcVerticalVelocity(delta, entity, tileWorld); - Vector3 prePhysicsVelocity = entity.Velocity; entity.Velocity = entity.MoveAndSlide(entity.Velocity); + //GD.Print("Pre : speed: " + prePhysicsVelocity.Length() + " Velocity: " + prePhysicsVelocity); //GD.Print("Post: speed: " + entity.Velocity.Length() + " Velocity: " + entity.Velocity); } + + private void CalcAndApplyOrientation(float delta, Entity entity, Vector3 targetPosition, Quat targetOrientation) + { + Vector3 direction_to_target = targetPosition - entity.GlobalTranslation; + + if (direction_to_target.LengthSquared() > Globals.EpsPositionSquared) + { + direction_to_target = direction_to_target.Normalized(); + Vector3 localXAxis = Vector3.Up.Cross(direction_to_target); + targetOrientation = new Basis(localXAxis, Vector3.Up, direction_to_target).Quat().Normalized(); + } + + float orientationErrorRadians = entity.GlobalTransform.basis.Quat().AngleTo(targetOrientation); + if (orientationErrorRadians > 0) + { + Transform entityTransform = entity.Transform; + if (orientationErrorRadians < RotationSpeedRadPerSecond * delta) + { + entityTransform.basis = new Basis(targetOrientation); + } + else if (orientationErrorRadians > 0f) + { + Quat entityRotation = new Quat(entityTransform.basis); + float slerpWeight = RotationSpeedRadPerSecond / (orientationErrorRadians / delta); + entityRotation = entityRotation.Slerp(targetOrientation, slerpWeight); + entityTransform.basis = new Basis(entityRotation); + } + + entity.Transform = entityTransform; + } + } } \ No newline at end of file diff --git a/components/MovableComponent.cs b/components/MovableComponent.cs index c5521c3..dc3c3ae 100644 --- a/components/MovableComponent.cs +++ b/components/MovableComponent.cs @@ -1,7 +1,7 @@ using Godot; using System; -public class MovableComponent : Node +public class MovableComponent : Component { public Vector3 targetPosition = Vector3.Zero; public Vector3 currentPosition = Vector3.Zero; @@ -58,7 +58,7 @@ public class MovableComponent : Node currentAngle = springDamperResult.Item1; currentAngularVelocity = springDamperResult.Item2; - EmitSignal("OrientationUpdated", this.currentAngle); +// EmitSignal("OrientationUpdated", this.currentAngle); } if ((Mathf.Abs(currentAngularVelocity) < 5 && Mathf.Abs(targetAngle - currentAngle) < 0.3) diff --git a/components/NavigationComponent.cs b/components/NavigationComponent.cs index 407436d..e87db93 100644 --- a/components/NavigationComponent.cs +++ b/components/NavigationComponent.cs @@ -12,22 +12,48 @@ using GoDotLog; /// public class NavigationComponent : Node { + public class NavigationPoint + { + [Flags] + public enum NavigationFlags + { + Position = 1, + Orientation = 2 + } + + public Vector3 WorldPosition = Vector3.Zero; + public Quat WorldOrientation = Quat.Identity; + public NavigationFlags Flags = NavigationFlags.Position | NavigationFlags.Orientation; + + public NavigationPoint(Vector3 worldPosition) + { + WorldPosition = worldPosition; + Flags = NavigationFlags.Position; + } + + public NavigationPoint(Quat worldOrientation) + { + WorldOrientation = worldOrientation; + Flags = NavigationFlags.Orientation; + } + } + public TileWorld TileWorld { set; get; } - public Vector3 CurrentGoalWorld => _currentGoalWorld; + public Vector3 CurrentGoalPositionWorld => _currentGoalPositionWorld; + public Quat CurrentGoalOrientationWorld => _currentGoalOrientationWorld; - private Vector3 _currentGoalWorld = Vector3.Zero; - private Vector2 _currentGoalPlane = Vector2.Zero; - private Vector2 _currentGoalOffset = Vector2.Zero; - private Vector3 _currentPositionWorld = Vector3.Zero; - - private List _pathOffsetCoords; + private NavigationPoint _currentGoal; + private Vector3 _currentGoalPositionWorld = Vector3.Zero; + private Quat _currentGoalOrientationWorld = Quat.Identity; + + private List _pathWorldNavigationPoints; private HexCell[] _path; public override void _Ready() { base._Ready(); - _pathOffsetCoords = new List(); + _pathWorldNavigationPoints = new List(); } public override void _Process(float delta) @@ -50,39 +76,103 @@ public class NavigationComponent : Node _path = fromCell.LineTo(toCell); Debug.Assert(_path.Length > 0); - _pathOffsetCoords = new List(); + _pathWorldNavigationPoints = new List(); foreach (int index in Enumerable.Range(1, _path.Length - 1)) { - _pathOffsetCoords.Add(_path[index].OffsetCoords); + _pathWorldNavigationPoints.Add( + new NavigationPoint(TileWorld.GetTileWorldCenterFromOffset(_path[index].OffsetCoords))); + } + + if ((toPositionWorld - TileWorld.GetTileWorldCenterFromOffset(toCell.OffsetCoords)).LengthSquared() > + Globals.EpsPositionSquared) + { + _pathWorldNavigationPoints.Add(new NavigationPoint(toPositionWorld)); } UpdateCurrentGoal(); } + + public void Plan(Vector3 fromPositionWorld, Vector3 toPositionWorld, Quat toWorldOrientation) + { + Plan(fromPositionWorld, toPositionWorld); + + _pathWorldNavigationPoints.Add(new NavigationPoint(toWorldOrientation)); + } + + private void UpdateCurrentGoal() { - if (_pathOffsetCoords.Count == 0) + if (_pathWorldNavigationPoints.Count == 0) { return; } - _currentGoalWorld = TileWorld.GetTileWorldCenterFromOffset(_pathOffsetCoords[0]); + _currentGoal = _pathWorldNavigationPoints[0]; - GD.Print("Navigation: at " + _currentGoalWorld + " path length: " + - _pathOffsetCoords.Count); + GD.Print("Navigation Goal: pos " + _currentGoal.WorldPosition + " " + " rot: " + _currentGoal.WorldOrientation + + " flags: " + _currentGoal.Flags + " path length: " + + _pathWorldNavigationPoints.Count); } - public void UpdateCurrentGoal(Vector3 currentPositionWorld) + public void UpdateCurrentGoal(Transform currentTransformWorld) { - _currentPositionWorld = currentPositionWorld; + if (_pathWorldNavigationPoints.Count == 0) + { + return; + } + + if (_currentGoal.Flags.HasFlag(NavigationPoint.NavigationFlags.Position)) + { + _currentGoalPositionWorld = _pathWorldNavigationPoints[0].WorldPosition; + } + else + { + _currentGoalPositionWorld = currentTransformWorld.origin; + } + + if (_currentGoal.Flags.HasFlag(NavigationPoint.NavigationFlags.Orientation)) + { + _currentGoalOrientationWorld = _currentGoal.WorldOrientation; + } + else + { + _currentGoalOrientationWorld = currentTransformWorld.basis.Quat(); + } + + Vector3 currentPositionWorld = currentTransformWorld.origin; + Quat currentOrientationWorld = currentTransformWorld.basis.Quat(); Vector2 currentPositionPlane = new Vector2(currentPositionWorld.x, currentPositionWorld.z); - Vector2 currentGoalPlane = new Vector2(_currentGoalWorld.x, _currentGoalWorld.z); - if (_pathOffsetCoords.Count > 0 && - (currentPositionPlane - currentGoalPlane).LengthSquared() < Globals.EpsPositionSquared) + Vector2 currentGoalPlane = new Vector2(_currentGoal.WorldPosition.x, _currentGoal.WorldPosition.z); + + bool goalReached = false; + float positionErrorSquared = (currentPositionPlane - currentGoalPlane).LengthSquared(); + float orientationError = _currentGoalOrientationWorld.AngleTo(currentOrientationWorld); + + if (_currentGoal.Flags.HasFlag(NavigationPoint.NavigationFlags.Position) + && _currentGoal.Flags.HasFlag(NavigationPoint.NavigationFlags.Orientation) + && positionErrorSquared < Globals.EpsPositionSquared + && orientationError < Globals.EpsRadians) { - _pathOffsetCoords.RemoveAt(0); + goalReached = true; + } + else if (_currentGoal.Flags.HasFlag(NavigationPoint.NavigationFlags.Position) && + positionErrorSquared < Globals.EpsPositionSquared) + { + goalReached = true; + } + else if (_currentGoal.Flags.HasFlag(NavigationPoint.NavigationFlags.Orientation) && + orientationError < Globals.EpsRadians) + + { + goalReached = true; + } + + if (goalReached) + { + _pathWorldNavigationPoints.RemoveAt(0); UpdateCurrentGoal(); } } diff --git a/components/TaskQueueComponent.cs b/components/TaskQueueComponent.cs new file mode 100644 index 0000000..400ff6a --- /dev/null +++ b/components/TaskQueueComponent.cs @@ -0,0 +1,42 @@ +using Godot; +using System; +using System.Collections.Generic; +using System.Diagnostics; + +public class TaskQueueComponent : Component +{ + public class Task + { + } + + public class NavigationTask : Task + { + [Flags] public enum Flags + { + Position = 1, + Orientation = 2 + } + + public Vector3 TargetPositionWorld = Vector3.Zero; + public Quat TargetOrientationWorld = Quat.Identity; + public Flags NavigationFlags = Flags.Position | Flags.Orientation; + } + + public class InteractionTask : Task + { + public Entity TargetEntity; + } + + public Queue Queue; + + public TaskQueueComponent() + { + Queue = new Queue(); + Reset(); + } + + public void Reset() + { + Queue.Clear(); + } +} \ No newline at end of file diff --git a/components/WorldInfoComponent.cs b/components/WorldInfoComponent.cs index 7cfa266..f9a6f0d 100644 --- a/components/WorldInfoComponent.cs +++ b/components/WorldInfoComponent.cs @@ -1,7 +1,7 @@ using Godot; using System; -public class WorldInfoComponent : Node +public class WorldInfoComponent : Component { [Export] public NodePath World; diff --git a/doc/ComponentStuff.puml b/doc/ComponentStuff.puml new file mode 100644 index 0000000..0377786 --- /dev/null +++ b/doc/ComponentStuff.puml @@ -0,0 +1,19 @@ +@startuml +'https://plantuml.com/class-diagram + +class Entity +Entity *-- Component + +Entity : update() +Entity : Component[] mComponents +Entity : LocalSystem[] mSystems; + +class Component3 { + void update() + int counter +} +note right of Entity::update + lel +end note + +@enduml \ No newline at end of file diff --git a/entities/Chest.cs b/entities/Chest.cs index b68bc8b..8d7c137 100644 --- a/entities/Chest.cs +++ b/entities/Chest.cs @@ -51,9 +51,4 @@ public class Chest : Entity IsMouseOver = false; _mesh.MaterialOverride = null; } -// // Called every frame. 'delta' is the elapsed time since the previous frame. -// public override void _Process(float delta) -// { -// -// } } diff --git a/entities/Chest.tscn b/entities/Chest.tscn new file mode 100644 index 0000000..1b58112 --- /dev/null +++ b/entities/Chest.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://assets/Objects/chest.glb" type="PackedScene" id=1] +[ext_resource path="res://entities/Chest.cs" type="Script" id=2] + +[node name="Chest" instance=ExtResource( 1 )] +script = ExtResource( 2 ) + +[node name="Armature" parent="." index="2"] +transform = Transform( -0.259808, 0, 0.15, 0, 0.3, 0, -0.15, 0, -0.259808, 0, 0, 0 ) diff --git a/entities/Flower.cs b/entities/Flower.cs new file mode 100644 index 0000000..2f6089e --- /dev/null +++ b/entities/Flower.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.Linq; +using Godot; +using Godot.Collections; + +namespace GodotComponentTest.entities; + +public class Flower : Entity +{ + public override void _Ready() + { + Array children = new Array(); + GetAllChildren(this, ref children); + + foreach (Node child in children) + { + if (child is ClickableComponent) + { + GD.Print("Found Clickable Component!"); + } + } + } + + void GetAllChildren(Node childNode, ref Array childList) + { + var children = childNode.GetChildren(); + foreach (Node child in children) + { + childList.Add(child); + GetAllChildren(child, ref childList); + } + } +} \ No newline at end of file diff --git a/entities/Player.cs b/entities/Player.cs index 974ade9..25308d2 100644 --- a/entities/Player.cs +++ b/entities/Player.cs @@ -6,6 +6,8 @@ public class Player : Entity // public members public Vector3 TargetPosition = Vector3.Zero; + public TaskQueueComponent TaskQueueComponent; + public NavigationComponent Navigation { get { return _navigationComponent; } @@ -15,7 +17,6 @@ public class Player : Entity private MovableComponent _movable; private Spatial _geometry; private WorldInfoComponent _worldInfo; - private Vector2 _offsetCoord = Vector2.Zero; private GroundMotionComponent _groundMotion; private NavigationComponent _navigationComponent; @@ -26,6 +27,7 @@ public class Player : Entity _worldInfo = (WorldInfoComponent)FindNode("WorldInfo", false); _navigationComponent = (NavigationComponent)FindNode("Navigation", false); _navigationComponent.TileWorld = _worldInfo.TileWorld; + TaskQueueComponent = new TaskQueueComponent(); _movable = (MovableComponent)FindNode("Movable", false); if (_movable != null) @@ -46,9 +48,18 @@ public class Player : Entity return; } - _navigationComponent.UpdateCurrentGoal(GlobalTranslation); + if (TaskQueueComponent != null && TaskQueueComponent.Queue.Count > 0) + { + var currentTask = TaskQueueComponent.Queue.Peek(); + if (currentTask is TaskQueueComponent.NavigationTask) + { + TaskQueueComponent.NavigationTask navigationTask = (TaskQueueComponent.NavigationTask)TaskQueueComponent.Queue.Dequeue(); + + } + } - _groundMotion.PhysicsProcess(delta, this, _navigationComponent.CurrentGoalWorld, _worldInfo.TileWorld); + _navigationComponent.UpdateCurrentGoal(GlobalTransform); + _groundMotion.PhysicsProcess(delta, this, _navigationComponent.CurrentGoalPositionWorld, _navigationComponent.CurrentGoalOrientationWorld, _worldInfo.TileWorld); } @@ -56,10 +67,11 @@ public class Player : Entity { if (_navigationComponent != null) { - _navigationComponent.UpdateCurrentGoal(GlobalTranslation); + _navigationComponent.UpdateCurrentGoal(GlobalTransform); } - } + + } private void OnOrientationUpdated(float newOrientation) { diff --git a/project.godot b/project.godot index eb2ae4a..abce6f2 100644 --- a/project.godot +++ b/project.godot @@ -75,7 +75,7 @@ _global_script_class_icons={ [application] config/name="i3sc1 GodotComponentTest" -run/main_scene="res://scenes/AdaptiveWorldStream.tscn" +run/main_scene="res://scenes/Game.tscn" config/icon="res://icon.png" [display] diff --git a/scenes/AdaptiveWorldStream.tscn b/scenes/AdaptiveWorldStream.tscn index 3b39f50..00e9c9f 100644 --- a/scenes/AdaptiveWorldStream.tscn +++ b/scenes/AdaptiveWorldStream.tscn @@ -1,6 +1,5 @@ -[gd_scene load_steps=27 format=2] +[gd_scene load_steps=26 format=2] -[ext_resource path="res://scenes/AdaptiveWorldStream.cs" type="Script" id=1] [ext_resource path="res://assets/CreatusPiratePack/characters/Pirate1final_0.01.glb" type="PackedScene" id=2] [ext_resource path="res://components/WorldInfoComponent.cs" type="Script" id=3] [ext_resource path="res://scenes/StreamContainer.cs" type="Script" id=4] @@ -104,7 +103,6 @@ tracks/1/keys = PoolRealArray( 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0.133333, 1, extents = Vector3( 0.2, 0.2, 0.332224 ) [node name="AdaptiveWorldStream" type="Spatial"] -script = ExtResource( 1 ) [node name="TileHighlight" parent="." instance=ExtResource( 7 )] visible = false diff --git a/scenes/AdaptiveWorldStream.cs b/scenes/Game.cs similarity index 95% rename from scenes/AdaptiveWorldStream.cs rename to scenes/Game.cs index 07b424e..454ccf1 100644 --- a/scenes/AdaptiveWorldStream.cs +++ b/scenes/Game.cs @@ -6,7 +6,7 @@ using GoDotLog; using Dictionary = Godot.Collections.Dictionary; using Array = Godot.Collections.Array; -public class AdaptiveWorldStream : Spatial +public class Game : Spatial { // ui elements private Label _framesPerSecondLabel; @@ -59,7 +59,7 @@ public class AdaptiveWorldStream : Spatial _streamContainerArea = GetNode("StreamContainer/Area"); _streamContainerActiveTiles = GetNode("StreamContainer/ActiveTiles"); _player = GetNode("Player"); - _chest = GetNode("Chest"); + _chest = GetNode("Entities/Chest"); _tileWorld = GetNode("TileWorld"); Debug.Assert(_tileWorld != null); @@ -193,6 +193,13 @@ public class AdaptiveWorldStream : Spatial public void OnEntityClicked(Entity entity) { GD.Print("Clicked on entity at " + entity.GlobalTranslation); + + Spatial mountPoint = (Spatial)entity.FindNode("MountPoint"); + if (mountPoint != null) + { + GD.Print("Mount point!"); + _player.Navigation.Plan(_player.GlobalTranslation, mountPoint.GlobalTranslation, mountPoint.GlobalTransform.basis.Quat()); + } } diff --git a/scenes/Game.tscn b/scenes/Game.tscn new file mode 100644 index 0000000..e6ab0ca --- /dev/null +++ b/scenes/Game.tscn @@ -0,0 +1,482 @@ +[gd_scene load_steps=34 format=2] + +[ext_resource path="res://scenes/StreamContainer.cs" type="Script" id=1] +[ext_resource path="res://components/NavigationComponent.cs" type="Script" id=2] +[ext_resource path="res://entities/Player.cs" type="Script" id=3] +[ext_resource path="res://components/MovableComponent.cs" type="Script" id=4] +[ext_resource path="res://utils/TileHighlight.tscn" type="PackedScene" id=5] +[ext_resource path="res://components/WorldInfoComponent.cs" type="Script" id=6] +[ext_resource path="res://entities/Chest.cs" type="Script" id=7] +[ext_resource path="res://scenes/TileWorld.cs" type="Script" id=8] +[ext_resource path="res://scenes/Game.cs" type="Script" id=9] +[ext_resource path="res://scenes/DebugCamera.gd" type="Script" id=10] +[ext_resource path="res://assets/Objects/Lock.material" type="Material" id=11] +[ext_resource path="res://assets/Objects/Wood.material" type="Material" id=12] +[ext_resource path="res://assets/CreatusPiratePack/characters/Pirate1final_0.01.glb" type="PackedScene" id=13] +[ext_resource path="res://components/ClickableComponent.cs" type="Script" id=14] +[ext_resource path="res://entities/Flower.cs" type="Script" id=15] + +[sub_resource type="OpenSimplexNoise" id=10] +period = 39.6 + +[sub_resource type="NoiseTexture" id=11] +width = 100 +height = 100 +noise = SubResource( 10 ) + +[sub_resource type="CubeMesh" id=1] +size = Vector3( 1, 1, 1 ) + +[sub_resource type="SpatialMaterial" id=2] +params_blend_mode = 3 +albedo_color = Color( 1, 1, 1, 0.156863 ) + +[sub_resource type="BoxShape" id=9] +extents = Vector3( 20, 1, 20 ) + +[sub_resource type="CapsuleShape" id=7] +radius = 0.4 +height = 0.2 + +[sub_resource type="SpatialMaterial" id=20] +albedo_color = Color( 0.741176, 0.529412, 0.32549, 1 ) + +[sub_resource type="CapsuleMesh" id=8] +material = SubResource( 20 ) +radius = 0.2 +mid_height = 0.5 +radial_segments = 16 + +[sub_resource type="CubeMesh" id=14] + +[sub_resource type="PrismMesh" id=15] + +[sub_resource type="ArrayMesh" id=12] +resource_name = "chest_Cube" +surfaces/0 = { +"aabb": AABB( -0.763939, 0, -1.05715, 1.52788, 1.5, 2.11429 ), +"array_data": PoolByteArray( 187, 77, 50, 63, 0, 0, 128, 63, 0, 0, 128, 191, 127, 127, 0, 127, 0, 57, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 63, 0, 0, 128, 63, 0, 0, 128, 191, 0, 127, 129, 63, 0, 57, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 63, 0, 0, 128, 63, 0, 0, 128, 191, 127, 0, 0, 127, 0, 57, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 63, 0, 0, 0, 0, 0, 0, 128, 191, 0, 129, 127, 63, 0, 54, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 63, 0, 0, 0, 0, 0, 0, 128, 191, 127, 127, 0, 127, 0, 54, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 63, 0, 0, 0, 0, 0, 0, 128, 191, 127, 0, 0, 127, 0, 54, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 0, 127, 0, 57, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 127, 129, 63, 0, 57, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 63, 0, 0, 128, 63, 0, 0, 128, 63, 127, 0, 0, 127, 0, 57, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 63, 0, 0, 0, 0, 0, 0, 128, 63, 0, 129, 127, 63, 0, 54, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 63, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 127, 0, 54, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 63, 0, 0, 0, 0, 0, 0, 128, 63, 127, 0, 0, 127, 0, 54, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 191, 0, 0, 128, 63, 0, 0, 128, 191, 129, 0, 0, 127, 0, 57, 0, 58, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 191, 0, 0, 128, 63, 0, 0, 128, 191, 127, 127, 0, 127, 0, 57, 0, 58, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 191, 0, 0, 128, 63, 0, 0, 128, 191, 0, 127, 129, 63, 0, 59, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 191, 0, 0, 0, 0, 0, 0, 128, 191, 129, 0, 0, 127, 0, 54, 0, 58, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 191, 0, 0, 0, 0, 0, 0, 128, 191, 0, 129, 127, 63, 0, 48, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 191, 0, 0, 0, 0, 0, 0, 128, 191, 127, 127, 0, 127, 0, 54, 0, 58, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 191, 0, 0, 128, 63, 0, 0, 128, 63, 129, 0, 0, 127, 0, 57, 0, 60, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 191, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 0, 127, 0, 57, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 191, 0, 0, 128, 63, 0, 0, 128, 63, 0, 127, 129, 63, 0, 59, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 191, 0, 0, 0, 0, 0, 0, 128, 63, 129, 0, 0, 127, 0, 54, 0, 60, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 191, 0, 0, 0, 0, 0, 0, 128, 63, 0, 129, 127, 63, 0, 48, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 187, 77, 50, 191, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 127, 0, 54, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 6, 160, 249, 62, 255, 255, 191, 63, 156, 158, 129, 191, 114, 127, 217, 103, 0, 57, 0, 56, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 6, 160, 249, 62, 255, 255, 191, 63, 156, 158, 129, 191, 0, 127, 0, 63, 29, 5, 63, 54, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 6, 160, 249, 62, 255, 255, 191, 63, 156, 158, 129, 191, 75, 51, 208, 98, 0, 57, 0, 56, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 125, 145, 67, 63, 204, 204, 140, 63, 148, 80, 135, 191, 0, 129, 127, 63, 0, 54, 0, 56, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 125, 145, 67, 63, 204, 204, 140, 63, 148, 80, 135, 191, 114, 127, 208, 98, 0, 54, 0, 56, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 125, 145, 67, 63, 204, 204, 140, 63, 148, 80, 135, 191, 75, 51, 207, 99, 0, 54, 0, 56, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 6, 160, 249, 62, 255, 255, 191, 63, 156, 158, 129, 63, 0, 12, 200, 102, 0, 57, 0, 52, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 6, 160, 249, 62, 255, 255, 191, 63, 156, 158, 129, 63, 0, 127, 0, 63, 255, 59, 63, 54, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 6, 160, 249, 62, 255, 255, 191, 63, 156, 158, 129, 63, 75, 51, 201, 102, 0, 57, 0, 52, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 125, 145, 67, 63, 204, 204, 140, 63, 148, 80, 135, 63, 0, 129, 127, 63, 0, 54, 0, 52, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 125, 145, 67, 63, 204, 204, 140, 63, 148, 80, 135, 63, 0, 12, 223, 115, 0, 54, 0, 52, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 125, 145, 67, 63, 204, 204, 140, 63, 148, 80, 135, 63, 75, 51, 200, 102, 0, 54, 0, 52, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 6, 160, 249, 190, 255, 255, 191, 63, 156, 158, 129, 191, 181, 51, 49, 99, 0, 57, 0, 58, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 6, 160, 249, 190, 255, 255, 191, 63, 156, 158, 129, 191, 114, 127, 48, 98, 0, 57, 0, 58, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 6, 160, 249, 190, 255, 255, 191, 63, 156, 158, 129, 191, 0, 127, 0, 63, 30, 5, 255, 59, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 125, 145, 67, 191, 204, 204, 140, 63, 148, 80, 135, 191, 181, 51, 48, 98, 0, 54, 0, 58, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 125, 145, 67, 191, 204, 204, 140, 63, 148, 80, 135, 191, 0, 129, 127, 63, 0, 48, 0, 56, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 125, 145, 67, 191, 204, 204, 140, 63, 148, 80, 135, 191, 114, 127, 23, 110, 0, 54, 0, 58, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 6, 160, 249, 190, 255, 255, 191, 63, 156, 158, 129, 63, 181, 51, 56, 102, 0, 57, 0, 60, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 6, 160, 249, 190, 255, 255, 191, 63, 156, 158, 129, 63, 0, 12, 47, 107, 0, 57, 0, 0, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 6, 160, 249, 190, 255, 255, 191, 63, 156, 158, 129, 63, 0, 127, 0, 63, 255, 59, 255, 59, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 125, 145, 67, 191, 204, 204, 140, 63, 148, 80, 135, 63, 181, 51, 55, 102, 0, 54, 0, 60, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 125, 145, 67, 191, 204, 204, 140, 63, 148, 80, 135, 63, 0, 129, 127, 63, 0, 48, 0, 52, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 125, 145, 67, 191, 204, 204, 140, 63, 148, 80, 135, 63, 0, 12, 56, 102, 0, 54, 0, 0, 1, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0 ), +"array_index_data": PoolByteArray( 1, 0, 20, 0, 14, 0, 1, 0, 7, 0, 20, 0, 10, 0, 19, 0, 6, 0, 10, 0, 23, 0, 19, 0, 21, 0, 12, 0, 18, 0, 21, 0, 15, 0, 12, 0, 16, 0, 9, 0, 3, 0, 16, 0, 22, 0, 9, 0, 5, 0, 8, 0, 2, 0, 5, 0, 11, 0, 8, 0, 17, 0, 0, 0, 13, 0, 17, 0, 4, 0, 0, 0, 25, 0, 44, 0, 38, 0, 25, 0, 31, 0, 44, 0, 34, 0, 43, 0, 30, 0, 34, 0, 47, 0, 43, 0, 45, 0, 36, 0, 42, 0, 45, 0, 39, 0, 36, 0, 40, 0, 33, 0, 27, 0, 40, 0, 46, 0, 33, 0, 29, 0, 32, 0, 26, 0, 29, 0, 35, 0, 32, 0, 41, 0, 24, 0, 37, 0, 41, 0, 28, 0, 24, 0 ), +"blend_shape_data": [ ], +"format": 2194903, +"index_count": 72, +"material": ExtResource( 12 ), +"primitive": 4, +"skeleton_aabb": [ AABB( -0.696499, 0, -1, 1.39301, 1.00001, 2 ), AABB( -0.763939, 1.1, -1.05715, 1.52788, 0.40001, 2.11429 ) ], +"vertex_count": 48 +} +surfaces/1 = { +"aabb": AABB( -0.904068, 0.508223, -0.240492, 0.305096, 0.507121, 0.480994 ), +"array_data": PoolByteArray( 8, 113, 103, 191, 238, 26, 2, 63, 128, 67, 118, 62, 129, 0, 0, 127, 0, 54, 0, 60, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 8, 113, 103, 191, 238, 26, 2, 63, 128, 67, 118, 62, 0, 129, 127, 63, 0, 48, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 8, 113, 103, 191, 238, 26, 2, 63, 128, 67, 118, 62, 0, 0, 0, 127, 0, 54, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 8, 113, 103, 191, 205, 246, 129, 63, 128, 67, 118, 62, 129, 0, 0, 127, 0, 57, 0, 60, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 8, 113, 103, 191, 205, 246, 129, 63, 128, 67, 118, 62, 0, 0, 0, 127, 0, 57, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 8, 113, 103, 191, 205, 246, 129, 63, 128, 67, 118, 62, 0, 127, 129, 63, 0, 59, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 8, 113, 103, 191, 238, 26, 2, 63, 114, 67, 118, 190, 129, 0, 0, 127, 0, 54, 0, 58, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 8, 113, 103, 191, 238, 26, 2, 63, 114, 67, 118, 190, 0, 129, 127, 63, 0, 48, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 8, 113, 103, 191, 238, 26, 2, 63, 114, 67, 118, 190, 127, 127, 0, 127, 0, 54, 0, 58, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 8, 113, 103, 191, 205, 246, 129, 63, 114, 67, 118, 190, 129, 0, 0, 127, 0, 57, 0, 58, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 8, 113, 103, 191, 205, 246, 129, 63, 114, 67, 118, 190, 127, 127, 0, 127, 0, 57, 0, 58, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 8, 113, 103, 191, 205, 246, 129, 63, 114, 67, 118, 190, 0, 127, 129, 63, 0, 59, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 70, 86, 25, 191, 238, 26, 2, 63, 128, 67, 118, 62, 0, 129, 127, 63, 0, 54, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 70, 86, 25, 191, 238, 26, 2, 63, 128, 67, 118, 62, 0, 0, 0, 127, 0, 54, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 70, 86, 25, 191, 238, 26, 2, 63, 128, 67, 118, 62, 127, 0, 0, 127, 0, 54, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 70, 86, 25, 191, 205, 246, 129, 63, 128, 67, 118, 62, 0, 0, 0, 127, 0, 57, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 70, 86, 25, 191, 205, 246, 129, 63, 128, 67, 118, 62, 0, 127, 129, 63, 0, 57, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 70, 86, 25, 191, 205, 246, 129, 63, 128, 67, 118, 62, 127, 0, 0, 127, 0, 57, 0, 52, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 70, 86, 25, 191, 238, 26, 2, 63, 114, 67, 118, 190, 0, 129, 127, 63, 0, 54, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 70, 86, 25, 191, 238, 26, 2, 63, 114, 67, 118, 190, 127, 127, 0, 127, 0, 54, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 70, 86, 25, 191, 238, 26, 2, 63, 114, 67, 118, 190, 127, 0, 0, 127, 0, 54, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 70, 86, 25, 191, 205, 246, 129, 63, 114, 67, 118, 190, 127, 127, 0, 127, 0, 57, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 70, 86, 25, 191, 205, 246, 129, 63, 114, 67, 118, 190, 0, 127, 129, 63, 0, 57, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 70, 86, 25, 191, 205, 246, 129, 63, 114, 67, 118, 190, 127, 0, 0, 127, 0, 57, 0, 56, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0 ), +"array_index_data": PoolByteArray( 0, 0, 9, 0, 3, 0, 0, 0, 6, 0, 9, 0, 8, 0, 21, 0, 10, 0, 8, 0, 19, 0, 21, 0, 20, 0, 17, 0, 23, 0, 20, 0, 14, 0, 17, 0, 13, 0, 4, 0, 15, 0, 13, 0, 2, 0, 4, 0, 7, 0, 12, 0, 18, 0, 7, 0, 1, 0, 12, 0, 22, 0, 5, 0, 11, 0, 22, 0, 16, 0, 5, 0 ), +"blend_shape_data": [ ], +"format": 2194903, +"index_count": 36, +"material": ExtResource( 11 ), +"primitive": 4, +"skeleton_aabb": [ AABB( -0.904068, 0.508223, -0.240492, 0.305096, 0.507121, 0.480994 ) ], +"vertex_count": 24 +} + +[sub_resource type="Skin" id=13] +resource_name = "Skin" +bind_count = 2 +bind/0/name = "Body" +bind/0/bone = -1 +bind/0/pose = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.697618, 0.0422799, 5.68067e-09 ) +bind/1/name = "Lid" +bind/1/bone = -1 +bind/1/pose = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.693102, -1.13623, -1.52663e-07 ) + +[sub_resource type="Animation" id=3] +resource_name = "ChestOpen" +length = 0.333333 +tracks/0/type = "transform" +tracks/0/path = NodePath("Armature/Skeleton:Lid") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = PoolRealArray( 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0.0666667, 1, 0, 0, 0, 0, 0, -0.079364, 0.996846, 1, 1, 1, 0.133333, 1, 0, 0, 0, 0, 0, -0.489957, 0.871747, 1, 1, 1, 0.2, 1, 0, 0, 0, 0, 0, -0.855809, 0.517292, 1, 1, 1, 0.266667, 1, 2.37487e-08, 0, 0, 4.03449e-08, -3.99897e-08, 0.919654, -0.39273, 1, 1, 1, 0.333333, 1, 0, 0, 0, -1.45046e-08, 1.43769e-08, -0.808978, 0.587839, 1, 1, 1 ) +tracks/1/type = "transform" +tracks/1/path = NodePath("Armature/Skeleton:Body") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = PoolRealArray( 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0.133333, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0.266667, 1, 0, 0, 0, -5.57256e-17, 1.47956e-08, -0.0876532, 0.996151, 1, 1, 1, 0.333333, 1, 0, 0, 0, -1.11023e-16, -2.8211e-10, 0.00209969, 0.999998, 1, 1, 1 ) + +[sub_resource type="BoxShape" id=16] +extents = Vector3( 0.2, 0.2, 0.332224 ) + +[sub_resource type="CubeMesh" id=17] + +[sub_resource type="BoxShape" id=18] +extents = Vector3( 0.2, 0.2, 0.2 ) + +[sub_resource type="BoxShape" id=19] + +[sub_resource type="Animation" id=21] +resource_name = "ChestOpen" +length = 0.333333 +tracks/0/type = "transform" +tracks/0/path = NodePath("Armature/Skeleton:Lid") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = PoolRealArray( 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0.0666667, 1, 0, 0, 0, 0, 0, -0.079364, 0.996846, 1, 1, 1, 0.133333, 1, 0, 0, 0, 0, 0, -0.489957, 0.871747, 1, 1, 1, 0.2, 1, 0, 0, 0, 0, 0, -0.855809, 0.517292, 1, 1, 1, 0.266667, 1, 2.37487e-08, 0, 0, 4.03449e-08, -3.99897e-08, 0.919654, -0.39273, 1, 1, 1, 0.333333, 1, 0, 0, 0, -1.45046e-08, 1.43769e-08, -0.808978, 0.587839, 1, 1, 1 ) +tracks/1/type = "transform" +tracks/1/path = NodePath("Armature/Skeleton:Body") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = PoolRealArray( 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0.133333, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0.266667, 1, 0, 0, 0, -5.57256e-17, 1.47956e-08, -0.0876532, 0.996151, 1, 1, 1, 0.333333, 1, 0, 0, 0, -1.11023e-16, -2.8211e-10, 0.00209969, 0.999998, 1, 1, 1 ) + +[node name="Game" type="Spatial"] +script = ExtResource( 9 ) + +[node name="TileHighlight" parent="." instance=ExtResource( 5 )] +visible = false + +[node name="MouseTileHighlight" parent="." instance=ExtResource( 5 )] + +[node name="TileWorld" type="Spatial" parent="."] +script = ExtResource( 8 ) + +[node name="DirectionalLight" type="DirectionalLight" parent="TileWorld"] +transform = Transform( 0.328059, -0.878387, 0.347583, 0, 0.367946, 0.929847, -0.944657, -0.305045, 0.120708, 0, 6.59293, 1.20265 ) +shadow_enabled = true +directional_shadow_mode = 0 + +[node name="Control" type="Control" parent="."] +margin_right = 40.0 +margin_bottom = 40.0 +mouse_filter = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="Control"] +margin_right = 40.0 +margin_bottom = 40.0 +mouse_filter = 2 +alignment = 2 + +[node name="GridContainer" type="GridContainer" parent="Control/HBoxContainer"] +margin_right = 127.0 +margin_bottom = 158.0 +mouse_filter = 2 +columns = 2 + +[node name="Label9" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_right = 103.0 +margin_bottom = 14.0 +rect_pivot_offset = Vector2( -335, -33 ) +text = "FPS" + +[node name="fps_label" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_left = 107.0 +margin_right = 127.0 +margin_bottom = 14.0 +text = "0,0" + +[node name="Label" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_top = 18.0 +margin_right = 103.0 +margin_bottom = 32.0 +rect_pivot_offset = Vector2( -335, -33 ) +text = "Tile" + +[node name="tile_label" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_left = 107.0 +margin_top = 18.0 +margin_right = 127.0 +margin_bottom = 32.0 +text = "0,0" + +[node name="Label2" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_top = 36.0 +margin_right = 103.0 +margin_bottom = 50.0 +text = "Tile Offset" + +[node name="tile_offset_label" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_left = 107.0 +margin_top = 36.0 +margin_right = 127.0 +margin_bottom = 50.0 +text = "0,0" + +[node name="Label4" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_top = 54.0 +margin_right = 103.0 +margin_bottom = 68.0 +rect_pivot_offset = Vector2( -335, -33 ) +text = "Mouse World" + +[node name="mouse_world_label" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_left = 107.0 +margin_top = 54.0 +margin_right = 127.0 +margin_bottom = 68.0 +text = "0,0" + +[node name="Label6" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_top = 72.0 +margin_right = 103.0 +margin_bottom = 86.0 +rect_pivot_offset = Vector2( -335, -33 ) +text = "Mouse Tile" + +[node name="mouse_tile_label" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_left = 107.0 +margin_top = 72.0 +margin_right = 127.0 +margin_bottom = 86.0 +text = "0,0" + +[node name="Label3" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_top = 90.0 +margin_right = 103.0 +margin_bottom = 104.0 +text = "#Tiles" + +[node name="num_tiles_label" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_left = 107.0 +margin_top = 90.0 +margin_right = 127.0 +margin_bottom = 104.0 +text = "0" + +[node name="Label5" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_top = 108.0 +margin_right = 103.0 +margin_bottom = 122.0 +text = "#Active" + +[node name="num_active_tiles_label" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_left = 107.0 +margin_top = 108.0 +margin_right = 127.0 +margin_bottom = 122.0 +text = "0" + +[node name="Label7" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_top = 126.0 +margin_right = 103.0 +margin_bottom = 140.0 +text = "#Tiles Added" + +[node name="num_coords_added_label" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_left = 107.0 +margin_top = 126.0 +margin_right = 127.0 +margin_bottom = 140.0 +text = "0" + +[node name="Label8" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_top = 144.0 +margin_right = 103.0 +margin_bottom = 158.0 +text = "#Tiles Removed" + +[node name="num_coords_removed_label" type="Label" parent="Control/HBoxContainer/GridContainer"] +margin_left = 107.0 +margin_top = 144.0 +margin_right = 127.0 +margin_bottom = 158.0 +text = "0" + +[node name="WorldTextureRect" type="TextureRect" parent="Control"] +margin_left = 1.0 +margin_top = 300.0 +margin_right = 513.0 +margin_bottom = 812.0 +texture = SubResource( 11 ) + +[node name="StreamContainer" type="Spatial" parent="."] +script = ExtResource( 1 ) +Dimensions = Vector2( 18, 17 ) +World = NodePath("../TileWorld") + +[node name="ActiveTiles" type="Spatial" parent="StreamContainer"] + +[node name="Bounds" type="MeshInstance" parent="StreamContainer"] +transform = Transform( 4, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0 ) +visible = false +mesh = SubResource( 1 ) +skeleton = NodePath("../..") +material/0 = SubResource( 2 ) + +[node name="Area" type="Area" parent="StreamContainer"] + +[node name="CollisionShape" type="CollisionShape" parent="StreamContainer/Area"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 ) +shape = SubResource( 9 ) + +[node name="Camera" type="Camera" parent="."] +transform = Transform( 1, 0, 0, 0, 0.511698, 0.859165, 0, -0.859165, 0.511698, -4.76837e-07, 4.79787, 2.99071 ) +current = true +fov = 60.0 +script = ExtResource( 10 ) + +[node name="Player" type="KinematicBody" parent="."] +script = ExtResource( 3 ) + +[node name="CollisionShape" type="CollisionShape" parent="Player"] +transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0.5, 0 ) +shape = SubResource( 7 ) + +[node name="MeshInstance" type="MeshInstance" parent="Player"] +transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0.5, 0 ) +mesh = SubResource( 8 ) + +[node name="Arrow" type="Spatial" parent="Player/MeshInstance"] +transform = Transform( 3, -1.51264e-15, -9.91796e-22, 0, -8.74228e-09, 3, -2.26897e-14, -0.2, -1.31134e-07, 0, -0.253289, 0.32602 ) + +[node name="MeshInstance" type="MeshInstance" parent="Player/MeshInstance/Arrow"] +transform = Transform( 0.1, 0, 3.72529e-09, 0, 0.1, 0, -3.72529e-09, 0, 0.1, 0, 0, 0 ) +visible = false +mesh = SubResource( 14 ) +skeleton = NodePath("../../..") + +[node name="MeshInstance2" type="MeshInstance" parent="Player/MeshInstance/Arrow"] +transform = Transform( 0.1, 3.72529e-09, -1.62838e-16, 0, -4.37114e-09, -0.1, -3.72529e-09, 0.1, -4.37114e-09, 0, 0, 0.191322 ) +mesh = SubResource( 15 ) +skeleton = NodePath("../../..") + +[node name="Movable" type="Node" parent="Player"] +script = ExtResource( 4 ) + +[node name="Geometry" type="Spatial" parent="Player"] + +[node name="Pirate1final_001" parent="Player/Geometry" instance=ExtResource( 13 )] +transform = Transform( 0.4, 0, 0, 0, 0.4, 0, 0, 0, 0.4, 0, 0, 0 ) + +[node name="WorldInfo" type="Node" parent="Player"] +script = ExtResource( 6 ) +World = NodePath("../../TileWorld") + +[node name="Navigation" type="Node" parent="Player"] +script = ExtResource( 2 ) + +[node name="Entities" type="Spatial" parent="."] + +[node name="Chest" type="KinematicBody" parent="Entities"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.36874, 0, -1.70504 ) +script = ExtResource( 7 ) + +[node name="Armature" type="Spatial" parent="Entities/Chest"] +transform = Transform( -0.259808, 0, 0.15, 0, 0.3, 0, -0.15, 0, -0.259808, 0, 0, 0 ) + +[node name="Skeleton" type="Skeleton" parent="Entities/Chest/Armature"] +bones/0/name = "Body" +bones/0/parent = -1 +bones/0/rest = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.697618, -0.0422799, -5.68067e-09 ) +bones/0/enabled = true +bones/0/bound_children = [ ] +bones/1/name = "Lid" +bones/1/parent = 0 +bones/1/rest = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00451577, 1.17851, 1.58344e-07 ) +bones/1/enabled = true +bones/1/bound_children = [ ] + +[node name="Chest" type="MeshInstance" parent="Entities/Chest/Armature/Skeleton"] +mesh = SubResource( 12 ) +skin = SubResource( 13 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="Entities/Chest"] +anims/ChestOpen = SubResource( 3 ) + +[node name="State" type="Node" parent="Entities/Chest"] + +[node name="MountPoint" type="Spatial" parent="Entities/Chest"] +transform = Transform( -0.468254, 0, -0.883594, 0, 1, 0, 0.883594, 0, -0.468254, 0.922324, 0, 0.544538 ) + +[node name="Arrow" type="Spatial" parent="Entities/Chest/MountPoint"] +transform = Transform( -1, 0, -8.74227e-08, 0, 1, 0, 8.74227e-08, 0, -1, 2.38419e-07, 0, 0 ) + +[node name="MeshInstance" type="MeshInstance" parent="Entities/Chest/MountPoint/Arrow"] +transform = Transform( -0.1, 0, -1.24676e-08, 0, 0.1, 0, 1.24676e-08, 0, -0.1, 0, 0, 0.0394838 ) +mesh = SubResource( 14 ) +skeleton = NodePath("../..") + +[node name="MeshInstance2" type="MeshInstance" parent="Entities/Chest/MountPoint/Arrow"] +transform = Transform( -0.1, -1.24676e-08, 6.04182e-16, 0, -4.37114e-09, -0.1, 1.24676e-08, -0.1, 4.37114e-09, 0, 0, -0.151838 ) +mesh = SubResource( 15 ) +skeleton = NodePath("../..") + +[node name="ResourceContainer" type="Node" parent="Entities/Chest"] + +[node name="CollisionShape" type="CollisionShape" parent="Entities/Chest"] +transform = Transform( -0.866026, 0, 0.5, 0, 1, 0, -0.5, 0, -0.866026, 0, 0.240716, 0 ) +shape = SubResource( 16 ) + +[node name="Flower" type="KinematicBody" parent="Entities"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.75737, 0, -3.73012 ) +script = ExtResource( 15 ) + +[node name="MeshInstance" type="MeshInstance" parent="Entities/Flower"] +transform = Transform( 0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 0, 0 ) +mesh = SubResource( 17 ) + +[node name="CollisionShape" type="CollisionShape" parent="Entities/Flower"] +shape = SubResource( 18 ) + +[node name="ClickableComponent" type="Spatial" parent="Entities/Flower"] +script = ExtResource( 14 ) + +[node name="Area" type="Area" parent="Entities/Flower/ClickableComponent"] + +[node name="CollisionShape" type="CollisionShape" parent="Entities/Flower/ClickableComponent/Area"] +transform = Transform( 0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 0, 0 ) +shape = SubResource( 19 ) + +[node name="Chest2" type="KinematicBody" parent="Entities"] +transform = Transform( -0.437806, 0, -0.899069, 0, 1, 0, 0.899069, 0, -0.437806, -1.05888, 0, -2.14715 ) +script = ExtResource( 7 ) + +[node name="Armature" type="Spatial" parent="Entities/Chest2"] +transform = Transform( -0.259808, 0, 0.15, 0, 0.3, 0, -0.15, 0, -0.259808, 0, 0, 0 ) + +[node name="Skeleton" type="Skeleton" parent="Entities/Chest2/Armature"] +bones/0/name = "Body" +bones/0/parent = -1 +bones/0/rest = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.697618, -0.0422799, -5.68067e-09 ) +bones/0/enabled = true +bones/0/bound_children = [ ] +bones/1/name = "Lid" +bones/1/parent = 0 +bones/1/rest = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00451577, 1.17851, 1.58344e-07 ) +bones/1/enabled = true +bones/1/bound_children = [ ] + +[node name="Chest" type="MeshInstance" parent="Entities/Chest2/Armature/Skeleton"] +mesh = SubResource( 12 ) +skin = SubResource( 13 ) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="Entities/Chest2"] +anims/ChestOpen = SubResource( 21 ) + +[node name="State" type="Node" parent="Entities/Chest2"] + +[node name="MountPoint" type="Spatial" parent="Entities/Chest2"] +transform = Transform( -0.468254, 0, -0.883594, 0, 1, 0, 0.883594, 0, -0.468254, 0.922324, 0, 0.544538 ) + +[node name="Arrow" type="Spatial" parent="Entities/Chest2/MountPoint"] +transform = Transform( -1, 0, -8.74227e-08, 0, 1, 0, 8.74227e-08, 0, -1, 2.38419e-07, 0, 0 ) + +[node name="MeshInstance" type="MeshInstance" parent="Entities/Chest2/MountPoint/Arrow"] +transform = Transform( -0.1, 0, -1.24676e-08, 0, 0.1, 0, 1.24676e-08, 0, -0.1, 0, 0, 0.0394838 ) +mesh = SubResource( 14 ) +skeleton = NodePath("../..") + +[node name="MeshInstance2" type="MeshInstance" parent="Entities/Chest2/MountPoint/Arrow"] +transform = Transform( -0.1, -1.24676e-08, 6.04182e-16, 0, -4.37114e-09, -0.1, 1.24676e-08, -0.1, 4.37114e-09, 0, 0, -0.151838 ) +mesh = SubResource( 15 ) +skeleton = NodePath("../..") + +[node name="ResourceContainer" type="Node" parent="Entities/Chest2"] + +[node name="CollisionShape" type="CollisionShape" parent="Entities/Chest2"] +transform = Transform( -0.866026, 0, 0.5, 0, 1, 0, -0.5, 0, -0.866026, 0, 0.240716, 0 ) +shape = SubResource( 16 ) diff --git a/systems/WorldLookupSystem.cs b/systems/WorldLookupSystem.cs new file mode 100644 index 0000000..4e2e54b --- /dev/null +++ b/systems/WorldLookupSystem.cs @@ -0,0 +1,12 @@ +public class LookupWorldSystem : IWorldSystemInterface +{ + public void RegisterEntityComponent(Entity entity, Component component) + { + throw new System.NotImplementedException(); + } + + public void Update(float delta) + { + throw new System.NotImplementedException(); + } +} \ No newline at end of file diff --git a/systems/WorldSystemInterface.cs b/systems/WorldSystemInterface.cs new file mode 100644 index 0000000..9fc30f6 --- /dev/null +++ b/systems/WorldSystemInterface.cs @@ -0,0 +1,5 @@ +public interface IWorldSystemInterface +{ + void RegisterEntityComponent(Entity entity, Component component); + void Update(float delta); +} \ No newline at end of file