added food particles and small bug fix

This commit is contained in:
Glence 2023-03-26 18:10:58 +08:00
parent 2da73f12d0
commit 2fd4e51cd0
7 changed files with 1625 additions and 422 deletions

View File

@ -7709,12 +7709,31 @@
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
classSHADE::SHParticleEmitterComponent:
Emission Count: 15
Is Passive: false
Emission Interval: 0
Min Life: 0.300000012
Max Life: 0.400000006
Minimum Speed: 0.5
Maximum Speed: 1
Minimum Size: 0.0500000007
Maximum Size: 0.0799999982
Size Decay: 0.980000019
Angular Ranges And Offset: {x: 6.19999981, y: 3.1400001, z: 6.19999981, w: 0}
Rotation Speed: 0.100000001
Rotation Decay: 0
Texture Asset ID: 0
Custom Update Shader Asset ID: 0
Color Tint: {x: 0.876652002, y: 0.485357881, z: 0.166061834, w: 1}
Acceleration: {x: 0, y: 0, z: 0}
IsActive: true
Scripts: Scripts:
- Type: Item - Type: Item
Enabled: true Enabled: true
Score: 50 Score: 50
currCategory: 1 currCategory: 1
currFood: 0 currFood: 2
dontReturn: false dontReturn: false
soundDistance: 10 soundDistance: 10
highlightSpeed: 200 highlightSpeed: 200
@ -7761,12 +7780,31 @@
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
classSHADE::SHParticleEmitterComponent:
Emission Count: 20
Is Passive: false
Emission Interval: 0
Min Life: 0.300000012
Max Life: 0.400000006
Minimum Speed: 1
Maximum Speed: 1.5
Minimum Size: 0.0500000007
Maximum Size: 0.100000001
Size Decay: 0.980000019
Angular Ranges And Offset: {x: 6.19999981, y: 1.57000005, z: 6.19999981, w: 0}
Rotation Speed: 0.100000001
Rotation Decay: 0
Texture Asset ID: 0
Custom Update Shader Asset ID: 0
Color Tint: {x: 0.977993011, y: 1, z: 0.286343634, w: 1}
Acceleration: {x: 0, y: -0.0199999996, z: 0}
IsActive: true
Scripts: Scripts:
- Type: Item - Type: Item
Enabled: true Enabled: true
Score: 500 Score: 500
currCategory: 2 currCategory: 2
currFood: 0 currFood: 4
dontReturn: false dontReturn: false
soundDistance: 10 soundDistance: 10
highlightSpeed: 200 highlightSpeed: 200
@ -7813,12 +7851,31 @@
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
classSHADE::SHParticleEmitterComponent:
Emission Count: 10
Is Passive: false
Emission Interval: 0
Min Life: 0.300000012
Max Life: 0.400000006
Minimum Speed: 0.5
Maximum Speed: 1
Minimum Size: 0.00999999978
Maximum Size: 0.0500000007
Size Decay: 0.980000019
Angular Ranges And Offset: {x: 6.19999981, y: 3.1400001, z: 6.19999981, w: 0}
Rotation Speed: 0.100000001
Rotation Decay: 0
Texture Asset ID: 0
Custom Update Shader Asset ID: 0
Color Tint: {x: 0.279913902, y: 0.845814943, z: 0.0856993049, w: 1}
Acceleration: {x: 0, y: -0.0199999996, z: 0}
IsActive: true
Scripts: Scripts:
- Type: Item - Type: Item
Enabled: true Enabled: true
Score: 10 Score: 10
currCategory: 0 currCategory: 0
currFood: 0 currFood: 1
dontReturn: false dontReturn: false
soundDistance: 10 soundDistance: 10
highlightSpeed: 200 highlightSpeed: 200
@ -7865,12 +7922,31 @@
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
classSHADE::SHParticleEmitterComponent:
Emission Count: 10
Is Passive: false
Emission Interval: 0
Min Life: 0.300000012
Max Life: 0.400000006
Minimum Speed: 0.5
Maximum Speed: 1
Minimum Size: 0.00999999978
Maximum Size: 0.0500000007
Size Decay: 0.980000019
Angular Ranges And Offset: {x: 6.19999981, y: 3.1400001, z: 6.19999981, w: 0}
Rotation Speed: 0.100000001
Rotation Decay: 0
Texture Asset ID: 0
Custom Update Shader Asset ID: 0
Color Tint: {x: 0.279913902, y: 0.845814943, z: 0.0856993049, w: 1}
Acceleration: {x: 0, y: -0.0199999996, z: 0}
IsActive: true
Scripts: Scripts:
- Type: Item - Type: Item
Enabled: true Enabled: true
Score: 10 Score: 10
currCategory: 0 currCategory: 0
currFood: 0 currFood: 1
dontReturn: false dontReturn: false
soundDistance: 10 soundDistance: 10
highlightSpeed: 200 highlightSpeed: 200

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -14,9 +14,6 @@ public class Breakable : Script
public bool isBreak { get; set; } public bool isBreak { get; set; }
private List<GameObject> itemPieces = new List<GameObject>(); private List<GameObject> itemPieces = new List<GameObject>();
[SerializeField]
private string breakClipHandlerName;
[SerializeField] [SerializeField]
private string breakClipPath; private string breakClipPath;
@ -38,7 +35,8 @@ public class Breakable : Script
isBreak = false; isBreak = false;
AudioHandler.audioClipHandlers[breakClipHandlerName] = Audio.CreateAudioClip(breakClipPath); AudioHandler.audioClipHandlers["break"] = Audio.CreateAudioClip(breakClipPath);
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["break"], GameObject.EntityId);
} }
protected override void update() protected override void update()
@ -81,9 +79,7 @@ public class Breakable : Script
GameManager.Instance.itemShatter = false; GameManager.Instance.itemShatter = false;
isBreak = false; isBreak = false;
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers[breakClipHandlerName], GameObject.EntityId); AudioHandler.audioClipHandlers["break"].Play();
AudioHandler.audioClipHandlers[breakClipHandlerName].Play();
//Audio.DetachAudioClipFromObject(AudioHandler.audioClipHandlers[breakClipHandlerName]);
GameObject.SetActive(false); GameObject.SetActive(false);
} }
} }

