Пример #1
0
        private void Callback_ViewModeChanged(UnityLogic.ViewModes oldMode, UnityLogic.ViewModes newMode)
        {
            var tiles = unusedHighlights.Concat(highlightsByID.Values).ToList();

            //Remove old resources.
            switch (oldMode)
            {
            case UnityLogic.ViewModes.TwoD:
                foreach (Tile t in tiles)
                {
                    Destroy(t.Obj.GetComponent <SpriteRenderer>());
                }
                break;

            case UnityLogic.ViewModes.ThreeD:
                throw new NotImplementedException();
            //break;

            default: throw new NotImplementedException(oldMode.ToString());
            }

            //Set up new resources.
            switch (newMode)
            {
            case UnityLogic.ViewModes.TwoD:
                foreach (Tile t in tiles)
                {
                    var spr = t.Obj.AddComponent <SpriteRenderer>();
                    spr.sortingOrder = SpriteLayer;
                    spr.sprite       = HighlightSprite;
                }
                break;

            case UnityLogic.ViewModes.ThreeD:
                throw new NotImplementedException();
            //break;

            default: throw new NotImplementedException(newMode.ToString());
            }

            //Update Tile data structures.
            foreach (Tile t in tiles)
            {
                t.UpdateGameObject();
            }
        }
Пример #2
0
        private void CleanUpCallbacks(UnityLogic.ViewModes viewMode)
        {
            switch (viewMode)
            {
            case UnityLogic.ViewModes.TwoD:
                if (Rendering.TwoD.InputController2D.Instance != null)
                {
                    Rendering.TwoD.InputController2D.Instance.OnWorldTileClicked.Remove(
                        Callback_WorldTileClicked);
                }
                break;

            case UnityLogic.ViewModes.ThreeD:
                throw new NotImplementedException();

            default: throw new NotImplementedException(viewMode.ToString());
            }
        }
Пример #3
0
        public void Callback_NewViewMode(UnityLogic.ViewModes oldViewMode,
                                         UnityLogic.ViewModes newViewMode)
        {
            CleanUpCallbacks(oldViewMode);

            switch (newViewMode)
            {
            case UnityLogic.ViewModes.TwoD:
                Rendering.TwoD.InputController2D.Instance.OnWorldTileClicked.Add(
                    Callback_WorldTileClicked);
                break;

            case UnityLogic.ViewModes.ThreeD:
                throw new NotImplementedException();

            default:
                throw new NotImplementedException(newViewMode.ToString());
            }
        }