예제 #1
0
 public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Camera camera)
 {
     GroundLayer?.Draw(gameTime, spriteBatch, TileSet, camera);
     EdgeLayer?.Draw(gameTime, spriteBatch, TileSet, camera);
     BuildingLayer?.Draw(gameTime, spriteBatch, TileSet, camera);
     DecorationLayer?.Draw(gameTime, spriteBatch, TileSet, camera);
 }
예제 #2
0
        private static void InitBurntLayers()
        {
            burntLayerList = new Dictionary <int, GroundLayer>();
            int bitMaskIndex = 0;
            int tileSize     = 12;



            for (int x = 0; x < 128; x++)
            {
                for (int y = 0; y < 512; y++)
                {
                    int locationX = (x * tileSize) + x + 1 + 650;
                    int locationY = (y * tileSize) + y + 1;


                    Rectangle   rectangle  = new Rectangle(locationX, locationY, tileSize, tileSize);
                    Sprite      sprite     = new Sprite(rectangle, TextureSheet.Ground);
                    GroundLayer burntLayer = new GroundLayer(LayerType.BURNT, sprite, 0, 0);
                    //       burntLayer.scale = 11.6f;
                    burntLayer.scale = 10.7f;
                    burntLayerList.Add(bitMaskIndex, burntLayer);
                    bitMaskIndex++;
                }
            }

            burntLayerList.Last().Value.isFullBurnt = true;
        }
예제 #3
0
        private void AddLayerDraw(Tile tile, Rectangle destination, Color color)
        {
            if (tile.GetBaseLayer() != null)
            {
                GroundLayer layer = tile.GetBaseLayer();
                DisplayController.spriteBatch1.Draw(layer.sprite.texture2D, destination, layer.sprite.location, color, layer.sprite.rotation, layer.sprite.rotationCenter, SpriteEffects.None, 1f);
            }

            if (tile.GetLayerList() != null)
            {
                foreach (GroundLayer extraLayer in tile.GetLayerList())
                {
                    DisplayController.spriteBatch1.Draw(extraLayer.sprite.texture2D, destination, extraLayer.sprite.location, color, extraLayer.sprite.rotation, extraLayer.sprite.rotationCenter, SpriteEffects.None, 1f);
                }
            }

            if (tile.GetBurntLayer() != null)
            {
                GroundLayer layer = tile.GetBurntLayer();
                DisplayController.spriteBatch1.Draw(layer.sprite.texture2D, destination, layer.sprite.location, color, layer.sprite.rotation, layer.sprite.rotationCenter, SpriteEffects.None, 1f);
            }

            /*  if (tile.isCompleteBurnt)
             * {
             *    GroundLayer extraLayer = GroundLayerController.burntLayer;
             *    DisplayController.spriteBatch1.Draw(extraLayer.sprite.texture2D, destination, extraLayer.sprite.location, color, extraLayer.sprite.rotation, extraLayer.sprite.rotationCenter, SpriteEffects.None, 1f);
             * }*/
        }
예제 #4
0
 public void SetBurntLayer()
 {
     if (fire != null)
     {
         burntLayer = GroundLayerController.GetBurntLayerByBitMask(fire.GetBurntLayerBitMaskId());
     }
 }
예제 #5
0
 public void Update(GameTime gameTime)
 {
     GroundLayer?.Update(gameTime);
     EdgeLayer?.Update(gameTime);
     BuildingLayer?.Update(gameTime);
     DecorationLayer?.Update(gameTime);
 }
예제 #6
0
        private static void LoadLayer(LayerType layerType, bool rotateBase)
        {
            Dictionary <int, GroundLayer> myList = new Dictionary <int, GroundLayer>();

            int   textureSheetHeightIndex = (int)layerType;
            float degrees = 0;

            for (int i = 0; i < 21; i++)
            {
                Sprite      sprite = new Sprite(GetSpriteSheetRectangle(i, textureSheetHeightIndex), TextureSheet.Ground);
                GroundLayer layer  = new GroundLayer(layerType, sprite, textureSheetHeightIndex, BitMask.GetBitmaskFromTileIndex(i));
                sprite.rotation = MathHelper.ToRadians(degrees);
                myList.Add(i, layer);

                if (rotateBase || i > 11)
                {
                    degrees += 90;
                }

                if (degrees == 360)
                {
                    degrees = 0;
                }
            }
            layerTypeList.Add(layerType, myList);
        }
예제 #7
0
        public PlayerCameToLayerEA(GroundLayer groundLayer)
        {
            if (groundLayer == null)
            {
                Management.Log.Instance.WriteException(new ArgumentNullException());
            }

            GroundLayer = groundLayer;
        }
