Exemplo n.º 1
0
        // 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;
            }
        }
Exemplo n.º 2
0
        private Vector3 revertToOrigin(Vector3 loc)
        {
            Vector2 temp = new Vector2(loc.x, loc.z);

            temp = VectorCalculation.revertToOrigin(temp, GameMode.getCurrentLevel());
            return(makeVector3(temp));
        }
Exemplo n.º 3
0
        public void OnPointerClick(PointerEventData eventData)
        {
            AudioProvider.getInstance().playAudio("Reset");
            placer.clearBlocks();
            Level level = GameMode.getCurrentLevel();

            level.setLocked(false);
            level.storeCompleteStatus();
        }
Exemplo n.º 4
0
 void Start()
 {
     level = GameMode.getCurrentLevel();
     if (!LevelLoader.getInstance().doesLevelExist(level.getId() + 1))
     {
         active = false;
         this.gameObject.SetActive(false);
     }
 }
Exemplo n.º 5
0
 void LateUpdate()
 {
     if (!tried)
     {
         tried = true;
         if (GameMode.getCurrentLevel().getId() == 1 && !GameMode.getCurrentLevel().isLocked())
         {
             infoButton.Display();
         }
     }
 }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
 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);
         }
     }
 }
Exemplo n.º 8
0
        // 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);
        }
Exemplo n.º 9
0
 public void OnPointerClick(PointerEventData eventData)
 {
     this.transform.parent.transform.parent.GetComponent <Popup>().OutAnimation();
     GameMode.getCurrentLevel().setLocked(false);
     AudioProvider.getInstance().playAudio("Standard Button");
 }
Exemplo n.º 10
0
        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;
        }
Exemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     level = GameMode.getCurrentLevel();
     makeGrid();
     displayRoadPoints();
 }
Exemplo n.º 12
0
 public void Start()
 {
     level = GameMode.getCurrentLevel();
     loadFromDevice();
 }
Exemplo n.º 13
0
 void Start()
 {
     level = GameMode.getCurrentLevel();
 }