Commit efac3570 authored by Jan Meissner's avatar Jan Meissner
Browse files

Fixed various cannon related bugs

parent c78599d4
......@@ -60,26 +60,6 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1369319522436270
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 4439103326679612}
- component: {fileID: 114347105395272648}
- component: {fileID: 135608683392948086}
- component: {fileID: 54292225418600956}
- component: {fileID: 212303751120566804}
- component: {fileID: 95418171940380622}
m_Layer: 0
m_Name: Projektil
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!1 &1560975367157764
GameObject:
m_ObjectHideFlags: 0
......@@ -119,14 +99,14 @@ Transform:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1263581091867116}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: 0, y: 0, z: 0.2588191, w: 0.9659258}
m_LocalPosition: {x: -0.27, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4468318558309648}
m_Father: {fileID: 4205805952014266}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 30}
--- !u!4 &4205805952014266
Transform:
m_ObjectHideFlags: 1
......@@ -137,7 +117,6 @@ Transform:
m_LocalPosition: {x: 0, y: 0, z: -5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4439103326679612}
- {fileID: 4515523674784162}
- {fileID: 4266236885723778}
- {fileID: 4060432582790156}
......@@ -155,20 +134,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4205805952014266}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4439103326679612
Transform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1369319522436270}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -1.05, y: 0.45999998, z: -0.0046892166}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4205805952014266}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4468318558309648
Transform:
......@@ -194,23 +160,8 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4205805952014266}
m_RootOrder: 1
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!54 &54292225418600956
Rigidbody:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1369319522436270}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 120
m_CollisionDetection: 1
--- !u!95 &95144805117775786
Animator:
serializedVersion: 3
......@@ -229,24 +180,6 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!95 &95418171940380622
Animator:
serializedVersion: 3
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1369319522436270}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: 2e0f638e1d17dd34db46b8c2e3738fea, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!95 &95645392377643954
Animator:
serializedVersion: 3
......@@ -277,33 +210,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
cannonBarrel: {fileID: 1263581091867116}
firePrefab: {fileID: 1354393239555122, guid: 3fd0675fac3d4794aafbb72c8557c635, type: 2}
fire: {fileID: 1087194835788670, guid: 3fd0675fac3d4794aafbb72c8557c635, type: 2}
shotsPerSeconds: 1
speed: 10
anim: {fileID: 95144805117775786}
--- !u!114 &114347105395272648
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1369319522436270}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9ab36b54f09296e4c90a725b52b5fe36, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!135 &135608683392948086
SphereCollider:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1369319522436270}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5
m_Center: {x: 0, y: 0, z: 0}
--- !u!212 &212085445371616958
SpriteRenderer:
m_ObjectHideFlags: 1
......@@ -396,52 +306,6 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!212 &212303751120566804
SpriteRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1369319522436270}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: d3d269b56963fe24394615804bf332db, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 2.56, y: 2.56}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!212 &212375044863857432
SpriteRenderer:
m_ObjectHideFlags: 1
......
......@@ -9,21 +9,21 @@ Prefab:
m_Modifications: []
m_RemovedComponents: []
m_SourcePrefab: {fileID: 0}
m_RootGameObject: {fileID: 1354393239555122}
m_RootGameObject: {fileID: 1087194835788670}
m_IsPrefabAsset: 1
--- !u!1 &1354393239555122
--- !u!1 &1087194835788670
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 4529839994627478}
- component: {fileID: 114100107669872396}
- component: {fileID: 135522358143010986}
- component: {fileID: 54249513922297938}
- component: {fileID: 212435128645792768}
- component: {fileID: 95421190295657996}
- component: {fileID: 4022861657979210}
- component: {fileID: 114171645190117040}
- component: {fileID: 135114356276358670}
- component: {fileID: 54475760065213980}
- component: {fileID: 212421403893095872}
- component: {fileID: 95399040166875056}
m_Layer: 0
m_Name: Projektil
m_TagString: Untagged
......@@ -31,25 +31,25 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4529839994627478
--- !u!4 &4022861657979210
Transform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1354393239555122}
m_GameObject: {fileID: 1087194835788670}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -1.05, y: 0.45999998, z: -0.0046892166}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!54 &54249513922297938
--- !u!54 &54475760065213980
Rigidbody:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1354393239555122}
m_GameObject: {fileID: 1087194835788670}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
......@@ -59,13 +59,13 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 120
m_CollisionDetection: 1
--- !u!95 &95421190295657996
--- !u!95 &95399040166875056
Animator:
serializedVersion: 3
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1354393239555122}
m_GameObject: {fileID: 1087194835788670}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: 2e0f638e1d17dd34db46b8c2e3738fea, type: 2}
......@@ -77,36 +77,35 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!114 &114100107669872396
--- !u!114 &114171645190117040
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1354393239555122}
m_GameObject: {fileID: 1087194835788670}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9ab36b54f09296e4c90a725b52b5fe36, type: 3}
m_Name:
m_EditorClassIdentifier:
speed: 20
--- !u!135 &135522358143010986
--- !u!135 &135114356276358670
SphereCollider:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1354393239555122}
m_GameObject: {fileID: 1087194835788670}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5
m_Center: {x: 0, y: 0, z: 0}
--- !u!212 &212435128645792768
m_Radius: 0.83549196
m_Center: {x: 0.038915217, y: -0.2285096, z: 0}
--- !u!212 &212421403893095872
SpriteRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1354393239555122}
m_GameObject: {fileID: 1087194835788670}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
......
......@@ -5,12 +5,12 @@ using UnityEngine;
public class CannonController : MonoBehaviour
{
public GameObject cannonBarrel;
public GameObject firePrefab;
public GameObject fire;
private GameObject currentFire;
public float shotsPerSeconds;
private float cooldown;
public float speed = 10f;
[SerializeField] private float shotsPerSeconds;
[SerializeField] private float speed = 10f;
[SerializeField] private Animator anim;
void FixedUpdate ()
......@@ -27,7 +27,7 @@ public class CannonController : MonoBehaviour
public void Fire()
{
currentFire = Instantiate(firePrefab, cannonBarrel.transform.position, cannonBarrel.transform.rotation);
currentFire = Instantiate(fire, cannonBarrel.transform.position, cannonBarrel.transform.rotation);
cooldown = 1f / (shotsPerSeconds);
// Drehung
currentFire.transform.rotation = Quaternion.Euler(0, 0, 90) * cannonBarrel.transform.rotation;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment