69 lines
1.2 KiB
C#
69 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using EventParts;
|
|
using Godot;
|
|
using Godot.Bridge;
|
|
using Godot.NativeInterop;
|
|
|
|
[ScriptPath("res://Scripts/Events/EventParts/EntityFace.cs")]
|
|
public partial class EntityFace : Node, EventPart
|
|
{
|
|
public enum Type
|
|
{
|
|
Node,
|
|
Point,
|
|
Direction
|
|
}
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private Type type;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private Vector2 pos;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private Node2D point;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private Entity.Direction direction;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private Entity entity;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private int entityIndex;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private bool getParty;
|
|
|
|
public EventController parent { get; set; }
|
|
|
|
public bool parallel { get; set; }
|
|
|
|
public Coroutine routine { get; set; }
|
|
|
|
public IEnumerator Routine()
|
|
{
|
|
if (getParty)
|
|
{
|
|
entity = Party.GetOWEntityByIndex(entityIndex);
|
|
}
|
|
switch (type)
|
|
{
|
|
case Type.Direction:
|
|
entity.direction = direction;
|
|
entity.UpdateAnim(force: true);
|
|
break;
|
|
case Type.Node:
|
|
entity.LookAt(point.GlobalPosition);
|
|
break;
|
|
case Type.Point:
|
|
entity.LookAt(pos);
|
|
break;
|
|
}
|
|
yield break;
|
|
}
|
|
|
|
}
|