Exemplo n.º 1
0
    void SelectTarget(RaycastHit h)
    {
        ISelectableTarget trg = h.collider.gameObject.GetComponent <ISelectableTarget>();

        if (trg != null)
        {
            GUIManager gui = GUIManager.instance;
            gui.trgDist.text = Mathf.CeilToInt((transform.position - h.transform.position).magnitude * 4f).ToString() + "м";
            gui.trgName.text = trg.GetName();
            gui.trgSpd.text  = (h.collider.gameObject.GetComponent <Rigidbody>().velocity.magnitude * 4f).ToString() + "мс";

            if (selectedTarget)
            {
                selectedTarget = null;
                Destroy(selMarker);
            }
            selectedTarget      = h.collider.gameObject;
            selMarker           = selectedTarget.AddComponent <SelectionMarker>();
            selMarker.markerFab = selectionMarkerFab;
            audiosource.PlayOneShot(selectTg);
        }
        else
        {
            DeselectTarget();
        }
    }
    private void SelectEntity(Entity entity)
    {
        SelectedEntities.Add(entity);

        SelectionMarker selectionMarker = entity.GetComponentInChildren <SelectionMarker>(true);

        if (selectionMarker != null)
        {
            selectionMarker.ToggleRendering(true);
        }

        entity.Select();
    }
    private void DeselectEntity(Entity entity, bool removeFromSelection)
    {
        SelectionMarker selectionMarker = entity.GetComponentInChildren <SelectionMarker>();

        if (selectionMarker != null)
        {
            selectionMarker.ToggleRendering(false);
        }

        if (removeFromSelection)
        {
            SelectedEntities.Remove(entity);
        }

        entity.Deselect();
    }
Exemplo n.º 4
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            DestroyImmediate(gameObject);
        }

        if (selectionMarkerPrefab)
        {
            marker = Instantiate(selectionMarkerPrefab).GetComponent <SelectionMarker>();
        }
        else
        {
            Debug.LogError("Selection marker prefab missing!");
        }

        if (!nextTurnPanel)
        {
            Debug.LogWarning("No 'Next turn' panel attached!");
        }

        lobby = FindObjectOfType <Lobby>();
        if (!lobby)
        {
            Debug.LogError("Can't find lobby gameobject!");
        }

        player = GameObject.FindWithTag("Player").GetComponent <Team>();

        CreateTeams();
        // if (teams.Count <= 1)
        // {
        //     Debug.LogError("There's less than 2 teams in the game!");
        // }

        activeTeam = teams[0];
        TurnBegin();
    }
Exemplo n.º 5
0
        void Select(Entity n)
        {
            ((Editor)Root.Instance.CurrentFlow).Select = n;
            DisplayProperties();

            if (n != null)
            {
                if (selectionmarker == null)
                {
                    selectionmarker = new SelectionMarker();
                    Root.Instance.Scene.Spawn(selectionmarker);
                }

                selectionmarker.Position = ((Node)n).AbsolutePosition;
            }
            else
            {
                if (selectionmarker != null)
                {
                    selectionmarker.Visible = false;
                }
            }
        }
Exemplo n.º 6
0
        public InGameUI(Code2015 game, Game parent, GameScene scene, GameState gamelogic)
        {
            this.parent = parent;
            this.logic  = gamelogic;

            this.game      = game;
            this.renderSys = game.RenderSystem;
            this.scene     = scene;


            this.player = parent.HumanPlayer;


            picker = new Picker(game, parent, scene, gamelogic);
            AddElement(picker);


            //this.infoUI = new InfoUI(game, parent, scene, gamelogic);
            //AddElement(infoUI);


            this.miniMap = new MiniMap(game, parent, scene, gamelogic);
            AddElement(miniMap);


            //-----Ruan-----------


            cityStatusInfo = new CitySelectInfo(game, parent, scene, gamelogic);
            AddElement(cityStatusInfo);

            objectStatusInfo = new ObjectSelectInfo(game, parent, scene, gamelogic);
            AddElement(objectStatusInfo);

            sendBallSelect = new RBallTypeSelect(game, parent, scene, gamelogic);
            AddElement(sendBallSelect);



            nigMenu = new NIGMenu(game, parent, scene, gamelogic);
            AddElement(nigMenu);
            nigColor = new NIGColor(game, parent, scene, gamelogic);
            AddElement(nigColor);
            nigWin = new NIGWin(game, parent, scene, gamelogic);
            AddElement(nigWin);
            nigFail = new NIGFail(game, parent, scene, gamelogic);
            AddElement(nigFail);
            nigObjective = new NIGObjective(game, parent, scene, gamelogic);
            AddElement(nigObjective);
            nigColor = new NIGColor(game, parent, scene, gamelogic);
            AddElement(nigColor);

            rankInfo = new RankInfo(game, parent, scene, gamelogic);
            AddElement(rankInfo);

            selectionMarker = new SelectionMarker(renderSys, gamelogic.Field, player);
            scene.Scene.AddObjectToScene(selectionMarker);


            layeredCursor = new Cursor(game, parent, scene, gamelogic, picker, cityStatusInfo, objectStatusInfo,
                                       sendBallSelect, miniMap, selectionMarker, rankInfo);
            AddElement(layeredCursor);


            exit = new ExitGame(game, parent, scene, gamelogic, nigMenu);
            AddElement(exit);

            quest = new Quest(game, parent, scene, gamelogic);
            AddElement(quest);
        }
