mirror of
https://github.com/celisej567/gm_construct_port.git
synced 2026-09-27 16:16:14 +03:00
Add files via upload
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using Sandbox;
|
||||
|
||||
[Library( "ent_balloon", Title = "Balloon", Spawnable = true )]
|
||||
public partial class BalloonEntity : Prop
|
||||
{
|
||||
private static float GravityScale => -0.2f;
|
||||
|
||||
public override void Spawn()
|
||||
{
|
||||
base.Spawn();
|
||||
|
||||
SetModel( "models/citizen_props/balloonregular01.vmdl" );
|
||||
SetupPhysicsFromModel( PhysicsMotionType.Dynamic, false );
|
||||
PhysicsBody.GravityScale = GravityScale;
|
||||
RenderColor = Color.Random.ToColor32();
|
||||
}
|
||||
|
||||
public override void OnKilled()
|
||||
{
|
||||
base.OnKilled();
|
||||
|
||||
PlaySound( "balloon_pop_cute" );
|
||||
}
|
||||
|
||||
[Event.Physics.PostStep]
|
||||
public void OnPostPhysicsStep()
|
||||
{
|
||||
if ( !this.IsValid() )
|
||||
return;
|
||||
|
||||
var body = PhysicsBody;
|
||||
if ( !body.IsValid() )
|
||||
return;
|
||||
|
||||
body.GravityScale = GravityScale;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user