Exemplo n.º 1
0
        public SelectionManager(SelectionPane selectionPane, PlayerData localPlayer)
        {
            _localPlayer   = localPlayer;
            _selectionPane = selectionPane;
            _selection     = new List <PlatoonBehaviour>();
            _clickManager  = new ClickManager(
                0,
                StartBoxSelection,
                OnSelectShortClick,
                EndDrag,
                UpdateBoxSelection);

            if (_texture == null)
            {
                float areaTransparency   = .95f;
                float borderTransparency = .75f;
                _texture          = new Texture2D(1, 1);
                _texture.wrapMode = TextureWrapMode.Repeat;
                _texture.SetPixel(
                    0, 0, _selectionBoxColor - areaTransparency * Color.black);
                _texture.Apply();
                _borderTexture          = new Texture2D(1, 1);
                _borderTexture.wrapMode = TextureWrapMode.Repeat;
                _borderTexture.SetPixel(
                    0, 0, _selectionBoxColor - borderTransparency * Color.black);
                _borderTexture.Apply();
            }
        }
Exemplo n.º 2
0
        private void Awake()
        {
            SelectionPane selectionPane = FindObjectOfType <SelectionPane>();

            if (selectionPane == null)
            {
                throw new Exception("No SelectionPane found in the scene!");
            }
            _selectionManager = new SelectionManager(selectionPane);

            _commands = new Commands(GameSession.Singleton.Settings.Hotkeys);
        }
Exemplo n.º 3
0
        private void Awake()
        {
            // FindObjectOfType on Awake is dangerous - the script being searched for may
            // not have been activated yet (e.g. its Awake() method is called after this one)
            SelectionPane selectionPane = FindObjectOfType <SelectionPane>();

            if (selectionPane == null)
            {
                throw new Exception("No SelectionPane found in the scene!");
            }
            _selectionManager = new SelectionManager(selectionPane, _localPlayer);

            _chatManager = Util.FindRootObjectByName("ChatManager").GetComponent <ChatManager>();
            if (_chatManager == null)
            {
                throw new Exception("No ChatManager found in the scene!");
            }

            _commands = new Commands(GameSession.Singleton.Settings.Hotkeys);
        }