public List <ScrollObject> GetScrolls(int vertexCount, int segmentedAddress, ScrollingTextureDescription std) { List <ScrollObject> scrolls = new List <ScrollObject>(); ScrollObject scr = Fetch(); int size = std.GetTileSizeForScroll(); int minSpeed = 0x400 / size; /* * if (std.scroll.speed >= minSpeed) * { * scrolls.Add(new TextureScroll(std.f2SegmentedAddress, * (byte) (std.scroll.speed * size / 0x40), std.scroll.acts, std.scroll.axis, * f2ScrollBehaviour, scr.romOffset)); * } * else */ { scrolls.Add(new EditorScroll(vertexCount, segmentedAddress, std.scroll.speed, std.scroll.acts, std.scroll.axis, editorScrollBehaviour, scr.romOffset)); } return(scrolls); }
private string CreateFAKEJson() { string name = "LOL"; string mac = "sdfgsdfgsdfg"; string name2 = "LOLOL"; string MAC2 = "zgfzsdhgfxcvbn"; ScrollObject obj1 = new ScrollObject(); obj1.Name = name; obj1.MAC = mac; ScrollObject obj2 = new ScrollObject(); obj2.Name = name2; obj2.MAC = MAC2; ScrollArray jsonArray = new ScrollArray(); jsonArray.Devices.Add(obj1); jsonArray.Devices.Add(obj2); return(JsonUtility.ToJson(jsonArray, true)); }
ScrollObject Fetch() { ScrollObject scr = scrollers[0]; scrollers.Remove(scr); return(scr); }
/// <summary> /// 获取一个滚动物体在区域内的位置。 /// 如果物体不在区域内,则获取将物体以最短距离挪动到区域内后的位置 /// </summary> public bool GetInAreaPosition(Vector3 objPos, ScrollObject obj, out Vector3 pos) { Vector3 min, max; Bounds2Local(objPos, obj.bounds, out min, out max); Vector3[] boundsVertexs = CalculateBoundsVertexs(min, max); if (LocalContains(Area, boundsVertexs))//滚动物体没有超出范围 { pos = objPos; return(true); } //处理滚动物体超出范围的情况 Vector3 moveDistance = Vector3.zero; foreach (Vector3 v in boundsVertexs) { if (!Area.Contains(v)) //该点超出范围 { Vector3 n = Area.ClosestPoint(v); //将该点限制在范围内 Vector3 offset = n - v; //移动进包围盒偏移量 if (Math.Abs(offset.x) > Math.Abs(moveDistance.x)) { moveDistance.x = offset.x; } //if (Math.Abs(offset.y) > Math.Abs(moveDistance.y)) moveDistance.y = offset.y; //if (Math.Abs(offset.z) > Math.Abs(moveDistance.z)) moveDistance.z = offset.z; } } pos = objPos + moveDistance; return(false); }
/* * public void updateGrounds(float speedModifier, bool forced = false) { // updates the velocity of all grounds * foreach (GameObject[] MovingGroup in MovingObjects) * { * foreach (GameObject MovingObject in MovingGroup) * { * if (MovingObject.GetComponent<Scroll>() != null) * MovingObject.GetComponent<Scroll>().updateSpeed(speedModifier, forced); * } * } * } */ public void moveAllScrollingObjects(float speedModifier, bool forced = false) { foreach (Scroll ScrollObject in FindObjectsOfType <Scroll>()) { ScrollObject.updateSpeed(speedModifier, forced); } }
static int MoveOffset(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); ScrollObject obj = (ScrollObject)ToLua.CheckObject(L, 1, typeof(ScrollObject)); UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); obj.MoveOffset(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int MoveEnd(IntPtr L) { try { ToLua.CheckArgsCount(L, 4); ScrollObject obj = (ScrollObject)ToLua.CheckObject(L, 1, typeof(ScrollObject)); bool arg0 = LuaDLL.luaL_checkboolean(L, 2); bool arg1 = LuaDLL.luaL_checkboolean(L, 3); bool arg2 = LuaDLL.luaL_checkboolean(L, 4); obj.MoveEnd(arg0, arg1, arg2); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_Owner(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); ScrollObject obj = (ScrollObject)o; ScrollAreaLimiter arg0 = (ScrollAreaLimiter)ToLua.CheckUnityObject(L, 2, typeof(ScrollAreaLimiter)); obj.Owner = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Owner on a nil value" : e.Message)); } }
static int set_GizmosCubeColor(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); ScrollObject obj = (ScrollObject)o; UnityEngine.Color arg0 = ToLua.ToColor(L, 2); obj.GizmosCubeColor = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index GizmosCubeColor on a nil value" : e.Message)); } }
static int get_ScrollLogicPosition(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); ScrollObject obj = (ScrollObject)o; UnityEngine.Vector3 ret = obj.ScrollLogicPosition; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index ScrollLogicPosition on a nil value" : e.Message)); } }
static int get_bounds(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); ScrollObject obj = (ScrollObject)o; UnityEngine.Bounds ret = obj.bounds; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index bounds on a nil value" : e.Message)); } }
static int get_m_MoveRecord(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); ScrollObject obj = (ScrollObject)o; MoveRecord ret = obj.m_MoveRecord; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_MoveRecord on a nil value" : e.Message)); } }
static int get_Owner(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); ScrollObject obj = (ScrollObject)o; ScrollAreaLimiter ret = obj.Owner; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Owner on a nil value" : e.Message)); } }
static int set_m_MoveRecord(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); ScrollObject obj = (ScrollObject)o; MoveRecord arg0 = (MoveRecord)ToLua.CheckObject(L, 2, typeof(MoveRecord)); obj.m_MoveRecord = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index m_MoveRecord on a nil value" : e.Message)); } }
void OnTriggerEnter2D(Collider2D other)//트리거 { if (this.tag == "Player1" && other.tag == "Map2") { Debug.Log("DEAD"); if (non_dead == false) { isdead = true; } } if (this.tag == "Player2" && other.tag == "Map2") { //if(non_dead==false)isdead = true; } if (this.tag == "Player1" && other.tag == "Switch") { other.gameObject.transform.position = new Vector3(gameObject.transform.position.x + 0.3f, 0, 0); ScrollObject sc = other.gameObject.GetComponent <ScrollObject>(); sc.speed = 0; for (int i = 0; i < other.gameObject.transform.childCount; i++) { GameObject pierce_obj = (GameObject)other.gameObject.transform.GetChild(i).gameObject; if (pierce_obj.tag == "Untagged") { continue; } PierceObject pierce_script = pierce_obj.GetComponent <PierceObject>(); pierce_script.start_pierce(); } } if (this.tag == "Player1" && other.tag == "End0") { isclear = true; } }
public void obs_creates() { for (int i = 0; i < Maps.Count; i++) { ScrollObject Map = (ScrollObject)Maps[i]; Map.xl -= Map.speed * Time.deltaTime; //Map.pos.x -= Map.speed * Time.deltaTime; Maps[i] = Map; if (Map.xl <= 10) { Map.xl += 0.5f * Map.start_scale.x / 2.0f; Map.start_pos.x = Map.xl; if (Map.tag_int == 1) { GameObject go = (GameObject)Instantiate(obs1[Map.kind], Map.start_pos, Map.start_angle); ScrollObject obj_script = go.GetComponent <ScrollObject>(); obj_script.speed = Map.speed; go.transform.localScale = Map.start_scale; go.transform.SetParent(Stage.transform); } else if (Map.tag_int == 2) { GameObject go = (GameObject)Instantiate(obs2[Map.kind], Map.start_pos, Map.start_angle); ScrollObject obj_script = go.GetComponent <ScrollObject>(); obj_script.speed = Map.speed; go.transform.localScale = Map.start_scale; go.transform.SetParent(Stage.transform); } else if (Map.tag_int == 0) { GameObject go = (GameObject)Instantiate(End_obj, Map.start_pos, Map.start_angle); ScrollObject obj_script = go.GetComponent <ScrollObject>(); obj_script.speed = Map.speed; go.transform.localScale = Map.start_scale; go.transform.SetParent(Stage.transform); } Maps.RemoveAt(i); i--; } } for (int i = 0; i < switch_objs.Count; i++) { ScrollObject switch_obj_info = (ScrollObject)switch_objs[i]; switch_obj_info.xl -= switch_obj_info.speed * Time.deltaTime; switch_objs[i] = switch_obj_info; if (switch_obj_info.xl <= 10) { switch_obj_info.start_pos.x = switch_obj_info.xl + 0.5f * (14.363f + 3.408889f) / 2.0f; //switch_obj_info.xl; GameObject switch_obj = (GameObject)Instantiate( switch_gameobj, switch_obj_info.start_pos, switch_obj_info.start_angle); switch_obj.transform.localScale = switch_obj_info.start_scale; switch_obj.transform.SetParent(Stage.transform); ScrollObject scr_sw = switch_obj.GetComponent <ScrollObject>(); scr_sw.speed = switch_obj_info.speed; ArrayList pierce_objs = (ArrayList)switch_objs_in[i]; int cnt = pierce_objs.Count; for (int j = 0; j < cnt; j++) { PierceObject pp = (PierceObject)pierce_objs[j]; GameObject pierce_obj; Debug.Log(pp.start_tag); if (pp.start_tag == "Pierce")//////////////////////////////////// { pierce_obj = (GameObject)Instantiate(pierce_obj_base, pp.start_pos, pp.start_angle); } else { pierce_obj = (GameObject)Instantiate( pierce_gameobjs[pp.tag_int - 1][pp.kind], pp.start_pos, pp.start_angle ); } pierce_obj.transform.localScale = pp.start_scale; pierce_obj.transform.SetParent(switch_obj.transform); pierce_obj.transform.localPosition = pp.start_pos; PierceObject pierce_script = pierce_obj.GetComponent <PierceObject>(); //pierce_script = pp; pierce_script.copy(pp); } switch_objs.RemoveAt(i); switch_objs_in.RemoveAt(i); i--; ////////////////if } } }
public void copy(ScrollObject script) { speed = script.speed; tag_int = script.tag_int; }
// Use this for initialization void Start() { pierce_gameobjs[0] = new GameObject[2]; pierce_gameobjs[1] = new GameObject[2]; for (int i = 0; i < pierce_gameobj1.Length; i++) { pierce_gameobjs[0][i] = pierce_gameobj1[i]; pierce_gameobjs[1][i] = pierce_gameobj2[i]; } ScrollObject[] scrollObjects = GameObject.FindObjectsOfType <ScrollObject>(); foreach (ScrollObject so in scrollObjects) { if (so.gameObject.transform.parent != null && so.gameObject.transform.parent.gameObject.tag == "Switch") { continue; } /* * Vector3 vvv=so.gameObject.transform.position; * float zzz = so.gameObject.transform.rotation.eulerAngles.z; * Debug.Log(so.gameObject.tag); * int ttt = so.gameObject.tag[3] - 48; * Vector3 scsc = so.gameObject.transform.localScale; * * obstacle Map = new obstacle(so.gameObject.transform.position, * so.gameObject.transform.rotation.eulerAngles.z, so.kind, so.speed, * so.gameObject.tag[3] - 48, so.gameObject.transform.localScale);//MAP */ if (so.gameObject.tag == "End0") { Debug.Log("END_tag"); //Map.tag = 0; } //Map.pos.x -= 0.5f * Map.scale.x / 2.0f; ScrollObject sc = so.transform.GetComponent <ScrollObject>(); if (so.tag != "Switch") { Maps.Add(sc); } else { //Map.pos.x += 0.5f * Map.scale.x / 2.0f; switch_objs.Add(sc); ArrayList pierce_objs = new ArrayList(); int cnt = so.transform.GetChildCount(); for (int i = 0; i < cnt; i++) { if (so.transform.GetChild(i).gameObject.tag == "Untagged") { continue; } PierceObject pc = so.transform.GetChild(i).gameObject.GetComponent <PierceObject>(); if (pc.tag == "Pierce") { Debug.Log("Pierce"); pc.tag_int = -1; } pierce_objs.Add(pc); } switch_objs_in.Add(pierce_objs); } so.Destroy_this(); //so.enabled = false; } }