예제 #8
0
 public void AddLayer(GroundLayer groundLayer)
 {
     if (layerList == null)
     {
         layerList = new GroundLayer[0];
     }
     ResizeLayerList(1);
     layerList[layerList.Length - 1] = groundLayer;
 }
예제 #9
0
        // public Layer vehicle1;
        //  public Layer vehicle2;

        public Tile(GroundLayer baseLayer, TileLogistic tileLogistic, int tileX, int tileY)
        {
            //landtype just all starts as water
            //when we expand our shunk map the landtype gets set?
            this.tileLogistic = tileLogistic;
            this.baseLayer    = baseLayer;

            location = new Vector2((tileX * GroundLayerController.tileSize) + GroundLayerController.halfTileSize, (tileY * GroundLayerController.tileSize) + GroundLayerController.halfTileSize);
        }
예제 #10
0
        public void OnPlayerCameToLayer(EventArgs args)
        {
            if (args is PlayerCameToLayerEA pctl)
            {
                if (_visitedGroundLayer != null)
                {
                    if (_visitedGroundLayer.AreaType == GroundLayer.EAreaType.Surface)
                    {
                        _surfaceLightingController.ChangeLighting(new ChangeAmbientLightEA.AmbientLightSetting {
                            LightToRemove = _visitedGroundLayer.AmbientLight
                        });
                    }
                    else if (_visitedGroundLayer.AreaType == GroundLayer.EAreaType.Underground)
                    {
                        _undergroundLightingController.ChangeLighting(new ChangeAmbientLightEA.AmbientLightSetting {
                            LightToRemove = _visitedGroundLayer.AmbientLight
                        });
                    }
                }

                _visitedGroundLayer = pctl.GroundLayer;

                if (_visitedGroundLayer != null)
                {
                    if (_visitedGroundLayer.AreaType == GroundLayer.EAreaType.Surface)
                    {
                        _surfaceLightingController.ChangeLighting(new ChangeAmbientLightEA.AmbientLightSetting {
                            LightToAdd = pctl.GroundLayer.AmbientLight, ChangeMode = ChangeAmbientLightEA.EChangeMode.Stack
                        });
                        if (_changeControllerCoroutine != null)
                        {
                            StopCoroutine(_changeControllerCoroutine);
                        }
                        _changeControllerCoroutine = StartCoroutine(ChangeToSurface());
                    }
                    else if (_visitedGroundLayer.AreaType == GroundLayer.EAreaType.Underground)
                    {
                        _undergroundLightingController.ChangeLighting(new ChangeAmbientLightEA.AmbientLightSetting {
                            LightToAdd = pctl.GroundLayer.AmbientLight, ChangeMode = ChangeAmbientLightEA.EChangeMode.Stack
                        });
                        if (_changeControllerCoroutine != null)
                        {
                            StopCoroutine(_changeControllerCoroutine);
                        }
                        _changeControllerCoroutine = StartCoroutine(ChangeToUnderground());
                    }
                }
            }
            else
            {
                Log.Instance.WriteException(new InvalidEventArgsException());
            }
        }
예제 #11
0
 void Start()
 {
     Current = masterGround.GetComponent<GroundLayer>();
     int count = 0;
     foreach (SwitchLight lightswitch in this.gameObject.GetComponentsInChildren<SwitchLight>())
     {
         lightswitch.SetID(count++);
     }
     this.gameObject.transform.DetachChildren();
     NumberOfGrounds = MINIMUM_NUMBER_OF_GROUNGS;
     if ((numberOfGrounds -= MINIMUM_NUMBER_OF_GROUNGS) > 0)
         AddGrounds(numberOfGrounds);
     numberOfGrounds = NumberOfGrounds;
     Current.IsActiveGround = true;
     
 }
예제 #12
0
        public void OnPlayerCameToLayer(EventArgs args)
        {
            if (args is PlayerCameToLayerEA pctl)
            {
                if (!enabled)
                {
                    enabled = true;
                }

                _currentLayer = pctl.GroundLayer;
                ChangeTransparency(pctl.GroundLayer.AreaType);
            }
            else
            {
                Management.Log.Instance.WriteException(new InvalidEventArgsException());
            }
        }
예제 #13
0
        public void SetChildObject(MapObject mapObject, bool deleteBase, bool deleteLayerList, TileLogistic tileLogistic, bool changeTileLogistic)
        {
            childObject = mapObject;

            if (deleteLayerList)
            {
                layerList = null;
            }
            if (deleteBase)
            {
                baseLayer = null;
            }

            if (changeTileLogistic)
            {
                this.tileLogistic = tileLogistic;
            }
        }
