Pull request #12: Soulaha
Merge in CEGJ/creative-jam-20 from Soulaha to main * commit '77924dda40cfd34aafd794dc4b27a125679a14da': correct bullet speed Added bullet amount upgrade OnHover upgrades btn display "purchase" ui appears Added trail for better feel on bullets Bullets come out of cannon barrel
This commit is contained in:
commit
fa3eeb2e3f
BIN
Assets/Art/Materials/mat_trail.mat
(Stored with Git LFS)
Normal file
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
BIN
Assets/Art/Materials/mat_trail.mat.meta
(Stored with Git LFS)
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -183,22 +183,6 @@ MonoBehaviour:
|
|||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_ActionId: 61ddf11f-3478-4887-ab86-0ead8dde336f
|
m_ActionId: 61ddf11f-3478-4887-ab86-0ead8dde336f
|
||||||
m_ActionName: UI/TrackedDeviceOrientation
|
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_NeverAutoSwitchControlSchemes: 0
|
||||||
m_DefaultControlScheme:
|
m_DefaultControlScheme:
|
||||||
m_DefaultActionMap: Player
|
m_DefaultActionMap: Player
|
||||||
@ -219,9 +203,11 @@ MonoBehaviour:
|
|||||||
cannon: {fileID: 6969840675257017922}
|
cannon: {fileID: 6969840675257017922}
|
||||||
projectile: {fileID: 5630905120393344806, guid: 70e77cdd333989d4193d3d85029d8cbe, type: 3}
|
projectile: {fileID: 5630905120393344806, guid: 70e77cdd333989d4193d3d85029d8cbe, type: 3}
|
||||||
lookDepth: 400
|
lookDepth: 400
|
||||||
cannonForce: 1000
|
cannonForce: 500
|
||||||
fireRate: 0.5
|
fireRate: 0.5
|
||||||
fireTimer: 0
|
fireTimer: 0
|
||||||
|
damage: 1
|
||||||
|
bullets: 1
|
||||||
--- !u!1 &6969840675949508920
|
--- !u!1 &6969840675949508920
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -315,7 +301,7 @@ BoxCollider:
|
|||||||
m_GameObject: {fileID: 6969840675949508920}
|
m_GameObject: {fileID: 6969840675949508920}
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_IsTrigger: 0
|
m_IsTrigger: 0
|
||||||
m_Enabled: 1
|
m_Enabled: 0
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Size: {x: 1, y: 1, z: 1}
|
m_Size: {x: 1, y: 1, z: 1}
|
||||||
m_Center: {x: 0, y: 0, z: 0}
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
|||||||
@ -14,7 +14,8 @@ GameObject:
|
|||||||
- component: {fileID: 8824810498392835647}
|
- component: {fileID: 8824810498392835647}
|
||||||
- component: {fileID: 1596552820235563576}
|
- component: {fileID: 1596552820235563576}
|
||||||
- component: {fileID: -5096460011673770898}
|
- component: {fileID: -5096460011673770898}
|
||||||
m_Layer: 0
|
- component: {fileID: 8618525506095844415}
|
||||||
|
m_Layer: 6
|
||||||
m_Name: Projectile
|
m_Name: Projectile
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
@ -128,3 +129,102 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
lifeTime: 1
|
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
|
||||||
|
|||||||
@ -141,22 +141,6 @@ PrefabInstance:
|
|||||||
m_Modification:
|
m_Modification:
|
||||||
m_TransformParent: {fileID: 0}
|
m_TransformParent: {fileID: 0}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
- target: {fileID: 297948476404860644, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchorMax.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 297948476404860644, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchorMin.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 297948476404860644, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 297948476404860644, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 430403745636601587, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
- target: {fileID: 430403745636601587, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
propertyPath: player
|
propertyPath: player
|
||||||
value:
|
value:
|
||||||
@ -165,110 +149,10 @@ PrefabInstance:
|
|||||||
propertyPath: player
|
propertyPath: player
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 1407792871}
|
objectReference: {fileID: 1407792871}
|
||||||
- target: {fileID: 3290620518113273233, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchorMax.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3290620518113273233, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchorMin.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3290620518113273233, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3290620518113273233, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3502347552248570395, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_IsActive
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3868787890645716629, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchorMax.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3868787890645716629, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchorMin.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3868787890645716629, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3868787890645716629, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4088869081495123135, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
- target: {fileID: 4088869081495123135, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
propertyPath: player
|
propertyPath: player
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 1407792871}
|
objectReference: {fileID: 1407792871}
|
||||||
- target: {fileID: 4637900801277279150, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchorMax.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4637900801277279150, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchorMin.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4637900801277279150, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4637900801277279150, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4864102413907297127, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchorMax.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4864102413907297127, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchorMin.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4864102413907297127, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4864102413907297127, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 6310781014458571912, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchorMax.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 6310781014458571912, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchorMin.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 6310781014458571912, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 6310781014458571912, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 6508712462537823371, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchorMax.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 6508712462537823371, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchorMin.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 6508712462537823371, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 6508712462537823371, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
propertyPath: m_Pivot.x
|
propertyPath: m_Pivot.x
|
||||||
value: 0
|
value: 0
|
||||||
@ -357,22 +241,10 @@ PrefabInstance:
|
|||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: Canvas_UI
|
value: Canvas_UI
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8145377689690508936, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
- target: {fileID: 7292790684055438790, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
propertyPath: m_AnchorMax.y
|
propertyPath: player
|
||||||
value: 0
|
value:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 1407792871}
|
||||||
- target: {fileID: 8145377689690508936, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchorMin.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 8145377689690508936, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 8145377689690508936, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
--- !u!1 &1966667440
|
--- !u!1 &1966667440
|
||||||
|
|||||||
@ -13,15 +13,18 @@ public class CannonScript : MonoBehaviour
|
|||||||
[SerializeField] private float fireRate = 0.5f;
|
[SerializeField] private float fireRate = 0.5f;
|
||||||
[SerializeField]private float fireTimer;
|
[SerializeField]private float fireTimer;
|
||||||
private bool firing = false;
|
private bool firing = false;
|
||||||
|
|
||||||
[SerializeField]private float damage = 1f;
|
[SerializeField]private float damage = 1f;
|
||||||
private Vector3 lookDir;
|
private Vector3 lookDir;
|
||||||
|
private Vector3[] offsets;
|
||||||
|
[SerializeField]private int bullets;
|
||||||
|
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
lookDir = Vector3.zero;
|
lookDir = Vector3.zero;
|
||||||
|
offsets = new Vector3[] {new Vector3(-0.1f, 0), new Vector3(0.1f, 0), new Vector3(0, -0.1f), new Vector3(0, 0.1f)};
|
||||||
|
bullets = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
@ -30,9 +33,7 @@ public class CannonScript : MonoBehaviour
|
|||||||
if(firing && !EventSystem.current.IsPointerOverGameObject()){
|
if(firing && !EventSystem.current.IsPointerOverGameObject()){
|
||||||
fireTimer += Time.deltaTime;
|
fireTimer += Time.deltaTime;
|
||||||
if(fireTimer >= fireRate){
|
if(fireTimer >= fireRate){
|
||||||
GameObject proj = Instantiate(projectile, transform.position, cannon.transform.rotation);
|
Fire();
|
||||||
proj.GetComponent<Projectile>().SetDamage(damage);
|
|
||||||
proj.GetComponent<Rigidbody>().AddForce(cannonForce * lookDir, ForceMode.Impulse);
|
|
||||||
fireTimer = 0;
|
fireTimer = 0;
|
||||||
|
|
||||||
RaycastHit hit;
|
RaycastHit hit;
|
||||||
@ -54,6 +55,21 @@ public class CannonScript : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Fire(){
|
||||||
|
GameObject proj = Instantiate(projectile, cannon.transform.position, cannon.transform.rotation);
|
||||||
|
proj.GetComponent<Projectile>().SetDamage(damage);
|
||||||
|
proj.GetComponent<Rigidbody>().AddForce(cannonForce * lookDir, ForceMode.Impulse);
|
||||||
|
if(bullets > 1){
|
||||||
|
//Pick random offset from lookDir
|
||||||
|
for (int i = 0; i < bullets-1; i++)
|
||||||
|
{
|
||||||
|
proj = Instantiate(projectile, cannon.transform.position, cannon.transform.rotation);
|
||||||
|
proj.GetComponent<Projectile>().SetDamage(damage);
|
||||||
|
proj.GetComponent<Rigidbody>().AddForce(cannonForce * (lookDir+offsets[i]), ForceMode.Impulse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Vector3 GetMouseWorldPosition(){
|
private Vector3 GetMouseWorldPosition(){
|
||||||
Vector3 screenPos = Mouse.current.position.ReadValue();
|
Vector3 screenPos = Mouse.current.position.ReadValue();
|
||||||
screenPos.z = lookDepth;
|
screenPos.z = lookDepth;
|
||||||
@ -95,4 +111,12 @@ public class CannonScript : MonoBehaviour
|
|||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetBullets(int nBullets){
|
||||||
|
this.bullets = nBullets;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetBullets(){
|
||||||
|
return bullets;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,10 @@ public class PlayerController : MonoBehaviour
|
|||||||
public void UpgradeDamage(DamageUpgrade upgrade){
|
public void UpgradeDamage(DamageUpgrade upgrade){
|
||||||
cannon.SetDamage(upgrade.GetDamage());
|
cannon.SetDamage(upgrade.GetDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpgradeBullets(BulletsAmountUpgrade upgrade){
|
||||||
|
cannon.SetBullets(upgrade.GetBullets());
|
||||||
|
}
|
||||||
|
|
||||||
public float GetPoints(){
|
public float GetPoints(){
|
||||||
return points;
|
return points;
|
||||||
|
|||||||
27
Assets/Scripts/Upgrades/BulletsAmountUpgrade.cs
Normal file
27
Assets/Scripts/Upgrades/BulletsAmountUpgrade.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class BulletsAmountUpgrade : Upgrade
|
||||||
|
{
|
||||||
|
[SerializeField]private int[] amounts;
|
||||||
|
public BulletsAmountUpgrade(string name, float[] cost, int[] amounts){
|
||||||
|
this.cost = cost;
|
||||||
|
this.upgradeName = name;
|
||||||
|
this.amounts = amounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetBullets(int[] nAmounts){
|
||||||
|
this.amounts = nAmounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetBullets(){
|
||||||
|
return amounts[lvlUnlocked-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Activate(){
|
||||||
|
if(base.UpgradeAttempt()){
|
||||||
|
player.UpgradeBullets(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Upgrades/BulletsAmountUpgrade.cs.meta
Normal file
11
Assets/Scripts/Upgrades/BulletsAmountUpgrade.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fb3bb30d2ff91fd48b3e6b3a8dfaab05
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -21,11 +21,16 @@ public abstract class Upgrade : MonoBehaviour
|
|||||||
costTxt.text = cost[lvlUnlocked].ToString();
|
costTxt.text = cost[lvlUnlocked].ToString();
|
||||||
}
|
}
|
||||||
private void Update() {
|
private void Update() {
|
||||||
// if(EventSystem.current.IsPointerOverGameObject()){
|
}
|
||||||
// hoverObj.SetActive(true);
|
|
||||||
// }else{
|
public void OnPointerEnter(){
|
||||||
// hoverObj.SetActive(false);
|
if(lvlUnlocked < imgs.Length){
|
||||||
// }
|
hoverObj.SetActive(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnPointerExit(){
|
||||||
|
hoverObj.SetActive(false);
|
||||||
}
|
}
|
||||||
public float GetCost(){
|
public float GetCost(){
|
||||||
return cost[lvlUnlocked];
|
return cost[lvlUnlocked];
|
||||||
|
|||||||
@ -7,6 +7,7 @@ PhysicsManager:
|
|||||||
m_Gravity: {x: 0, y: -9.81, z: 0}
|
m_Gravity: {x: 0, y: -9.81, z: 0}
|
||||||
m_DefaultMaterial: {fileID: 0}
|
m_DefaultMaterial: {fileID: 0}
|
||||||
m_BounceThreshold: 2
|
m_BounceThreshold: 2
|
||||||
|
m_DefaultMaxDepenetrationVelocity: 10
|
||||||
m_SleepThreshold: 0.005
|
m_SleepThreshold: 0.005
|
||||||
m_DefaultContactOffset: 0.01
|
m_DefaultContactOffset: 0.01
|
||||||
m_DefaultSolverIterations: 6
|
m_DefaultSolverIterations: 6
|
||||||
@ -17,7 +18,7 @@ PhysicsManager:
|
|||||||
m_ClothInterCollisionDistance: 0.1
|
m_ClothInterCollisionDistance: 0.1
|
||||||
m_ClothInterCollisionStiffness: 0.2
|
m_ClothInterCollisionStiffness: 0.2
|
||||||
m_ContactsGeneration: 1
|
m_ContactsGeneration: 1
|
||||||
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffbfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||||
m_AutoSimulation: 1
|
m_AutoSimulation: 1
|
||||||
m_AutoSyncTransforms: 0
|
m_AutoSyncTransforms: 0
|
||||||
m_ReuseCollisionCallbacks: 1
|
m_ReuseCollisionCallbacks: 1
|
||||||
@ -32,5 +33,6 @@ PhysicsManager:
|
|||||||
m_FrictionType: 0
|
m_FrictionType: 0
|
||||||
m_EnableEnhancedDeterminism: 0
|
m_EnableEnhancedDeterminism: 0
|
||||||
m_EnableUnifiedHeightmaps: 1
|
m_EnableUnifiedHeightmaps: 1
|
||||||
|
m_ImprovedPatchFriction: 0
|
||||||
m_SolverType: 0
|
m_SolverType: 0
|
||||||
m_DefaultMaxAngularSpeed: 50
|
m_DefaultMaxAngularSpeed: 50
|
||||||
|
|||||||
@ -12,7 +12,7 @@ TagManager:
|
|||||||
-
|
-
|
||||||
- Water
|
- Water
|
||||||
- UI
|
- UI
|
||||||
-
|
- Projectile
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user