Ejemplo n.º 1
0
        /// <summary>
        /// Called  once per frame
        /// </summary>
        protected void Update()
        {
            // Called when left clicked
            if (Input.GetMouseButtonDown(0))
            {
                var mapNodes = Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, 15)
                               .Select(hit => hit.collider.GetComponent <MapNodeBehavior>())
                               .ToList();

                if (mapNodes.Count == 0)
                {
                    // User clicked on nothing
                    return;
                }

                var mapNode = mapNodes.First();
                if (mapNode != null)
                {
                    this._currentLevelBehavior = mapNode;
                    this.CurrentLevel          = this._currentLevelBehavior.TargetNode;
                    MapNodeInfoPanel.CurrentInstance.Render(this.CurrentLevel);
                    LevelSelectCamera.CurrentInstance.OnSelectLevelNode(this._currentLevelBehavior);
                    return;
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Shows the level information
 /// </summary>
 public void ShowLevelInfo(MapNodeBehavior level)
 {
     this._currentLevelBehavior = level;
     this.CurrentLevel          = level.TargetNode;
     MapNodeInfoPanel.CurrentInstance.Render(level.TargetNode);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Focuses onto  the level node
 /// </summary>
 public void OnSelectLevelNode(MapNodeBehavior targetNode)
 {
     this.TargetNode = targetNode;
 }