Added trail for better feel on bullets

Bullets come out of cannon barrel
This commit is contained in:
Soulaha Balde 2022-05-14 16:05:45 -04:00
parent 8d9f3f61b9
commit b8abd15fd2
5 changed files with 109 additions and 18 deletions

BIN
Assets/Art/Materials/mat_trail.mat (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Art/Materials/mat_trail.mat.meta (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -183,22 +183,6 @@ MonoBehaviour:
m_Calls: []
m_ActionId: 61ddf11f-3478-4887-ab86-0ead8dde336f
m_ActionName: UI/TrackedDeviceOrientation
- m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 3117915759359451286}
m_TargetAssemblyTypeName: PlayerController, Assembly-CSharp
m_MethodName: OnUpgrade
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_ActionId: dbe4eda4-74d0-47d3-b2d1-c8292faa8b62
m_ActionName: Player/UpgradeTest[/Keyboard/r]
m_NeverAutoSwitchControlSchemes: 0
m_DefaultControlScheme:
m_DefaultActionMap: Player
@ -222,6 +206,7 @@ MonoBehaviour:
cannonForce: 1000
fireRate: 0.5
fireTimer: 0
damage: 1
--- !u!1 &6969840675949508920
GameObject:
m_ObjectHideFlags: 0
@ -315,7 +300,7 @@ BoxCollider:
m_GameObject: {fileID: 6969840675949508920}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Enabled: 0
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}

View File

@ -14,6 +14,7 @@ GameObject:
- component: {fileID: 8824810498392835647}
- component: {fileID: 1596552820235563576}
- component: {fileID: -5096460011673770898}
- component: {fileID: 8618525506095844415}
m_Layer: 0
m_Name: Projectile
m_TagString: Untagged
@ -128,3 +129,102 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
lifeTime: 1
--- !u!96 &8618525506095844415
TrailRenderer:
serializedVersion: 2
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5630905120393344806}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: ee1ce0afe992adc458acbbc4cdff6ab2, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Time: 0.02
m_Parameters:
serializedVersion: 3
widthMultiplier: 0.25
widthCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
colorGradient:
serializedVersion: 2
key0: {r: 0.740566, g: 0.9948123, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 2
m_NumAlphaKeys: 2
numCornerVertices: 0
numCapVertices: 0
alignment: 0
textureMode: 0
shadowBias: 0.5
generateLightingData: 1
m_MinVertexDistance: 0.1
m_Autodestruct: 0
m_Emitting: 1

View File

@ -30,7 +30,7 @@ public class CannonScript : MonoBehaviour
if(firing && !EventSystem.current.IsPointerOverGameObject()){
fireTimer += Time.deltaTime;
if(fireTimer >= fireRate){
GameObject proj = Instantiate(projectile, transform.position, cannon.transform.rotation);
GameObject proj = Instantiate(projectile, cannon.transform.position, cannon.transform.rotation);
proj.GetComponent<Projectile>().SetDamage(damage);
proj.GetComponent<Rigidbody>().AddForce(cannonForce * lookDir, ForceMode.Impulse);
fireTimer = 0;