Commit 93a690f1 authored by Jan Meissner's avatar Jan Meissner
Browse files

Fixed cannon fire rate, deactivated wheels in prefab for now

parent c2f212de
......@@ -75,7 +75,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!1 &1797984525371050
GameObject:
m_ObjectHideFlags: 0
......@@ -92,7 +92,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &4060432582790156
Transform:
m_ObjectHideFlags: 1
......@@ -114,7 +114,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1320188170728490}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 10.559809, y: 7.586144, z: 0}
m_LocalPosition: {x: 8.352831, y: 5.726805, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_Children:
- {fileID: 4515523674784162}
......@@ -229,7 +229,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
cannonBarrel: {fileID: 1263581091867116}
fire: {fileID: 1087194835788670, guid: 3fd0675fac3d4794aafbb72c8557c635, type: 2}
shotsPerSeconds: 1
fireDelay: 3
speed: 10
anim: {fileID: 95144805117775786}
animRadVorne: {fileID: 95645392377643954}
......@@ -267,7 +267,7 @@ SpriteRenderer:
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: -1398306507
m_SortingLayer: 3
m_SortingLayer: 2
m_SortingOrder: 1
m_Sprite: {fileID: 21300000, guid: 33ecf2ae4e3a2644bbed70e0c499ad5d, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
......@@ -313,7 +313,7 @@ SpriteRenderer:
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: -1398306507
m_SortingLayer: 3
m_SortingLayer: 2
m_SortingOrder: -1
m_Sprite: {fileID: 21300000, guid: 18bc6232e653f8f44965c2d0a6eed5cf, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
......@@ -359,7 +359,7 @@ SpriteRenderer:
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: -1398306507
m_SortingLayer: 3
m_SortingLayer: 2
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 14cd72156ec4da5408968db87210c7e9, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
......
......@@ -24,7 +24,7 @@ GameObject:
- component: {fileID: 114278390851417200}
m_Layer: 5
m_Name: ButtonLevel6
m_TagString: Untagged
m_TagString: LevelSelectButton
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......@@ -42,7 +42,7 @@ GameObject:
- component: {fileID: 114452089097139982}
m_Layer: 5
m_Name: ButtonLevel2
m_TagString: Untagged
m_TagString: LevelSelectButton
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......@@ -129,7 +129,7 @@ GameObject:
- component: {fileID: 114062728889777862}
m_Layer: 5
m_Name: ButtonLevel4
m_TagString: Untagged
m_TagString: LevelSelectButton
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......@@ -198,7 +198,7 @@ GameObject:
- component: {fileID: 114213221181718958}
m_Layer: 5
m_Name: ButtonLevel3
m_TagString: Untagged
m_TagString: LevelSelectButton
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......@@ -216,7 +216,7 @@ GameObject:
- component: {fileID: 114022118665858536}
m_Layer: 5
m_Name: ButtonLevel1
m_TagString: Untagged
m_TagString: LevelSelectButton
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......@@ -285,7 +285,7 @@ GameObject:
- component: {fileID: 114483044046335424}
m_Layer: 5
m_Name: ButtonLevel5
m_TagString: Untagged
m_TagString: LevelSelectButton
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......@@ -806,20 +806,9 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_MethodName: SetActive
m_Mode: 6
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 1
m_CallState: 2
- m_Target: {fileID: 1953451430673868}
m_MethodName: SetActive
m_Mode: 6
- m_Target: {fileID: 114648169760389806}
m_MethodName: ShowPrevPage
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
......@@ -1474,9 +1463,9 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1953451430673868}
m_MethodName: SetActive
m_Mode: 6
- m_Target: {fileID: 114648169760389806}
m_MethodName: ShowNextPage
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
......@@ -1485,17 +1474,6 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 0}
m_MethodName: SetActive
m_Mode: 6
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 1
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &114386035575398286
......
......@@ -140,8 +140,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingLayerID: 1483109359
m_SortingLayer: 4
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: d3d269b56963fe24394615804bf332db, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
......
......@@ -3,27 +3,21 @@
public class CannonController : MonoBehaviour, IResetable {
[SerializeField] private GameObject cannonBarrel;
[SerializeField] private GameObject fire;
[SerializeField] private float shotsPerSeconds;
[SerializeField] private float fireDelay;
[SerializeField] private float speed = 10f;
[SerializeField] private Animator anim;
[SerializeField] private Animator animRadVorne;
[SerializeField] private Animator animRadHinten;
private float cooldown;
private void FixedUpdate () {
if (cooldown <= 0) {
anim.SetTrigger("Fire");
animRadVorne.SetTrigger("Fire");
animRadHinten.SetTrigger("Fire");
} else {
cooldown = Mathf.Max(0, cooldown - Time.deltaTime);
}
private void Start()
{
InvokeRepeating("FireCannon", 0.0f, fireDelay);
}
public void Fire() {
public void FireCannon() {
anim.SetTrigger("Fire");
GameObject obj = Instantiate(fire, cannonBarrel.transform.Find("FirePoint").position, cannonBarrel.transform.rotation);
cooldown = 1f / (shotsPerSeconds);
// Drehung
obj.transform.rotation = Quaternion.Euler(0, 0, 90) * cannonBarrel.transform.rotation;
obj.transform.localScale = transform.lossyScale;
......@@ -32,6 +26,6 @@ public class CannonController : MonoBehaviour, IResetable {
}
public void ResetToLevelBegin() {
cooldown = 0;
}
}
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