Added particle and bug fixes #437

Merged
glencelow merged 7 commits from PlayerController into main 2023-03-24 16:09:43 +08:00
20 changed files with 361 additions and 37 deletions
Showing only changes of commit 364da8ea85 - Show all commits

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,7 @@
Name: MD_CeilingFan
ID: 73062062
Type: 4
Sub Assets:
Name: Sphere.005
ID: 135521751
Type: 8

View File

@ -6864,8 +6864,8 @@
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 140697366
Material: 129495479
Mesh: 148542784
Material: 121518381
IsActive: true
RigidBody Component:
Type: Dynamic

View File

@ -1025,8 +1025,8 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 4.37222624, y: 0.944371462, z: 4.06488085}
Rotate: {x: 0, y: 0, z: 0}
Translate: {x: 2.66560459, y: 0.10531798, z: 5.97001934}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
@ -2899,7 +2899,7 @@
- EID: 2
Name: Player
IsActive: true
NumberOfChildren: 6
NumberOfChildren: 7
Components:
Transform Component:
Translate: {x: 2.35245037, y: 0.0613552481, z: 7.10571432}
@ -2976,7 +2976,7 @@
tweenAimDuration: 0.300000012
aimingFOV: 15
trajMaxSteps: 50
trajTimeSteps: 0.0166999996
trajTimeSteps: 0.0160000008
- Type: PlayerAnimations
Enabled: true
playerIdleClip: 227450439
@ -3117,6 +3117,36 @@
"Color Eval Rate ": 0.5
IsActive: true
Scripts: ~
- EID: 573
Name: Smoke
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -0.00712490082, y: 0.056717217, z: -0.0870996416}
Rotate: {x: -5.83341553e-08, y: -3.14159274, z: 1.10461471e-08}
Scale: {x: 1.00000012, y: 1, z: 1.00000012}
IsActive: true
classSHADE::SHParticleEmitterComponent:
Emission Count: 4
Is Passive: false
Emission Interval: 0
Min Life: 0
Max Life: 0.5
Minimum Speed: 1
Maximum Speed: 1.5
Minimum Size: 0
Maximum Size: 0.5
Size Decay: 0.907999992
Angular Ranges And Offset: {x: 6.19999981, y: 3.1400001, z: 0, w: 1.70000005}
Rotation Speed: 0.805999994
Rotation Decay: 0
Texture Asset ID: 0
Custom Update Shader Asset ID: 0
Color Tint: {x: 1, y: 1, z: 1, w: 1}
Acceleration: {x: 0, y: 0.0500000007, z: 0.100000001}
IsActive: true
Scripts: ~
- EID: 239
Name: RespawnPoint
IsActive: true
@ -5388,8 +5418,8 @@
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 140697366
Material: 129495479
Mesh: 148542784
Material: 121518381
IsActive: true
RigidBody Component:
Type: Dynamic
@ -5482,7 +5512,7 @@
Components:
Transform Component:
Translate: {x: 0, y: -300, z: 0}
Rotate: {x: 0.5, y: 2.82014489, z: 0.5}
Rotate: {x: -1.48352981, y: 2.82014489, z: 0.5}
Scale: {x: 400, y: 100, z: 500}
IsActive: true
Renderable Component:
@ -15023,3 +15053,201 @@
Clicked: false
IsActive: true
Scripts: ~
- EID: 570
Name: CeilingFan
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -3.43279505, y: 3.04381442, z: 0.590506613}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 135521751
Material: 131956078
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: -0.699999988, y: -0.75, z: 0}
Rotation Offset: {x: 0, y: 0.34906584, z: 0}
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: -0.699999988, y: -0.75, z: 0}
Rotation Offset: {x: 0, y: 1.60570288, z: 0}
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: -0.699999988, y: -0.75, z: 0}
Rotation Offset: {x: 0, y: -0.907571197, z: 0}
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: -0.699999988, y: -0.75, z: 0}
Rotation Offset: {x: 0, y: -2.16420817, z: 0}
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: -0.699999988, y: -0.75, z: 0}
Rotation Offset: {x: 0, y: 2.87979317, z: 0}
IsActive: true
Scripts:
- Type: CeilingFan
Enabled: true
rotateSpeed: 3
- EID: 571
Name: CeilingFan
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -0.0900869966, y: 3.04381442, z: -2.56089497}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 135521751
Material: 131956078
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: -0.699999988, y: -0.75, z: 0}
Rotation Offset: {x: 0, y: 0.34906584, z: 0}
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: -0.699999988, y: -0.75, z: 0}
Rotation Offset: {x: 0, y: 1.60570288, z: 0}
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: -0.699999988, y: -0.75, z: 0}
Rotation Offset: {x: 0, y: -0.907571197, z: 0}
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: -0.699999988, y: -0.75, z: 0}
Rotation Offset: {x: 0, y: -2.16420817, z: 0}
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: -0.699999988, y: -0.75, z: 0}
Rotation Offset: {x: 0, y: 2.87979317, z: 0}
IsActive: true
Scripts:
- Type: CeilingFan
Enabled: true
rotateSpeed: 3
- EID: 572
Name: CeilingFan
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 2.14731741, y: 3.04381442, z: 3.51156116}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 135521751
Material: 131956078
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: -0.699999988, y: -0.75, z: 0}
Rotation Offset: {x: 0, y: 0.34906584, z: 0}
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: -0.699999988, y: -0.75, z: 0}
Rotation Offset: {x: 0, y: 1.60570288, z: 0}
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: -0.699999988, y: -0.75, z: 0}
Rotation Offset: {x: 0, y: -0.907571197, z: 0}
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: -0.699999988, y: -0.75, z: 0}
Rotation Offset: {x: 0, y: -2.16420817, z: 0}
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 0.300000012}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: -0.699999988, y: -0.75, z: 0}
Rotation Offset: {x: 0, y: 2.87979317, z: 0}
IsActive: true
Scripts:
- Type: CeilingFan
Enabled: true
rotateSpeed: 3

View File

@ -8661,13 +8661,13 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0.892607987, y: 0, z: 1.50168896}
Translate: {x: 1.19757175, y: 0, z: 0.855755448}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 140697366
Material: 129495479
Mesh: 148542784
Material: 121518381
IsActive: true
RigidBody Component:
Type: Dynamic
@ -12553,8 +12553,8 @@
Components:
Transform Component:
Translate: {x: 0.728688836, y: 0.534546018, z: 10.5705957}
Rotate: {x: 0, y: 3.10297418, z: 0}
Scale: {x: 1.00027728, y: 1, z: 1.00027728}
Rotate: {x: -0, y: 3.10297418, z: 0}
Scale: {x: 1.00027752, y: 1, z: 1.00027752}
IsActive: true
Renderable Component:
Mesh: 150010583
@ -12678,9 +12678,9 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0.102274597, y: 0, z: -0.00395232625}
Translate: {x: -1.78079093, y: -0.150818765, z: 0.483723372}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1.00002515, y: 1, z: 1.00002515}
Scale: {x: 1.00025964, y: 1, z: 1.00025964}
IsActive: true
Renderable Component:
Mesh: 150010583

View File

@ -14,6 +14,7 @@ public class PlayerRunState : BaseState
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
AudioHandler.audioClipHandlers["footsteps"].Play();
if (PlayerAnimations.Instance)
{
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerRunClip);
@ -30,6 +31,7 @@ public class PlayerRunState : BaseState
if (timer > delay)
{
AudioHandler.audioClipHandlers["footsteps"].Play();
machine.GetScript<PlayerController>().smoke.Emit();
timer = 0;
}
}

View File

@ -5,7 +5,7 @@ using System;
public class PlayerWalkState : BaseState
{
private float timer;
private float delay = 0.5f;
private float delay = 0.4f;
public PlayerWalkState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Walk State";
@ -13,6 +13,7 @@ public class PlayerWalkState : BaseState
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
AudioHandler.audioClipHandlers["footsteps"].Play();
timer = delay;
machine.GetScript<PlayerController>().playLandedAnimation = false;
@ -48,6 +49,7 @@ public class PlayerWalkState : BaseState
if (timer > delay)
{
AudioHandler.audioClipHandlers["footsteps"].Play();
machine.GetScript<PlayerController>().smoke.Emit();
timer = 0;
}
}

View File

