sas
This commit is contained in:
28
Code/Gravity/NormalGravityTrigger.cs
Normal file
28
Code/Gravity/NormalGravityTrigger.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Sandbox;
|
||||
|
||||
public sealed class NormalGravityTrigger : Component, Component.ITriggerListener
|
||||
{
|
||||
[Property] public bool TriggerOnEnter { get; set; } = false;
|
||||
|
||||
public void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if ( !TriggerOnEnter ) return;
|
||||
|
||||
var otherEntity = other.GameObject;
|
||||
|
||||
if (otherEntity.Components.TryGet<Dedugan>(out var controller))
|
||||
{
|
||||
controller.OverrideGravity = WorldRotation.Down;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnTriggerExit(Collider other)
|
||||
{
|
||||
var otherEntity = other.GameObject;
|
||||
|
||||
if (otherEntity.Components.TryGet<Dedugan>(out var controller))
|
||||
{
|
||||
controller.OverrideGravity = Vector3.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
public sealed class Teleporter : Component, Component.ITriggerListener
|
||||
{
|
||||
[Property] public GameObject ToPosGameObject { get; set; }
|
||||
[Property] public GameObject Building { get; set; }
|
||||
|
||||
public void OnTriggerEnter( Collider other )
|
||||
{
|
||||
@@ -18,8 +19,13 @@ public sealed class Teleporter : Component, Component.ITriggerListener
|
||||
otherEntity.WorldPosition = ToPosGameObject.WorldPosition;
|
||||
controller.OverrideGravity = Vector3.Down;
|
||||
|
||||
controller.EyeAngles = new Angles( 0, 180, 0 ).ToRotation();
|
||||
controller.Renderer.LocalRotation = new Angles( 0, 180, 0 ).ToRotation();
|
||||
controller.EyeAngles = new Angles( 0, ToPosGameObject.WorldRotation.Yaw(), 0 ).ToRotation();
|
||||
controller.Renderer.LocalRotation = new Angles( 0, ToPosGameObject.WorldRotation.Yaw(), 0 ).ToRotation();
|
||||
|
||||
if ( Building != null )
|
||||
{
|
||||
Building.Enabled = !Building.Enabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using Sandbox;
|
||||
|
||||
public sealed class NormalGravityTrigger : Component, Component.ITriggerListener
|
||||
{
|
||||
// public void OnTriggerEnter(Collider other)
|
||||
// {
|
||||
// var otherEntity = other.GameObject;
|
||||
//
|
||||
// if (otherEntity.Components.TryGet<Dedugan>(out var controller))
|
||||
// {
|
||||
// Log.Info($"{otherEntity.Name} вошел в зону нормальной гравитации");
|
||||
//
|
||||
// controller.OverrideGravity = Vector3.Down;
|
||||
// }
|
||||
// }
|
||||
|
||||
public void OnTriggerExit(Collider other)
|
||||
{
|
||||
var otherEntity = other.GameObject;
|
||||
|
||||
if (otherEntity.Components.TryGet<Dedugan>(out var controller))
|
||||
{
|
||||
controller.OverrideGravity = Vector3.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ public sealed class RagdollController : Component
|
||||
bodyPhysics.Enabled = value;
|
||||
bodyPhysics.MotionEnabled = value;
|
||||
bodyRenderer.UseAnimGraph = !value;
|
||||
bodyPhysics.
|
||||
|
||||
if ( !value )
|
||||
{
|
||||
13
Code/Sounds/MusicPlayerInteractions.cs
Normal file
13
Code/Sounds/MusicPlayerInteractions.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Sandbox;
|
||||
|
||||
public sealed class MusicPlayerInteractions : SimpleInteractions.SimpleInteraction
|
||||
{
|
||||
[Property] public MyMusicPlayer MusicPlayer { get; set; }
|
||||
|
||||
[Rpc.Broadcast]
|
||||
protected override void OnInteract()
|
||||
{
|
||||
// Log.Info($"{Rpc.Caller.DisplayName} interacted with {this.GameObject.Name}!");
|
||||
MusicPlayer.Next();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Sandbox;
|
||||
|
||||
public sealed class MusicPlayer : Component
|
||||
public sealed class MyMusicPlayer : Component
|
||||
{
|
||||
[Property] private List<SoundEvent> _sounds;
|
||||
[Property] private List<SoundPointComponent> _speakers;
|
||||
@@ -1,9 +0,0 @@
|
||||
using Sandbox;
|
||||
|
||||
public sealed class Test : Component
|
||||
{
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace Sandbox;
|
||||
|
||||
public class VectorExtension
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using Sandbox;
|
||||
using Sandbox.UI;
|
||||
|
||||
namespace Sandbox;
|
||||
|
||||
public sealed class ButtonComponent : Component, IInteractable
|
||||
{
|
||||
[Property] public Action OnClick { get; set; }
|
||||
|
||||
public void OnUse()
|
||||
{
|
||||
OnClick?.Invoke();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user