Exemplo n.º 7
0
        void Select(Entity n)
        {
            ((Editor)Root.Instance.CurrentFlow).Select = n;
            DisplayProperties();

            if (n != null)
            {
                if (selectionmarker == null)
                {
                    selectionmarker = new SelectionMarker();
                    Root.Instance.Scene.Spawn(selectionmarker);
                }

                selectionmarker.Position = ((Node)n).AbsolutePosition;
            }
            else
            {
                if (selectionmarker != null)
                    selectionmarker.Visible = false;
            }
        }
 public StartCountryGuessNotification(ICountryQuestion question, SelectionMarker marker)
 {
     Question = question;
     Marker   = marker;
 }
Exemplo n.º 9
0
        public Cursor(Code2015 game, Game parent, GameScene scene, GameState gamelogic, Picker picker,
                      CitySelectInfo citySelectInfo, ObjectSelectInfo objSelectInfo, RBallTypeSelect sendBallSelect, MiniMap map, SelectionMarker marker, RankInfo rankInfo)
        {
            this.parent   = parent;
            this.logic    = gamelogic;
            this.player   = gamelogic.LocalHumanPlayer;
            this.rankInfo = rankInfo;

            this.game      = game;
            this.renderSys = game.RenderSystem;
            this.scene     = scene;

            this.picker = picker;

            this.selectionMarker = marker;
            this.citySelectInfo  = citySelectInfo;
            this.objSelectInfo   = objSelectInfo;
            this.sendBallSelect  = sendBallSelect;
            this.miniMap         = map;

            FileLocation fl = FileSystem.Instance.Locate("cursor.tex", GameFileLocs.GUI);

            cursor = UITextureManager.Instance.CreateInstance(fl);

            fl           = FileSystem.Instance.Locate("cursor_u.tex", GameFileLocs.GUI);
            cursor_up    = UITextureManager.Instance.CreateInstance(fl);
            fl           = FileSystem.Instance.Locate("cursor_l.tex", GameFileLocs.GUI);
            cursor_left  = UITextureManager.Instance.CreateInstance(fl);
            fl           = FileSystem.Instance.Locate("cursor_d.tex", GameFileLocs.GUI);
            cursor_down  = UITextureManager.Instance.CreateInstance(fl);
            fl           = FileSystem.Instance.Locate("cursor_r.tex", GameFileLocs.GUI);
            cursor_right = UITextureManager.Instance.CreateInstance(fl);

            fl          = FileSystem.Instance.Locate("cursor_lu.tex", GameFileLocs.GUI);
            cursor_ul   = UITextureManager.Instance.CreateInstance(fl);
            fl          = FileSystem.Instance.Locate("cursor_ru.tex", GameFileLocs.GUI);
            cursor_ur   = UITextureManager.Instance.CreateInstance(fl);
            fl          = FileSystem.Instance.Locate("cursor_ld.tex", GameFileLocs.GUI);
            cursor_dl   = UITextureManager.Instance.CreateInstance(fl);
            fl          = FileSystem.Instance.Locate("cursor_rd.tex", GameFileLocs.GUI);
            cursor_dr   = UITextureManager.Instance.CreateInstance(fl);
            fl          = FileSystem.Instance.Locate("cursor_move.tex", GameFileLocs.GUI);
            cursor_move = UITextureManager.Instance.CreateInstance(fl);

            fl          = FileSystem.Instance.Locate("cursor_stop.tex", GameFileLocs.GUI);
            cursor_stop = UITextureManager.Instance.CreateInstance(fl);

            fl            = FileSystem.Instance.Locate("cursor_toofar.tex", GameFileLocs.GUI);
            cursor_toofar = UITextureManager.Instance.CreateInstance(fl);

            cursor_sel = new Texture[11];

            for (int i = 0; i < cursor_sel.Length; i++)
            {
                fl            = FileSystem.Instance.Locate("selcursor" + (i + 13).ToString("D2") + ".tex", GameFileLocs.GUI);
                cursor_sel[i] = UITextureManager.Instance.CreateInstance(fl);
            }

            cursor_attack = new Texture[11];
            for (int i = 0; i < cursor_attack.Length; i++)
            {
                fl = FileSystem.Instance.Locate("selcursor" + (i + 1).ToString("D2") + ".tex", GameFileLocs.GUI);
                cursor_attack[i] = UITextureManager.Instance.CreateInstance(fl);
            }

            cursorState = MouseCursor.Normal;
        }