コード例 #1
0
 public Level(ILevelContext levelControl, List <Platform> platforms)
 {
     _levelControl = levelControl;
     _platforms    = platforms;
     Door          = platforms.Count == 0 ? null : new Door(platforms.Last().Box.TopRight - Vector2.X_UNIT / 2);
     Actors.Add(new Actor(this, platforms.Count == 0 ? new Point2(0, 0) : platforms[0].Box.TopLeft + Vector2.X_UNIT / 2));
 }
コード例 #2
0
 public void PhaseUpdate(ILevelContext context)
 {
     // The level director naturally won't advance phases
     // if there is an active text writer, so no need to
     // check here <3
     context.FlagAsComplete();
 }
コード例 #3
0
 public void PhaseUpdate(ILevelContext context)
 {
     if (!Object.FindObjectsOfType <SuicideEnemyAIBehavior>().Any())
     {
         context.FlagAsComplete();
     }
 }
コード例 #4
0
 public void PhaseUpdate(ILevelContext context)
 {
     if (fadeObject == null)
     {
         context.FlagAsComplete();
     }
 }
コード例 #5
0
        public void PhaseBegin(ILevelContext context)
        {
            // Nothing

            // Uncomment if testing dialogue
            //ComponentBase.InitiateDialogueExchange("Testing/test.xml");
        }
コード例 #6
0
        public void PhaseBegin(ILevelContext context)
        {
            flyingVFormationPrefab = ComponentBase.GetRequiredResource <GameObject>($"{ResourcePaths.PrefabsFolder}/Actors/Formations/{GameObjects.Formations.FlyingV}");

            GameObject asteroidPrefab = ComponentBase.GetRequiredResource <GameObject>($"{ResourcePaths.PrefabsFolder}/Projectiles/{GameObjects.Projectiles.Asteroid}");

            // Create an asteroid spawner which will generate a random asteroid ever buncha milliseconds
            asteroidSpawner = ComponentBase.InstantiateInLevel("AsteroidSpawner", Vector3.zero, typeof(AutoSpawnerComponent));
            ComponentBase.GetRequiredComponent <AutoSpawnerComponent>(asteroidSpawner).Initialize(500, asteroidPrefab);

            // This method is used to spawn enemies, initialize the phase, etc
            GameObject enemy = ComponentBase.GetRequiredResource <GameObject>($"{ResourcePaths.PrefabsFolder}/Actors/Enemies/Shooter_AI");

            GameObject inst = ComponentBase.InstantiateInLevel(enemy);

            inst.transform.position = new Vector3(-2, 3f, 3);
            GameObject inst2 = ComponentBase.InstantiateInLevel(enemy);

            inst2.transform.position = new Vector3(2, 3, 4);

            // A formation will spawn after a while
            intervalTimerObject = new GameObject("FormationSpawnTimer");

            intervalTimerObject.AddComponent <IntervalTimerComponent>();
            IntervalTimerComponent timer = ComponentBase.GetRequiredComponent <IntervalTimerComponent>(intervalTimerObject);

            timer.SetInterval(3000);
            timer.OnIntervalReached.AddListener(SpawnFormation);
            timer.SelfDestruct = true;
            timer.IsActive     = true;

            // Play some dank tunes
            ComponentBase.GetMusicPlayer().Loop(MusicPlayerComponent.Song.Prototype);
        }
コード例 #7
0
 public void PhaseUpdate(ILevelContext context)
 {
     if (timerReached)
     {
         Debug.Log("done");
         context.FlagAsComplete();
     }
 }
コード例 #8
0
        public void PhaseUpdate(ILevelContext context)
        {
            // This method is used for spawning more enemies, or checking if the phase is completed

            if (intervalReached)
            {
                // Check to see if any enemies exist
                if (!ComponentBase.ComponentExists <ShooterEnemyAIBehavior>() && flyingVObject == null)
                {
                    // todo: prevent from calling complete phase directly
                    context.FlagAsComplete();
                }
            }
        }
コード例 #9
0
        public void PhaseBegin(ILevelContext context)
        {
            GameObject enemy = ComponentBase.GetRequiredResource <GameObject>($"{ResourcePaths.PrefabsFolder}/Actors/Enemies{GameObjects.Actors.Kamikaze}");

            GameObject enemy1 = ComponentBase.InstantiateInLevel(enemy);

            enemy1.transform.position = new Vector3(1, 2f, 0);

            GameObject enemy2 = ComponentBase.InstantiateInLevel(enemy);

            enemy2.transform.position = new Vector3(-1, 3f, 0);

            for (int i = 0; i < 5; i++)
            {
                var inst = ComponentBase.InstantiateInLevel(enemy);
                inst.transform.position = new Vector3(i * 0.5f, i * 0.5f);
            }
        }
