34 lines
943 B
C#
34 lines
943 B
C#
![]() |
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using BITKit;
|
||
|
using BITKit.Entities;
|
||
|
using NodeCanvas.Framework;
|
||
|
using Project.B.CharacterController;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace Net.Project.B.NodeCanvas
|
||
|
{
|
||
|
public class TeleportPlayerTask : ActionTask
|
||
|
{
|
||
|
public BBParameter<Transform> Target;
|
||
|
|
||
|
protected override void OnExecute()
|
||
|
{
|
||
|
if (BITApp.ServiceProvider.QueryComponents(out IEntitiesService entitiesService) is false)
|
||
|
{
|
||
|
EndAction(false);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
foreach (var (_,characterController) in entitiesService.QueryComponents<LocalPlayerComponent,ICharacterController>())
|
||
|
{
|
||
|
characterController.Position = Target.value.position;
|
||
|
characterController.ViewRotation = Target.value.rotation;
|
||
|
}
|
||
|
|
||
|
EndAction(true);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|