コード例 #1
0
ファイル: World.cs プロジェクト: luxkun/ggj2016
        public override void Start()
        {
            base.Start();

            //var backgroundMaskSprite = (SpriteAsset)Engine.GetAsset("backgroundshadow0");
            //var backgroundMask = new SpriteObject(backgroundMaskSprite.Width, backgroundMaskSprite.Height);
            //backgroundMask.CurrentSprite = backgroundMaskSprite;
            //backgroundMask.Order = 1;
            //backgroundMask.IgnoreCamera = true;
            //Engine.SpawnObject("backgroundMask", backgroundMask);

            // details
            objectsSpawnRate.Add(new Dictionary<SpriteObject, float>());

            var tree0AssetTop = (SpriteAsset) Engine.GetAsset("tree0_top");
            var tree0AssetBottom = (SpriteAsset) Engine.GetAsset("tree0_bottom");
            var tree0 = new TruncatedObject("tree0", tree0AssetBottom, tree0AssetTop) {Order = 2};
            objectsSpawnRate[0][tree0] = 2f;

            var ritualAsset = (SpriteAsset) Engine.GetAsset("ritual0_0_0");
            var ritual0 = new Ritual(ritualAsset.Width, ritualAsset.Height, Ritual.RitualType.Demoniac) {Order = 2};
            var ritual1 = new Ritual(ritualAsset.Width, ritualAsset.Height, Ritual.RitualType.Earth) {Order = 2};
            var ritual2 = new Ritual(ritualAsset.Width, ritualAsset.Height, Ritual.RitualType.Life) {Order = 2};
            objectsSpawnRate[0][ritual0] = 0.066f;
            objectsSpawnRate[0][ritual1] = 0.066f;
            objectsSpawnRate[0][ritual2] = 0.066f;

            var swamp0Asset = (SpriteAsset)Engine.GetAsset("swamp0");
            var swamp0 = new SpriteObject(swamp0Asset.Width, swamp0Asset.Height, true)
            {
                Name = "swamp0",
                CurrentSprite = swamp0Asset,
                Order = 2
            };
            objectsSpawnRate[0][swamp0] = 0.1f;

            // backgrounds
            objectsSpawnRate.Add(new Dictionary<SpriteObject, float>());
            var background0Asset = (SpriteAsset) Engine.GetAsset("background0");
            var background0 = new SpriteObject(background0Asset.Width, background0Asset.Height)
            {
                Name = "background0",
                CurrentSprite = background0Asset,
                Order = 0
            };
            objectsSpawnRate[1][background0] = 1f;

            // enemies
            objectsSpawnRate.Add(new Dictionary<SpriteObject, float>());
            var bear = EnemyInfo.bear;
            bear.Name = "bear0";
            bear.Order = 6;
            objectsSpawnRate[2][bear] = 1f;

            var rhyno = EnemyInfo.rhyno;
            bear.Name = "rhyno0";
            bear.Order = 6;
            objectsSpawnRate[2][rhyno] = 1f;

            var wolf = EnemyInfo.wolf;
            bear.Name = "wolf0";
            bear.Order = 6;
            objectsSpawnRate[2][wolf] = 1f;


            var count = 0;
            foreach (var dict in objectsSpawnRate)
            {
                rndRanges.Add(0);
                foreach (var pair in dict)
                {
                    rndRanges[count] += pair.Value;
                }
                count++;
            }

            maxPosition = new Vector2(Engine.Width*3, Engine.Height*3);
            var player = (Player) Engine.Objects["player"];
            calculatedStart = new Vector2(player.X, player.Y);
            calculatedEnd = new Vector2(player.X, player.Y);
            UpdateWorld(player);
        }
コード例 #2
0
ファイル: TruncatedObject.cs プロジェクト: luxkun/ggj2016
 public override GameObject Clone()
 {
     var go = new TruncatedObject(Name, bottomSpriteAsset, topSpriteAsset);
     return go;
 }