/* * public override GameObject SetTrigger(s_map.s_trig trigger) * { * GameObject trigObj = null; * Vector2 pos = new Vector2(trigger.pos_x, trigger.pos_y); * * trigObj = SpawnObject<s_object>(FindOBJ("trigger"), pos, Quaternion.identity).gameObject; * trigObj.transform.SetParent(triggersObj.transform); * o_trigger trig = trigObj.GetComponent<o_trigger>(); * s_utility util = null; * if (trig == null) * util = trigObj.GetComponent<s_utility>(); * * if (trig != null) * { * trig.ev_num = 0; //TODO: IF THE TRIGGER DOES NOT STATICALLY STORE ITS EVENT NUMBER, SET IT TO 0 * * if (trigger.name != "") * trig.name = trigger.name; * trig.isactive = false; * trig.TRIGGER_T = trigger.trigtye; * trig.LabelToJumpTo = trigger.labelToJumpTo; * //trig.TRIGGER_T = mapdat.triggerdata[i].trigtye; * * s_save_vector ve = trigger.trigSize; * * trig.GetComponent<BoxCollider2D>().size = new Vector2(ve.x, ve.y); * * trig.transform.SetParent(trig.transform); * } * else if (util != null) * { * if (trigger.name != "") * util.name = trigger.name; * util.istriggered = false; * //trig.TRIGGER_T = mapdat.triggerdata[i].trigtye; * * s_save_vector ve = trigger.trigSize; * * if (trigger.util != "u_boundary") * util.GetComponent<BoxCollider2D>().size = new Vector2(ve.x, ve.y); * * util.transform.SetParent(util.transform); * } * return trigObj; * } */ public override GameObject SetTrigger(s_map.s_trig trigger) { GameObject trigObj = null; Vector2 pos = new Vector2(trigger.pos_x, trigger.pos_y); if (!InEditor) { trigObj = SpawnObject <s_object>("trigger", pos, Quaternion.identity).gameObject; } else { trigObj = Instantiate(FindOBJ("trigger"), new Vector3(trigger.pos_x, trigger.pos_y), Quaternion.identity); } trigObj.transform.SetParent(triggersObj.transform); o_trigger trig = trigObj.GetComponent <o_trigger>(); if (trig != null) { if (trigger.name != "") { trig.name = trigger.name; } trig.isactive = false; trig.TRIGGER_T = trigger.trigtye; trig.LabelToJumpTo = trigger.labelToJumpTo; s_save_vector ve = trigger.trigSize; trig.GetComponent <BoxCollider2D>().size = new Vector2(ve.x, ve.y); trig.transform.SetParent(trig.transform); } return(trigObj); }
public override void OnInspectorGUI() { if (mapdat == null) { mapdat = GameObject.Find("General").GetComponent <s_leveledit>(); } o_trigger tra = (o_trigger)target; base.OnInspectorGUI(); for (int i = 0; i < Labelmap().Count; i++) { if (GUILayout.Button(Labelmap()[i].Item1)) { tra.LabelToJumpTo = Labelmap()[i].Item2; } } }
public override s_map.s_trig AddTrigger(o_trigger obj) { return(new s_map.s_trig(obj.transform.localScale)); }