public static void Create(GameObject obj, GameObject StunnedObj, float StunnedTime) { var SE_Obj = obj.GetComponent <StatusEffect_Object>(); if (SE_Obj is null) { return; } StatusEffect_Stunned SE_Stunned = obj.GetComponent <StatusEffect_Stunned>(); // 각 상태이상에 대한 초기화 설정을 해준다. if (SE_Stunned.IsNull()) { SE_Stunned = obj.AddComponent <StatusEffect_Stunned>(); SE_Stunned.destroy_timer = new YCTimerData(StunnedTime, () => Destroy(SE_Stunned)); } // 우선 순위 설정 높을수록 우선순위가 높음. SE_Stunned.priority = 10; SE_Stunned.StunnedObj = StunnedObj; StunnedObj.SetActive(true); YCTimer.Add(SE_Stunned.destroy_timer); }
void start_spawn() { foreach (var i in spawners) { i.Spawn(new Vector2(Random.Range(spawn_xpos_ranges.min, spawn_xpos_ranges.max), y)); } YCTimer.Add(new YCTimerData(Random.Range(spawn_rate.min, spawn_rate.max), start_spawn)); }
//public static void CreateNormal(GameObject o, Vector2 d) => Create(o, d, 3, 0.5f); //public static void CreateSuper(GameObject o, Vector2 d) => Create(o, d, 4, 0.5f); public static void Create(GameObject obj, Vector2 dir, AnimationCurve power) { var SE_Obj = obj.GetComponent <StatusEffect_Object>(); if (SE_Obj is null) { return; } StatusEffect_Knokback knokback = obj.GetComponent <StatusEffect_Knokback>(); if (knokback.IsNull()) { knokback = obj.AddComponent <StatusEffect_Knokback>(); knokback.destroy_timer = new YCTimerData(power.keys[power.length - 1].time, () => Destroy(knokback)); } knokback.priority = 9; knokback.mDir2d = dir; knokback.pow = power; YCTimer.Add(knokback.destroy_timer); }
private void Start() { YCTimer.Add(new YCTimerData(Random.Range(spawn_rate.min, spawn_rate.max), start_spawn)); }