small smart dialogue system change

This commit is contained in:
2023-01-28 15:12:43 +01:00
parent 8826213317
commit a88a8cdac7
5 changed files with 13 additions and 9 deletions

View File

@@ -1,4 +1,3 @@
//WORK IN PROGRESS this code is very messy and will be fixed when it works
using Godot;
using System;

View File

@@ -8,11 +8,13 @@ public partial class player : CharacterBody2D
public Vector2 movement;
public AnimatedSprite2D animatedSprite;
public Marker2D rotCenter;
public RayCast2D rayCast;
public override void _Ready()
{
animatedSprite = GetNode<AnimatedSprite2D>("animated_sprite_2d");
rotCenter = GetNode<Marker2D>("rotation_center");
rayCast = GetNode<RayCast2D>("rotation_center/ray_cast_2d");
}
public void ChangeProcess(bool process)
{
@@ -27,10 +29,9 @@ public partial class player : CharacterBody2D
}
public override void _Process(double delta)
{
//call event in raycasted object
/*if (Input.IsActionJustPressed("ui_accept") && rayCast.IsColliding())
rayCast.GetCollider().Call("OnInteraction", playerName);*/
if (Input.IsActionJustPressed("ui_accept") && rayCast.IsColliding())
rayCast.GetCollider().Call("OnInteraction", playerName);
//animation system (with controller support wich cant get normalized vector)
if (movement.Length() != 0)