예제 #1
0
    // Update is called once per frame
    void Update()
    {
        left_double_timer.Update();

        if (InputHandler.GetMouseClicked(0))
        {
            var node = RaycastNode();

            if (node != null)
            {
                if (selected_node == node)
                {
                    if (cam.Target == node.transform)
                    {
                        if (is_left_double)
                        {
                            cam.toggleDistance();
                        }
                    }
                    else
                    {
                        setCameraTarget(node);
                    }
                }
                else
                {
                    SelectNode(node);
                }
            }
            else
            {
                DeselectNode();
            }

            left_double_timer.Active = true;
            left_double_timer.Reset();
            is_left_double = true;
        }

        if (InputHandler.GetMouseClicked(1))
        {
            var node = RaycastNode();

            if (node != null)
            {
                bool update_hud = false;
                foreach (var s in selected_ships)
                {
                    if (node.Data != s.Orbit)
                    {
                        if (s.MoveTarget != null)
                        {
                            s.setMovement(null);
                            world_main.removeShip(s);
                        }
                        //move
                        s.setMovement(node.Data);
                        world_main.createShip(s);
                    }
                    else
                    {
                        //cancel move
                        s.setMovement(null);
                        world_main.removeShip(s);
                    }
                    update_hud = true;
                }

                if (update_hud)
                {
                    Menu.UpdateShipPanel();
                }
            }
        }
    }
예제 #2
0
 public void RemoveFromWorld()
 {
     world_main.removeShip(Data);
 }