Пример #1
0
        public override void Initialize()
        {
            base.Initialize();

            AddEntity(new SeedCountHud());
            AddEntity(new MainHUD());

            Player player = new Player(NamedPositions.ChickenCoopDoor);

            AddEntity(player);

            GameState.Instance.SetVar <bool>("immediately_finish", false);

            GameState.Instance.SetVar <int>("background_height", 0);       // SET IN BACKGROUND CLASS
            GameState.Instance.SetVar <int>("background_y", 0);            // SET IN BACKGROUND CLASS
            AddEntity(new Background(new Vector2(0, 0)));
            AddEntity(new Foreground(new Vector2(0, 0)));
            GameState.Instance.SetVar <int>("BEAT_Y", GetWindowHeight() - 150);

            BeatHUD beatHUD = new BeatHUD();

            AddEntity(beatHUD);

            SuspicionBar suspicionBar = new SuspicionBar(new Vector2(GetWindowWidth() - 100, 200));

            AddEntity(suspicionBar);

            Camera.FollowEntity(player);

            GameState.Instance.SetVar <Player>("player", player);
            GameState.Instance.SetVar <int>("seeds", 0);

            GameState.Instance.SetVar <bool>("is_beat", false);
            GameState.Instance.SetVar <Beat>("current_beat", null);
            GameState.Instance.SetVar <List <Beat> >("beat_list", new List <Beat>());

            GameState.Instance.SetVar <int>("max_distance_to_chicken", 600);
            GameState.Instance.SetVar <float>("distance_to_chicken_percent", 1f);

            GameState.Instance.SetVar <string>("current_level_name", "Level 2");
            GameState.Instance.SetVar <Scene>("current_level", this);


            // BANNER HARDCODED STUFF
            float bannerScaleFactor = (float)GameState.Instance.GetCurrentScene().GetWindowWidth() / 4850;

            GameState.Instance.SetVar <int>("banner_height", (int)(bannerScaleFactor * 590));


            BeatManager beatManager = new BeatManager(GetSoundManager(), "main_theme");

            beatManager.PlaySong();
            AddSpawnController(beatManager);
        }
Пример #2
0
        public override void LoadContent()
        {
            base.LoadContent();
            XmlManager <Player> playerLoader = new XmlManager <Player>();

            player = playerLoader.Load("Load/Gameplay/Player.xml");

            XmlManager <SuspicionOverlay> suspLoader = new XmlManager <SuspicionOverlay>();

            suspicionOverlay       = suspLoader.Load("Load/Gameplay/Overlays/SuspicionOverlay.xml");
            suspicionOverlay.Alpha = 0.5f;
            //if loading from a GameState info....
            if (GameState.Instance.EnteringDungeon)
            {
                if (GameState.Instance.PlayerExists)
                {
                    player.Stats = GameState.Instance.PlayerStats;
                }//else the default value will be used as normal having not been overwritten

                map = DungeonCreator.CreateMap(3, GameState.Instance);
            }
            else
            {
                map = DungeonCreator.CreateMap(3);
            }


            AIMoveManager.Instance.StartNewFloor(map, NumOfEnemies);
            map.LoadContent(true);


            ContentManager content = new ContentManager(ScreenManager.Instance.Content.ServiceProvider, "Content");

            font = content.Load <SpriteFont>("Gameplay/Fonts/Font1");

            int tilesacross;

            if (ScreenManager.Instance.Dimensions.X % map.TileDimensions.X != 0)
            {
                tilesacross = ((int)ScreenManager.Instance.Dimensions.X / (int)map.TileDimensions.X) + 1;
            }
            else
            {
                tilesacross = ((int)ScreenManager.Instance.Dimensions.X / (int)map.TileDimensions.X);
            }

            int tilesdown;

            if (ScreenManager.Instance.Dimensions.Y % map.TileDimensions.Y != 0)
            {
                tilesdown = ((int)ScreenManager.Instance.Dimensions.Y / (int)map.TileDimensions.Y) + 1;
            }
            else
            {
                tilesdown = ((int)ScreenManager.Instance.Dimensions.Y / (int)map.TileDimensions.Y);
            }
            tilesOnScreen = new Vector2(tilesacross, tilesdown);



            player.LoadContent(map.TileDimensions, map.EntryLoc + new Vector2(0, 1), map);
            suspicionOverlay.LoadContent((int)map.TileDimensions.X);
            map.SpawnEnemies(NumOfEnemies, player.CurrentRoomIn);

            camera = new Camera(map.Size, tilesOnScreen, map.TileDimensions, player.TilePosition);
            StealthManager.Instance.StartNewFloor(map);

            XmlManager <HealthBar> HPBL = new XmlManager <HealthBar>();

            HPBar = HPBL.Load("Load/Gameplay/HealthBar.xml");
            HPBar.LoadContent();

            XmlManager <SuspicionBar> SBL = new XmlManager <SuspicionBar>();

            suspicionBar = SBL.Load("Load/Gameplay/SuspicionBar.xml");
            suspicionBar.LoadContent();

            TotalEnemies   = map.D.Next(10, 30);//will be overruled by Quests later though if necessary
            EnemiesAtATime = NumOfEnemies;
            //	TotalEnemies = 25;
            if (GameState.Instance.IsCreated)
            {
                if (GameState.Instance.QuestForDungeon(GameState.Instance.CurrentDungeon, out Quest QuestIfAny))
                {
                    if (QuestIfAny.GetType() == typeof(DungeonQuest))
                    {
                        DungeonQuest CurrentQ = QuestIfAny as DungeonQuest;
                        TotalEnemies = CurrentQ.TotalEnemies;
                        if (CurrentQ.CurrentEnemies > 0)
                        {
                            EnemiesAtATime = CurrentQ.CurrentEnemies;
                        }
                        CurrentQuest = QuestIfAny;
                        CurrentQuest.Populate();
                    }
                }
            }


            GameState.Instance.EnteringDungeon = false;//resets in case of error elsewhere
            GameState.Instance.PlayerExists    = true;

            exiting = false;
        }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        anim = GetComponent<Animator> ();
        anim.SetBool ("NPC", true);
        anim.SetBool ("wolfForm", false);
        anim.SetBool ("up", false);
        anim.SetBool ("down", false);
        anim.SetBool ("left", false);
        anim.SetBool ("right", false);
        anim.SetBool ("Move", false);

        bravery = Random.Range (1.1f, 1.5f);

        velocity = new Vector2 (0.0f, 0.0f);
        currentPath = new List<Tile>();
        speed = baseSpeed;
        suspicion_bar = this.GetComponent <SuspicionBar> ();
    }