diff options
Diffstat (limited to 'marching/Assets/Scripts/Projectiles/BladeScript.cs')
-rw-r--r-- | marching/Assets/Scripts/Projectiles/BladeScript.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/marching/Assets/Scripts/Projectiles/BladeScript.cs b/marching/Assets/Scripts/Projectiles/BladeScript.cs new file mode 100644 index 0000000..f5f613c --- /dev/null +++ b/marching/Assets/Scripts/Projectiles/BladeScript.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class BladeScript : ProjectileBase +{ + [NonSerialized] public float life; + + + private SpriteRenderer sr + { + get + { + return this.gameObject.GetComponent<SpriteRenderer>(); + } + } + + public void Start() + { + Invoke("DestroySelf", life); + } + + void DestroySelf() + { + Destroy(this.gameObject); + } + + public void Update() + { + Color c = sr.color; + c.a *= 0.99f; + sr.color = c; + } + + public void SetFlip(bool flip) + { + sr.flipX = flip; + } + +} |