예제 #14
0
    void Start()
    {
        Current = masterGround.GetComponent <GroundLayer>();
        int count = 0;

        foreach (SwitchLight lightswitch in this.gameObject.GetComponentsInChildren <SwitchLight>())
        {
            lightswitch.SetID(count++);
        }
        this.gameObject.transform.DetachChildren();
        NumberOfGrounds = MINIMUM_NUMBER_OF_GROUNGS;
        if ((numberOfGrounds -= MINIMUM_NUMBER_OF_GROUNGS) > 0)
        {
            AddGrounds(numberOfGrounds);
        }
        numberOfGrounds        = NumberOfGrounds;
        Current.IsActiveGround = true;
    }
예제 #15
0
    private void FootstepEvent()
    {
        if (!IsPlayingFootstepSound)
        {
            return;
        }

        if (!CharIsOnSpecialSurface)
        {
            terrainID = GetActiveTerrainTextureIdx();
            switch (terrainID)
            {
            case 0:
                currentPlayerGroundLayer = GroundLayer.shortGrass;
                break;

            case 1:
                currentPlayerGroundLayer = GroundLayer.sand;
                break;

            case 2:
                currentPlayerGroundLayer = GroundLayer.wetSand;
                break;

            case 3:
                currentPlayerGroundLayer = GroundLayer.longGrass;
                break;

            case 4:
                currentPlayerGroundLayer = GroundLayer.stone;
                break;

            case 6:
                currentPlayerGroundLayer = GroundLayer.agricol;
                break;

            default:
                currentPlayerGroundLayer = GroundLayer.shortGrass;
                break;
            }
        }
        PlayFootstepSound();
    }
예제 #16
0
        public void Update(GameTime gameTime)
        {
            if (GroundLayer != null)
            {
                GroundLayer.Update(gameTime);
            }

            if (EdgeLayer != null)
            {
                EdgeLayer.Update(gameTime);
            }

            if (BuildingLayer != null)
            {
                BuildingLayer.Update(gameTime);
            }

            if (DecorationLayer != null)
            {
                DecorationLayer.Update(gameTime);
            }
        }
예제 #17
0
        public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Camera camera)
        {
            if (GroundLayer != null)
            {
                GroundLayer.Draw(gameTime, spriteBatch, TileSet, camera);
            }

            if (EdgeLayer != null)
            {
                EdgeLayer.Draw(gameTime, spriteBatch, TileSet, camera);
            }

            if (BuildingLayer != null)
            {
                BuildingLayer.Draw(gameTime, spriteBatch, TileSet, camera);
            }

            if (DecorationLayer != null)
            {
                DecorationLayer.Draw(gameTime, spriteBatch, TileSet, camera);
            }
        }
예제 #18
0
        //to save a variable we only use child object.  to find if its a parent object we just need to see
        //if mapobject is not null
        public void AddMapObject(MapObject mapObject, bool deleteBase, bool deleteLayerList, bool includeChildObject, TileLogistic tileLogistic, bool changeTileLogistic)
        {
            //We could also change this to have a bool of drawlayers or not
            this.mapObject = mapObject;

            if (includeChildObject)
            {
                childObject = mapObject;
            }

            if (deleteLayerList)
            {
                layerList = null;
            }
            if (deleteBase)
            {
                baseLayer = null;
            }

            if (changeTileLogistic)
            {
                this.tileLogistic = tileLogistic;
            }
        }
예제 #19
0
파일: Map.cs 프로젝트: Dongata/reintegrate
 public void Update(GameTime gameTime)
 {
     GroundLayer.Update(gameTime);
     MiddleLayer.Update(gameTime);
     TopLayer.Update(gameTime);
 }
예제 #20
0
파일: Map.cs 프로젝트: Dongata/reintegrate
 public void UnloadContent()
 {
     GroundLayer.UnloadContent();
     MiddleLayer.UnloadContent();
     TopLayer.UnloadContent();
 }
예제 #21
0
파일: Map.cs 프로젝트: Dongata/reintegrate
 public void LoadContent()
 {
     GroundLayer.LoadContent();
     MiddleLayer.LoadContent();
     TopLayer.LoadContent();
 }
예제 #22
0
파일: Map.cs 프로젝트: Dongata/reintegrate
 public void Draw(SpriteBatch spriteBatch)
 {
     GroundLayer.Draw(spriteBatch);
     MiddleLayer.Draw(spriteBatch);
     TopLayer.Draw(spriteBatch);
 }
예제 #23
0
 public void SetGroundTile(int x, int y, int index)
 {
     GroundLayer.SetTile(x, y, index);
 }
예제 #24
0
 public int GetGroundTile(int x, int y)
 {
     return(GroundLayer.GetTile(x, y));
 }