// Update is called once per frame void Update() { if (!following || GameMode.getCurrentLevel().isLocked()) { return; } Vector2?mousePos = getMousePos(); if (lastRawPos == mousePos) { return; } lastRawPos = mousePos; if (mousePos != null && piece != null) { lastGridPos = gridPos((Vector2)mousePos); placer.hover(piece, (Vector2)lastGridPos, deg); } else { placeObject(); following = false; } }
private Vector3 revertToOrigin(Vector3 loc) { Vector2 temp = new Vector2(loc.x, loc.z); temp = VectorCalculation.revertToOrigin(temp, GameMode.getCurrentLevel()); return(makeVector3(temp)); }
public void OnPointerClick(PointerEventData eventData) { AudioProvider.getInstance().playAudio("Reset"); placer.clearBlocks(); Level level = GameMode.getCurrentLevel(); level.setLocked(false); level.storeCompleteStatus(); }
void Start() { level = GameMode.getCurrentLevel(); if (!LevelLoader.getInstance().doesLevelExist(level.getId() + 1)) { active = false; this.gameObject.SetActive(false); } }
void LateUpdate() { if (!tried) { tried = true; if (GameMode.getCurrentLevel().getId() == 1 && !GameMode.getCurrentLevel().isLocked()) { infoButton.Display(); } } }
private Vector2 gridPos(Vector2 pos) { int width = GameMode.getCurrentLevel().getWidth(); int height = GameMode.getCurrentLevel().getHeight(); float x = Mathf.Round(pos.x / ((Screen.width * .7f) / width)) - 1; float y = Mathf.Round(pos.y / (Screen.height / height)) - 1; x = Mathf.Min(x, width - 1); x = Mathf.Max(0, x); y = Mathf.Min(y, height - 1); y = Mathf.Max(0, y); return(new Vector2(x, y)); }
private void getBlocks() { if (blocks == null) { blocks = new Dictionary <int, List <Block> > (); Level level = GameMode.getCurrentLevel(); foreach (Block block in level.getBlocks()) { if (!blocks.ContainsKey(block.getId())) { blocks.Add(block.getId(), new List <Block> ()); } blocks [block.getId()].Add(block); } } }
// Use this for initialization void Start() { XmlDocument doc = XmlHelper.getXml(); Level level = GameMode.getCurrentLevel(); XmlNode node = doc.SelectSingleNode("//camera[@width = '" + level.getWidth() + "' and @height = '" + level.getHeight() + "']"); if (node == null) { Debug.LogError("Please add the camera config in the xml file"); return; } XmlNode position = node.SelectSingleNode("position"); transform.position = new Vector3(float.Parse(position.Attributes ["x"].Value), float.Parse(position.Attributes ["y"].Value), float.Parse(position.Attributes ["z"].Value)); GetComponent <Camera> ().orthographicSize = float.Parse(position.Attributes ["size"].Value); }
public void OnPointerClick(PointerEventData eventData) { this.transform.parent.transform.parent.GetComponent <Popup>().OutAnimation(); GameMode.getCurrentLevel().setLocked(false); AudioProvider.getInstance().playAudio("Standard Button"); }
private void setParent() { GameObject empty = new GameObject(); Vector3 dir = new Vector3(); switch (data [current].flipFrom) { case Direction.UP: dir = new Vector3(0, 0, .5f); break; case Direction.LEFT: dir = new Vector3(-0.5f, 0, 0); break; case Direction.BOTTOM: dir = new Vector3(0, 0, -0.5f); break; case Direction.RIGHT: dir = new Vector3(0.5f, 0, 0); break; } Vector3 lastPos = makeVector3(VectorCalculation.revertToOrigin(data [current].Position, GameMode.getCurrentLevel())) + dir * -1; lastPos.y = 0.1f; empty.transform.position = lastPos; getPrefab().transform.position = new Vector3(0, 0, 0); getPrefab().transform.eulerAngles = new Vector3(0, data [current].getRotation(), 0); getPrefab().transform.parent = empty.transform; getPrefab().transform.localPosition = dir; empty.transform.eulerAngles = getRotation() * -180; }
// Use this for initialization void Start() { level = GameMode.getCurrentLevel(); makeGrid(); displayRoadPoints(); }
public void Start() { level = GameMode.getCurrentLevel(); loadFromDevice(); }
void Start() { level = GameMode.getCurrentLevel(); }