예제 #1
0
 void SubmitSelection()
 {
     SourceMenu.SetActive(true);
     BlockRangeDisplay.ClearDisplay(decalProjectors);
     decalProjectors = new List <GameObject>();
     Destroy(gameObject);
 }
예제 #2
0
 void UpdateTargetDisplay()
 {
     BlockRangeDisplay.ClearDisplay(decalProjectors);
     decalProjectors = new List <GameObject>();
     foreach (GridObject gridObject in Targets)
     {
         decalProjectors.AddRange(BlockRangeDisplay.RectangleDisplay(TileIndicator, GridCrafter.blockGrid, gridObject.pos, gridObject.TileSize));
     }
 }
예제 #3
0
    public void HoverDisplay()
    {
        Vector2Int grid_pos = BlockAtMouse();

        if (grid_pos != new Vector2Int(-1, -1))
        {
            if (grid_pos != selectionPos)
            {
                BlockRangeDisplay.ClearDisplay(decalProjectors);
                selectionPos = grid_pos;
                if (LevelFloor(grid_pos, selectionRange))
                {
                    decalProjectors = BlockRangeDisplay.RectangleDisplay(rangeIndicator, blockGrid, selectionPos, selectionRange);
                }
                else
                {
                    decalProjectors = BlockRangeDisplay.RectangleDisplay(rangeErrorIndicator, blockGrid, selectionPos, selectionRange);
                }
            }
        }
    }
예제 #4
0
 // Update is called once per frame
 void Update()
 {
     if (!MenuOpen)
     {
         if (control.MapCraftControls.MoveLeft.phase == InputActionPhase.Started)
         {
             cameraPos.x -= cameraSpeed * Time.deltaTime;
         }
         if (control.MapCraftControls.MoveRight.phase == InputActionPhase.Started)
         {
             cameraPos.x += cameraSpeed * Time.deltaTime;
         }
         if (control.MapCraftControls.MoveDown.phase == InputActionPhase.Started)
         {
             cameraPos.z -= cameraSpeed * Time.deltaTime;
         }
         if (control.MapCraftControls.MoveUp.phase == InputActionPhase.Started)
         {
             cameraPos.z += cameraSpeed * Time.deltaTime;
         }
         if (control.MapCraftControls.ZoomOut.phase == InputActionPhase.Started)
         {
             cameraPos.y -= cameraSpeed * Time.deltaTime;
         }
         if (control.MapCraftControls.ZoomIn.phase == InputActionPhase.Started)
         {
             cameraPos.y += cameraSpeed * Time.deltaTime;
         }
         HoverDisplay();
         if (control.MapCraftControls.EditMenu.triggered)
         {
             AddLevelEditorMenu();
             BlockRangeDisplay.ClearDisplay(decalProjectors);
         }
         else if (control.MapCraftControls.CutsceneClick.phase == InputActionPhase.Started)
         {
             AddCutscene();
             BlockRangeDisplay.ClearDisplay(decalProjectors);
         }
         else
         {
             if (editMode == "Height")
             {
                 MoveBlocksHeight();
             }
             if (editMode == "Tile")
             {
                 ChangeBlock();
             }
             if (editMode == "Character")
             {
                 PlaceCharacter();
             }
             if (editMode == "Object")
             {
                 PlaceObject();
             }
         }
     }
     combatCamera.transform.position    = new Vector3((mapShape.x - 1) * blockOffset.x / 2 + cameraPos.x, cameraHeight + cameraPos.y, cameraOffset + cameraPos.z);
     combatCamera.transform.eulerAngles = new Vector3(cameraAngle, 0, 0);
 }