View File

@ -27,14 +27,12 @@ public class Item : Script
public bool returnBack { get; set; } public bool returnBack { get; set; }
private Transform transform; private Transform transform;
private RigidBody rb; private RigidBody rb;
private bool playSound = false;
private bool caputurePos = false; private bool caputurePos = false;
private Vector3 firstPostion; private Vector3 firstPostion;
private Vector3 firstRotation; private Vector3 firstRotation;
public bool dontReturn = false; public bool dontReturn = false;
private bool once = true;
private bool checkSound = false;
private bool homeownerOnce = true; private bool homeownerOnce = true;
public float soundDistance = 10; public float soundDistance = 10;
@ -61,6 +59,11 @@ public class Item : Script
AudioHandler.audioClipHandlers["SFXImpactElastic"] = Audio.CreateAudioClip("event:/Props/impact_elastic"); AudioHandler.audioClipHandlers["SFXImpactElastic"] = Audio.CreateAudioClip("event:/Props/impact_elastic");
AudioHandler.audioClipHandlers["SFXImpactHard"] = Audio.CreateAudioClip("event:/Props/impact_hard"); AudioHandler.audioClipHandlers["SFXImpactHard"] = Audio.CreateAudioClip("event:/Props/impact_hard");
if (currCategory == ItemCategory.LIGHT)
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXImpactElastic"], GameObject.EntityId);
else if (currCategory == ItemCategory.MEDIUM || currCategory == ItemCategory.HEAVY)
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXImpactHard"], GameObject.EntityId);
emitter = GetComponent<ParticleEmitter>(); emitter = GetComponent<ParticleEmitter>();
} }
@ -115,19 +118,6 @@ public class Item : Script
returnBack = false; returnBack = false;
} }
if (checkSound)
{
/* //need to wait for collisionEnter Fix
Vector3 itemPos = transform.LocalPosition;
Vector3 len = Homeowner1.aiInstance.GetComponent<Transform>().LocalPosition - itemPos;
Debug.Log($"distance: {len.GetSqrMagnitude()}");
if (len.GetSqrMagnitude() <= soundDistance)
{
//set ai to alert
}
checkSound = false;*/
}
} }
protected override void onCollisionEnter(CollisionInfo info) protected override void onCollisionEnter(CollisionInfo info)
@ -140,22 +130,20 @@ public class Item : Script
caputurePos = true; caputurePos = true;
} }
if (playSound) if (once)
{ {
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXImpactElastic"], GameObject.EntityId);
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXImpactHard"], GameObject.EntityId);
if (currCategory == ItemCategory.LIGHT) if (currCategory == ItemCategory.LIGHT)
AudioHandler.audioClipHandlers["SFXImpactElastic"].Play(); AudioHandler.audioClipHandlers["SFXImpactElastic"].Play();
else if (currCategory == ItemCategory.MEDIUM || currCategory == ItemCategory.HEAVY) else if (currCategory == ItemCategory.MEDIUM || currCategory == ItemCategory.HEAVY)
AudioHandler.audioClipHandlers["SFXImpactHard"].Play(); AudioHandler.audioClipHandlers["SFXImpactHard"].Play();
playSound = false;
Audio.DetachAudioClipFromObject(AudioHandler.audioClipHandlers["SFXImpactElastic"]);
Audio.DetachAudioClipFromObject(AudioHandler.audioClipHandlers["SFXImpactHard"]);
if(emitter) if (emitter)
emitter.Emit(); emitter.Emit();
once = false;
} }
if (info.GameObject.GetScript<HomeOwnerAI>() && homeownerOnce) if (info.GameObject.GetScript<HomeOwnerAI>() && homeownerOnce)
{ {
homeownerOnce = false; homeownerOnce = false;
@ -165,9 +153,8 @@ public class Item : Script
protected override void onCollisionExit(CollisionInfo info) protected override void onCollisionExit(CollisionInfo info)
{ {
playSound = true;
checkSound = true;
homeownerOnce = true; homeownerOnce = true;
once = true;
} }
} }

View File

@ -474,7 +474,7 @@ public class PickAndThrow : Script
} }
} }
private void TweenAimCamArm(bool aim) public void TweenAimCamArm(bool aim)
{ {
if (aim) if (aim)

View File

@ -343,6 +343,9 @@ public class PlayerController : Script
if (pat && holdItem) if (pat && holdItem)
{ {
holdItem = false; holdItem = false;
isAiming = false;
cam.FOV = Settings.cameraFOV;
pat.TweenAimCamArm(false);
pat.SetItemGravityBack(); pat.SetItemGravityBack();
pat.ResetItemObject(); pat.ResetItemObject();
} }