asd
This commit is contained in:
@@ -1,10 +1,20 @@
|
||||
using Sandbox;
|
||||
|
||||
|
||||
public enum GravityType
|
||||
{
|
||||
Down,
|
||||
Circle
|
||||
}
|
||||
public sealed class Teleporter : Component, Component.ITriggerListener
|
||||
{
|
||||
[Property] public GameObject ToPosGameObject { get; set; }
|
||||
[Property] public GameObject Building { get; set; }
|
||||
// [Property] public bool ResetGravity { get; set; } = false;
|
||||
// [Property] public bool NormalGravity { get; set; } = true;
|
||||
|
||||
|
||||
|
||||
[Property] public GravityType gravityType { get; set; } = GravityType.Down;
|
||||
|
||||
public void OnTriggerEnter( Collider other )
|
||||
{
|
||||
@@ -17,7 +27,16 @@ public sealed class Teleporter : Component, Component.ITriggerListener
|
||||
Log.Info($"{otherEntity.Name} вошел в зону телепорта");
|
||||
|
||||
otherEntity.WorldPosition = ToPosGameObject.WorldPosition;
|
||||
controller.OverrideGravity = Vector3.Down;
|
||||
|
||||
if ( gravityType == GravityType.Circle )
|
||||
{
|
||||
controller.OverrideGravity = Vector3.Zero;
|
||||
}
|
||||
|
||||
if ( gravityType == GravityType.Down )
|
||||
{
|
||||
controller.OverrideGravity = Vector3.Down;
|
||||
}
|
||||
|
||||
controller.EyeAngles = new Angles( 0, ToPosGameObject.WorldRotation.Yaw(), 0 ).ToRotation();
|
||||
controller.Renderer.LocalRotation = new Angles( 0, ToPosGameObject.WorldRotation.Yaw(), 0 ).ToRotation();
|
||||
|
||||
Reference in New Issue
Block a user