예제 #1
0
        private void RenderHeightDeltas(CMap controller)
        {
            foreach (var tile in controller.GetMap().GetTiles())
            {
                if (tile.Model.GetS() == null)
                {
                    this.AttachHeightBottom(tile, 1);
                }
                else if (tile.Model.GetS().GetHeight() < tile.Model.GetHeight())
                {
                    this.AttachHeightBottom(tile, tile.Model.GetHeight() - tile.Model.GetS().GetHeight());
                }

                if (tile.Model.GetSW() == null)
                {
                    this.AttachHeightLeft(tile, 1);
                }
                else if (tile.Model.GetSW().GetHeight() < tile.Model.GetHeight())
                {
                    this.AttachHeightLeft(tile, tile.Model.GetHeight() - tile.Model.GetSW().GetHeight());
                }

                if (tile.Model.GetSE() == null)
                {
                    this.AttachHeightRight(tile, 1);
                }
                else if (tile.Model.GetSE().GetHeight() < tile.Model.GetHeight())
                {
                    this.AttachHeightRight(tile, tile.Model.GetHeight() - tile.Model.GetSE().GetHeight());
                }
            }
        }
예제 #2
0
 public void InitTiles(CMap controller, MapInitInfo info, Transform tileHolder)
 {
     this.InitTileSprites();
     foreach (var tile in controller.GetMap().GetTiles())
     {
         this.InitTileType(tile, info);
         if (tile.Model.Liquid)
         {
             this.InitLiquidTile(tile, tileHolder);
         }
         else
         {
             this.InitNonLiquidTile(tile, tileHolder);
         }
     }
     controller.GetMap().InitControllerAdjacent();
 }
예제 #3
0
        private void InitViews(CMap map, MapInitInfo info)
        {
            var builder = new CharViewBuilder();

            foreach (var party in map.GetLParties())
            {
                foreach (var c in party.GetChars())
                {
                    c.SetView(builder.Build(c.Proxy));
                    var tile = map.GetMap().GetTileForRow(c.Proxy.LParty, c.Proxy.StartCol);
                    this.RenderChar(c, tile);
                }
            }
            foreach (var party in map.GetRParties())
            {
                foreach (var c in party.GetChars())
                {
                    c.SetView(builder.Build(c.Proxy));
                    var tile = map.GetMap().GetTileForRow(c.Proxy.LParty, c.Proxy.StartCol);
                    this.RenderChar(c, tile);
                }
            }
        }
예제 #4
0
        public void InitLandmarks(CMap controller, MapInitInfo info)
        {
            var biomeParams = BiomeTable.Instance.Table[info.Biome];

            foreach (var tile in controller.GetMap().GetTiles())
            {
                foreach (var kvp in biomeParams.LandmarkDict)
                {
                    var roll = RNG.Instance.NextDouble();
                    if (roll < kvp.Value)
                    {
                        var factory = new LandmarkFactory();
                        factory.BuildLandmark(kvp.Key, tile);
                    }
                }
            }
        }
예제 #5
0
        public void InitMapEnvironment(CMap controller, MapInitInfo info)
        {
            var decoLoader  = new DecoLoader();
            var biomeParams = BiomeTable.Instance.Table[info.Biome];

            foreach (var decoKVP in biomeParams.DecoDict)
            {
                foreach (var tile in controller.GetMap().GetTiles())
                {
                    var roll = RNG.Instance.NextDouble();
                    if (roll < decoKVP.Value && !FTile.HasFlag(tile.GetFlags().CurFlags, FTile.Flags.Environment))
                    {
                        decoLoader.AttachDeco(tile, decoKVP.Key);
                    }
                }
            }
        }
예제 #6
0
 private void RenderHeightOffsets(CMap controller)
 {
     foreach (var tile in controller.GetMap().GetTiles())
     {
         if (tile.Model.GetHeight() > 1)
         {
             var delta  = (tile.Model.GetHeight() - 1) * ViewParams.HEIGHT_OFFSET;
             var center = tile.Model.Center;
             var y      = center.y + delta;
             center.y = y;
             tile.Model.SetCenter(center);
             var render = tile.Handle.GetComponent <SpriteRenderer>();
             render.transform.position = center;
             render.sortingOrder       = tile.Model.GetHeight();
         }
     }
 }
예제 #7
0
 private void InitAI(CMap map)
 {
     this._ai = new CCombatParticle(map.GetMap().GetTiles());
     foreach (var party in this._combatData.LParties)
     {
         foreach (var agent in party.GetChars())
         {
             this._ai.SetAgentParticlePoints(agent, true);
         }
     }
     foreach (var party in this._combatData.RParties)
     {
         foreach (var agent in party.GetChars())
         {
             this._ai.SetAgentParticlePoints(agent, false);
         }
     }
 }