Commit 77b171dc authored by Markus Schlösser's avatar Markus Schlösser
Browse files

Updated Cannon

parent 3b29b1f1
......@@ -52,7 +52,6 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 4205805952014266}
- component: {fileID: 212810178329633298}
m_Layer: 0
m_Name: Cannon
m_TagString: Untagged
......@@ -100,14 +99,14 @@ Transform:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1263581091867116}
m_LocalRotation: {x: 0, y: 0, z: 0.2588191, w: 0.9659258}
m_LocalPosition: {x: -0.27, y: 0, z: 0}
m_LocalRotation: {x: -0, y: -0, z: 0.9999231, w: -0.01240204}
m_LocalPosition: {x: -0.27000046, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4468318558309648}
m_Father: {fileID: 4205805952014266}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 30}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 181.42099}
--- !u!4 &4205805952014266
Transform:
m_ObjectHideFlags: 1
......@@ -115,8 +114,8 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1320188170728490}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalPosition: {x: 10.559809, y: 7.586144, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_Children:
- {fileID: 4515523674784162}
- {fileID: 4266236885723778}
......@@ -267,8 +266,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingLayerID: -1398306507
m_SortingLayer: 3
m_SortingOrder: 1
m_Sprite: {fileID: 21300000, guid: 33ecf2ae4e3a2644bbed70e0c499ad5d, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
......@@ -313,8 +312,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingLayerID: -1398306507
m_SortingLayer: 3
m_SortingOrder: -1
m_Sprite: {fileID: 21300000, guid: 18bc6232e653f8f44965c2d0a6eed5cf, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
......@@ -359,8 +358,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingLayerID: -1398306507
m_SortingLayer: 3
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 14cd72156ec4da5408968db87210c7e9, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
......@@ -373,49 +372,3 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!212 &212810178329633298
SpriteRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1320188170728490}
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: 0}
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: 0
m_MaskInteraction: 0
m_SpriteSortPoint: 0
......@@ -20,11 +20,11 @@ GameObject:
m_Component:
- component: {fileID: 4022861657979210}
- component: {fileID: 114171645190117040}
- component: {fileID: 135114356276358670}
- component: {fileID: 54475760065213980}
- component: {fileID: 50078183061319852}
- component: {fileID: 58124603981785314}
- component: {fileID: 212421403893095872}
- component: {fileID: 95399040166875056}
m_Layer: 0
m_Layer: 11
m_Name: ProjektilPrefab
m_TagString: Untagged
m_Icon: {fileID: 0}
......@@ -38,27 +38,47 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1087194835788670}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 6.81, y: 6.71, 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 &54475760065213980
Rigidbody:
--- !u!50 &50078183061319852
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1087194835788670}
serializedVersion: 2
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0
m_UseGravity: 0
m_IsKinematic: 0
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 0
m_Material: {fileID: 0}
m_Interpolate: 0
m_Constraints: 120
m_SleepingMode: 1
m_CollisionDetection: 1
m_Constraints: 0
--- !u!58 &58124603981785314
CircleCollider2D:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1087194835788670}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: -0.3}
serializedVersion: 2
m_Radius: 0.75
--- !u!95 &95399040166875056
Animator:
serializedVersion: 3
......@@ -88,18 +108,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 9ab36b54f09296e4c90a725b52b5fe36, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!135 &135114356276358670
SphereCollider:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1087194835788670}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.83549196
m_Center: {x: 0.038915217, y: -0.2285096, z: 0}
--- !u!212 &212421403893095872
SpriteRenderer:
m_ObjectHideFlags: 1
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CannonController : MonoBehaviour
{
public GameObject cannonBarrel;
public GameObject fire;
private GameObject currentFire;
private float cooldown;
using UnityEngine;
public class CannonController : MonoBehaviour {
[SerializeField] private GameObject cannonBarrel;
[SerializeField] private GameObject fire;
[SerializeField] private float shotsPerSeconds;
[SerializeField] private float speed = 10f;
[SerializeField] private Animator anim;
[SerializeField] private Animator animRadVorne;
[SerializeField] private Animator animRadHinten;
void FixedUpdate ()
{
if (cooldown <= 0)
{
private float cooldown;
private void FixedUpdate () {
if (cooldown <= 0) {
anim.SetTrigger("Fire");
animRadVorne.SetTrigger("Fire");
animRadHinten.SetTrigger("Fire");
}
else
{
} else {
cooldown = Mathf.Max(0, cooldown - Time.deltaTime);
}
}
public void Fire()
{
currentFire = Instantiate(fire, cannonBarrel.transform.Find("FirePoint").position, cannonBarrel.transform.rotation);
public void Fire() {
GameObject obj = Instantiate(fire, cannonBarrel.transform.Find("FirePoint").position, cannonBarrel.transform.rotation);
cooldown = 1f / (shotsPerSeconds);
// Drehung
currentFire.transform.rotation = Quaternion.Euler(0, 0, 90) * cannonBarrel.transform.rotation;
obj.transform.rotation = Quaternion.Euler(0, 0, 90) * cannonBarrel.transform.rotation;
obj.transform.localScale = transform.lossyScale;
// Flugrichtung
currentFire.GetComponent<Rigidbody>().velocity = cannonBarrel.transform.right * speed;
obj.GetComponent<Rigidbody2D>().velocity = cannonBarrel.transform.right * speed;
}
}
using UnityEngine;
public class ProjektilController : MonoBehaviour {
private void OnTriggerEnter2D(Collider2D other) {
Destroy(gameObject);
private const float MAX_LIFETIME = 15.0f;
private float lifetime;
private void Update() {
if (lifetime > MAX_LIFETIME) {
Destroy(gameObject);
}
lifetime += Time.deltaTime;
}
void OnBecameInvisible() {
private void OnTriggerEnter2D(Collider2D other) {
Destroy(gameObject);
}
}
......@@ -228,7 +228,8 @@ GameObject:
- component: {fileID: 185498793}
- component: {fileID: 185498795}
- component: {fileID: 185498794}
m_Layer: 0
- component: {fileID: 185498796}
m_Layer: 12
m_Name: Tilemap
m_TagString: Untagged
m_Icon: {fileID: 0}
......@@ -832,6 +833,61 @@ Tilemap:
e31: 0
e32: 0
e33: 1
--- !u!19719996 &185498796
TilemapCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 185498792}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
--- !u!1001 &481979089
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4205805952014266, guid: 9a0e64aef26033945a369820bc065ae1, type: 2}
propertyPath: m_LocalPosition.x
value: 10.559809
objectReference: {fileID: 0}
- target: {fileID: 4205805952014266, guid: 9a0e64aef26033945a369820bc065ae1, type: 2}
propertyPath: m_LocalPosition.y
value: 7.586144
objectReference: {fileID: 0}
- target: {fileID: 4205805952014266, guid: 9a0e64aef26033945a369820bc065ae1, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4205805952014266, guid: 9a0e64aef26033945a369820bc065ae1, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4205805952014266, guid: 9a0e64aef26033945a369820bc065ae1, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4205805952014266, guid: 9a0e64aef26033945a369820bc065ae1, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4205805952014266, guid: 9a0e64aef26033945a369820bc065ae1, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4205805952014266, guid: 9a0e64aef26033945a369820bc065ae1, type: 2}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9a0e64aef26033945a369820bc065ae1, type: 2}
m_IsPrefabAsset: 0
--- !u!1001 &548994838
Prefab:
m_ObjectHideFlags: 0
......@@ -990,7 +1046,7 @@ Transform:
- {fileID: 33844461}
- {fileID: 1823310274}
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1713065486
GameObject:
......@@ -1031,7 +1087,7 @@ Transform:
m_Children:
- {fileID: 185498793}
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1760847112
GameObject:
......@@ -1097,7 +1153,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1823310273
GameObject:
......
......@@ -52,4 +52,4 @@ Physics2DSettings:
m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432}
m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745}
m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804}
m_LayerCollisionMatrix: c8f0ffffc8f0ffffc8f0ffffffffffffc8f0ffffc8f0ffffffffffffffffffffc8f0ffffc8fcffffc8f2ffffc8f2ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_LayerCollisionMatrix: c8e0ffffc8e0ffffc8e0ffffffffffffc8e0ffffc8e0ffffffffffffffffffffc8e0ffffc8ecffffc8e2ffffc8f2ffffc8e8ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
......@@ -19,7 +19,7 @@ TagManager:
- Player
- Interactible
- Hazard
-
- Enviroment
-
-
-
......
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