コード例 #10
0
        public void PhaseBegin(ILevelContext context)
        {
            GameObject asteroidPrefab = ComponentBase.GetRequiredResource <GameObject>($"{ResourcePaths.PrefabsFolder}/Projectiles/{GameObjects.Projectiles.Asteroid}");

            // Create an asteroid spawner which will generate a random asteroid every half second
            asteroidSpawner = ComponentBase.InstantiateInLevel("AsteroidSpawner", Vector3.zero, typeof(AutoSpawnerComponent));
            ComponentBase.GetRequiredComponent <AutoSpawnerComponent>(asteroidSpawner).Initialize(500, asteroidPrefab);


            // A formation will spawn after a while
            intervalTimerObject = new GameObject("FormationSpawnTimer");

            intervalTimerObject.AddComponent <IntervalTimerComponent>();
            IntervalTimerComponent timer = ComponentBase.GetRequiredComponent <IntervalTimerComponent>(intervalTimerObject);

            timer.SetInterval(15000); // 15 seconds
            timer.OnIntervalReached.AddListener(TimerDone);
            timer.SelfDestruct = true;
            timer.IsActive     = true;
        }
コード例 #11
0
        public Level Create(ILevelContext levelContext)
        {
            LevelContext = levelContext;

            DeathTaunts = new DeathTaunts(LevelContext);

            Build();

            var level = new Level(LevelContext, _platforms);

            PostBuild(level);

            if (level.Door != null)
            {
                level.Door.Location -= Vector2.X_UNIT * (level.Door.Size - 1) / 4.0;
            }

            level.OnActorDeath += actor => DeathTaunts.NotifyDeath(actor.LastPlatform);

            level.Init();

            return(level);
        }
コード例 #12
0
 public void PhaseComplete(ILevelContext context)
 {
     GameObject.Destroy(asteroidSpawner);
     Debug.Log("Phase 1 completed, you killed the guy!");
     context.BeginPhase(new TestLevelPhase2());
 }
コード例 #13
0
        public void PhaseBegin(ILevelContext context)
        {
            GameObject basicFadeInPrefab = ComponentBase.GetRequiredResource <GameObject>($"{ResourcePaths.PrefabsFolder}/Cameras/CameraEffects/BasicFadeIn");

            fadeObject = ComponentBase.InstantiatePrefab(basicFadeInPrefab, context.FindCanvas().transform);
        }
コード例 #14
0
 public void PhaseComplete(ILevelContext context)
 {
     GameObject.Destroy(asteroidSpawner);
 }
コード例 #15
0
 public void PhaseComplete(ILevelContext context)
 {
     Debug.Log("Phase 2 complteed.  You are a god among mortals.");
     context.BeginPhase(new TestLevelPhase3());
 }
コード例 #16
0
 public void PhaseComplete(ILevelContext context)
 {
     context.BeginPhase(new DP_100_IntroDialogue());
 }
コード例 #17
0
 public Level Create(ILevelContext levelContext)
 {
     return(new T().Create(levelContext));
 }
コード例 #18
0
 public void PhaseComplete(ILevelContext context)
 {
 }
コード例 #19
0
 public void PhaseComplete(ILevelContext context)
 {
     Debug.Log("You beat the entire game");
 }
コード例 #20
0
 public DeathTaunts(ILevelContext levelContext) => _levelContext = levelContext;
コード例 #21
0
 public void PhaseBegin(ILevelContext context)
 {
     ComponentBase.InitiateDialogueExchange("Demo/introSequence.xml");
 }
コード例 #22
0
 public void PhaseUpdate(ILevelContext context)
 {
 }
コード例 #23
0
 public void PhaseBegin(ILevelContext context)
 {
     ComponentBase.InitiateDialogueExchange("Testing/test.xml");
 }
コード例 #24
0
 public override void ComponentAwake()
 {
     Context = new LevelContext(this);
     Context.BeginPhase(LevelRepository.FindStartPhase(level));
     base.ComponentAwake();
 }