From 848097c88bbcf24934a375dff39cf4defa2819dd Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Thu, 4 May 2023 11:25:52 +0800 Subject: *misc --- marching/Assets/Scripts/Projectiles/BladeScript.cs | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 marching/Assets/Scripts/Projectiles/BladeScript.cs (limited to 'marching/Assets/Scripts/Projectiles/BladeScript.cs') 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(); + } + } + + 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; + } + +} -- cgit v1.1-26-g67d0