@ -24,6 +24,7 @@ public class PlayerController : Script
public CameraArm camArm { get; set; }
private PickAndThrow pat;
public StateMachine stateMachine { get; set; }
public ParticleEmitter smoke { get; set; }
public bool holdItem { get; set; }
public bool isAiming { get; set; }
@ -145,6 +146,10 @@ public class PlayerController : Script
AudioHandler.audioClipHandlers["footsteps"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_footsteps");
playLandedAnimation = false;
smoke = GetComponentInChildren<ParticleEmitter>();
if (!smoke)
Debug.LogError("ParticleEmitter MISSING");
}
protected override void start()

View File

@ -0,0 +1,79 @@
using SHADE;
using SHADE_Scripting.Audio;
using System;
public class CeilingFan : Script
{
private Transform tran;
private Collider collider;
private float rotate = 0.0f;
public float rotateSpeed = 10.0f;
private float rotateCollider1 = 0.0f;
private float rotateCollider2 = 0.0f;
private float rotateCollider3 = 0.0f;
private float rotateCollider4 = 0.0f;
private float rotateCollider5 = 0.0f;
private float defaultCollider1 = 0.0f;
private float defaultCollider2 = 0.0f;
private float defaultCollider3 = 0.0f;
private float defaultCollider4 = 0.0f;
private float defaultCollider5 = 0.0f;
protected override void awake()
{
tran = GetComponent<Transform>();
if (!tran)
Debug.Log("FAN TRAN MISSING");
collider = GetComponent<Collider>();
if (!collider)
Debug.Log("FAN COLLIDER MISSING");
else
{
rotateCollider1 = collider.GetCollisionShape(0).RotationOffset.y;
defaultCollider1 = collider.GetCollisionShape(0).RotationOffset.y;
rotateCollider2 = collider.GetCollisionShape(1).RotationOffset.y;
defaultCollider2 = collider.GetCollisionShape(1).RotationOffset.y;
rotateCollider3 = collider.GetCollisionShape(2).RotationOffset.y;
defaultCollider3 = collider.GetCollisionShape(2).RotationOffset.y;
rotateCollider4 = collider.GetCollisionShape(3).RotationOffset.y;
defaultCollider4 = collider.GetCollisionShape(3).RotationOffset.y;
rotateCollider5 = collider.GetCollisionShape(4).RotationOffset.y;
defaultCollider5 = collider.GetCollisionShape(4).RotationOffset.y;
}
}
protected override void fixedUpdate()
{
rotate += rotateSpeed * (float)Time.FixedDeltaTime;
rotateCollider1 += rotateSpeed * (float)Time.FixedDeltaTime;
rotateCollider2 += rotateSpeed * (float)Time.FixedDeltaTime;
rotateCollider3 += rotateSpeed * (float)Time.FixedDeltaTime;
rotateCollider4 += rotateSpeed * (float)Time.FixedDeltaTime;
rotateCollider5 += rotateSpeed * (float)Time.FixedDeltaTime;
if (rotate >= MathF.PI * 2)
{
rotate = 0;
rotateCollider1 = defaultCollider1;
rotateCollider2 = defaultCollider2;
rotateCollider3 = defaultCollider3;
rotateCollider4 = defaultCollider4;
rotateCollider5 = defaultCollider5;
}
tran.LocalEulerAngles = new Vector3(0.0f, rotate, 0.0f);
collider.GetCollisionShape(0).RotationOffset = new Vector3(0.0f, rotateCollider1, 0.0f);
collider.GetCollisionShape(1).RotationOffset = new Vector3(0.0f, rotateCollider2, 0.0f);
collider.GetCollisionShape(2).RotationOffset = new Vector3(0.0f, rotateCollider3, 0.0f);
collider.GetCollisionShape(3).RotationOffset = new Vector3(0.0f, rotateCollider4, 0.0f);
collider.GetCollisionShape(4).RotationOffset = new Vector3(0.0f, rotateCollider5, 0.0f);
}
}

View File

@ -0,0 +1,3 @@
Name: SC_CeilingFan
ID: 157170734
Type: 9

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_Particles_Smoke
ID: 56224060
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_Particles_Splatter
ID: 64562973
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_Particles_Star
ID: 65401279
Type: 3