コード例 #1
0
ファイル: OverworldScene.cs プロジェクト: HaKDMoDz/armadillo
        public void SetZone(Zone zone, string doorName)
        {
            if (Zone != null)
            {
                var zoneData = Zone.ReadData();

                if (!(((SRPGGame) Game).ZoneData.ContainsKey(Zone.Key)))
                {
                    ((SRPGGame) Game).ZoneData.Add(Zone.Key, new byte[0]);
                }
                ((SRPGGame) Game).ZoneData[Zone.Key] = zoneData;
            }

            Zone = zone;
            _environment.SetZone(zone);

            var door = (from d in zone.Doors where d.Name == doorName select d).First();
            Avatar.Sprite.SetAnimation(string.Format("standing {0}", door.Orientation.ToString().ToLower()));
            Avatar.Location.X = door.Location.X + (door.Location.Width/2) - (Avatar.Sprite.Width/2);
            Avatar.Location.Y = door.Location.Y + (door.Location.Height / 2) - (Avatar.Sprite.Height / 2) - (Avatar.Sprite.Height - Avatar.GetFeet().Height) / 2;
            Avatar.Direction = door.Orientation;

            _startDoor = doorName;
        }
コード例 #2
0
ファイル: Environment.cs プロジェクト: HaKDMoDz/armadillo
        public void SetZone(Zone zone)
        {
            Components.Clear();
            _characters.Clear();

            _zone = zone;

            _avatar = ((OverworldScene) Scene).Avatar;
            Components.Add(_avatar.Sprite);

            var i = 0;
            foreach (var image in zone.ImageLayers)
            {
                image.Parent = this;
                Components.Add(image);
                i++;
            }

            foreach(var character in zone.Characters.Keys)
            {
                zone.Characters[character].Sprite.Parent = this;
                _characters.Add(character, zone.Characters[character]);
                Components.Add(zone.Characters[character].Sprite);
            }

            #if DEBUG_ENV
            // highlight all doors in green
            foreach (var door in zone.Doors)
            {
                Components.Add(new TextureObject(Game, this)
                    {
                        X = door.Location.X,
                        Y = door.Location.Y,
                        Width = door.Location.Width,
                        Height = door.Location.Height,
                        Color = Color.LightGreen,
                        DrawOrder = 10001,
                        Alpha = 0.75f
                    });
            }

            // highlight all interactive objects in orange
            foreach (var obj in zone.Objects)
            {
                Components.Add(new TextureObject(Game, this)
                    {
                        X = obj.Location.X,
                        Y = obj.Location.Y,
                        Width = obj.Location.Width,
                        Height = obj.Location.Height,
                        Color = Color.Orange,
                        DrawOrder = 10002,
                        Alpha = 0.75f
                    });
            }

            // show the sandbag layer
            Components.Add(new ImageObject(Game, this, _zone.SandbagImage){
                Alpha = 0.5f,
                XScale = 6.0f,
                YScale = 6.0f,
                DrawOrder = 10000
            });
            #endif

            // sandbags are down scaled 1:6
            _width = zone.Sandbag.Size.Width * 6;
            _height = zone.Sandbag.Size.Height * 6;
        }