Commit deaed16e authored by Jan Meissner's avatar Jan Meissner

Merge remote-tracking branch 'origin/master'

parents 4ed3edd4 3bf91d46
......@@ -103,10 +103,12 @@ MonoBehaviour:
cannonBarrel: {fileID: 1682295116660206}
fire: {fileID: 1087194835788670, guid: 3fd0675fac3d4794aafbb72c8557c635, type: 2}
fireDelay: 1
phase: 0
speed: 7
anim: {fileID: 95962382210488100}
animRadVorne: {fileID: 0}
animRadHinten: {fileID: 0}
ignoreEnviroment: 1
--- !u!212 &212468767237705114
SpriteRenderer:
m_ObjectHideFlags: 1
......
This diff is collapsed.
fileFormatVersion: 2
guid: 7d76a63dfd317814d9eef925c0df39c7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 7302d929ac7a2f44180b44e09592ac8a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -9,6 +9,7 @@ public class CannonController : MonoBehaviour, IResetable {
[SerializeField] private Animator anim;
[SerializeField] private Animator animRadVorne;
[SerializeField] private Animator animRadHinten;
[SerializeField] private bool ignoreEnviroment;
private Coroutine co;
......@@ -36,6 +37,7 @@ public class CannonController : MonoBehaviour, IResetable {
obj.transform.localScale = transform.lossyScale;
// Flugrichtung
obj.GetComponent<Rigidbody2D>().velocity = cannonBarrel.transform.right * speed;
obj.GetComponent<ProjektilController>().ignoreEnviroment = ignoreEnviroment;
}
public void ResetToLevelBegin() {
......
......@@ -40,6 +40,5 @@ public class InteractibleLever : MonoBehaviour, IInteractible, IResetable {
public void ResetToLevelBegin() {
state = isActive;
UpdateSprite();
}
}
......@@ -2,7 +2,9 @@
using UnityEngine;
using NaughtyAttributes;
public class LaserController : MonoBehaviour {
public class LaserController : MonoBehaviour, IResetable {
[SerializeField] private bool isActive = true;
[SerializeField] private Sprite active;
[SerializeField] private Sprite inactive;
......@@ -11,6 +13,12 @@ public class LaserController : MonoBehaviour {
[SerializeField] private List<SpriteRenderer> laserRenderer;
[SerializeField] private List<Collider2D> lasercollider;
private bool state;
private void Awake() {
state = isActive;
}
public void SetState(bool value) {
foreach (SpriteRenderer r in endpoints) {
r.sprite = value ? active : inactive;
......@@ -23,14 +31,16 @@ public class LaserController : MonoBehaviour {
foreach (Collider2D c in lasercollider) {
c.enabled = value;
}
state = value;
}
[Button]
public void ToggleState() {
if (laserRenderer[0] == null) return;
bool state = laserRenderer[0].enabled;
SetState(!state);
}
public void ResetToLevelBegin() {
SetState(isActive);
}
}
......@@ -2,6 +2,8 @@
public class ProjektilController : MonoBehaviour, IResetable {
public bool ignoreEnviroment;
private const float MAX_LIFETIME = 15.0f;
private float lifetime;
......@@ -15,6 +17,9 @@ public class ProjektilController : MonoBehaviour, IResetable {
}
private void OnTriggerEnter2D(Collider2D other) {
// Don't destroy on contact with enviroment if set to ignore
if (other.gameObject.layer == 12 && ignoreEnviroment) return;
Destroy(gameObject);
}
......
......@@ -39,6 +39,5 @@ public class TimedToggle : MonoBehaviour, IResetable {
public void ResetToLevelBegin() {
state = isActive;
time = 0;
onStateChange.Invoke(isActive);
}
}
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