48 lines
936 B
C#
48 lines
936 B
C#
using Godot;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Godot.Collections;
|
|
|
|
namespace Rokojori
|
|
{
|
|
|
|
[GlobalClass]
|
|
public partial class Pointer:RJPointer
|
|
{
|
|
[Export]
|
|
public RJPointable pointable;
|
|
|
|
public override void _Process( double delta )
|
|
{
|
|
if ( Caster == null )
|
|
{
|
|
return;
|
|
}
|
|
|
|
var currentCollider = Caster.NumColliders() == 0 ? null : Caster.GetCollider( 0 );
|
|
|
|
|
|
var currentPointable = currentCollider == null ? null : Nodes.Find<RJPointable>( currentCollider );
|
|
|
|
// RJLog.Log( currentCollider, currentPointable );
|
|
|
|
if ( currentPointable == pointable )
|
|
{
|
|
return;
|
|
}
|
|
|
|
|
|
if ( pointable != null )
|
|
{
|
|
pointable.UpdatePointerState( this, false );
|
|
}
|
|
|
|
pointable = currentPointable;
|
|
|
|
if ( pointable != null )
|
|
{
|
|
pointable.UpdatePointerState( this, true );
|
|
}
|
|
}
|
|
}
|
|
} |