Пример #1
0
        private void GenerateLandscape()
        {
            List<GameObject> spawnedObjects = new List<GameObject>();

            m_house = new Hs_Building();

            ///
            ///	Backgrounds
            ///
            List<BackgroundObject> backgrounds;
            backgrounds = BackgroundObject.CreateBackgroundObjects((int)(ActiveTileCount * 1.25f), null, new Vector2(TotalLevelWidth, 1), new Vector2(50, 0), StyleManager.LevelStyle.Country, 0);
            for (int i = 0; i < backgrounds.Count; ++i)
                backgrounds[i].Transform.PosY -= 20;
            spawnedObjects.AddRange(backgrounds);

            backgrounds = BackgroundObject.CreateBackgroundObjects((int)(ActiveTileCount * 1.5f), null, new Vector2(TotalLevelWidth, 1), new Vector2(50, 0), StyleManager.LevelStyle.Country, 1);
            for (int i = 0; i < backgrounds.Count; ++i)
                backgrounds[i].Transform.PosY -= 100;
            spawnedObjects.AddRange(backgrounds);

            backgrounds = BackgroundObject.CreateBackgroundObjects(ActiveTileCount * 2, null, new Vector2(TotalLevelWidth, 1), new Vector2(50, 0), StyleManager.LevelStyle.Country, 2);
            for (int i = 0; i < backgrounds.Count; ++i)
                backgrounds[i].Transform.PosY -= 200;
            spawnedObjects.AddRange(backgrounds);

            m_levelObjects[(int)LevelObjectType.Backgrounds] = spawnedObjects;

            ///
            /// Earth Tiles
            ///
            spawnedObjects = new List<GameObject>();
            for (int i = 0; i < m_earthTiles.Length; ++i)
            {
                m_earthTiles[i] = new EarthTile(i);
                spawnedObjects.Add(m_earthTiles[i]);
            }
            m_levelObjects[(int)LevelObjectType.EarthTile] = spawnedObjects;
        }
 public void SetMovingIn(House finishHouse)
 {
     if (!IsDead)
     {
         m_currentState = BackpackerState.MovingOut;
        // PlaceBetween(finishHouse.HouseSprite, finishHouse.EntranceMask);
         m_actionManager.StartNew(new SpriteSheetAnimation(m_sprite, 0, 1, 0.05f, -1));
         m_targetX = finishHouse.HouseExitPoint;
         Transform.ParentTransform = null;
     }
 }
 public void SetMovingOut(House startHouse)
 {
     //if (!IsDead)
     //{
     //    m_currentState = BackpackerState.MovingOut;
     //    m_targetX += startHouse.RallyPoint;
     //    m_actionManager.StartNew(new Animation(m_sprite, 0, 1, 0.09f, true));
     //}
 }
        public void SetAtStart(House startHouse)
        {
            if (!IsDead)
            {
                Transform.ParentTransform = null;
                m_currentState = BackpackerState.Idle;

                if (startHouse == null)
                {
                    Transform.PosX = -100;
                }
                else
                {
                    Transform.PosX = startHouse.HouseExitPoint;
                }
            }
        }