Exemplo n.º 1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            IsMouseVisible = false;
            gameDevice     = new GameDevice(Content, GraphicsDevice);
            gameManager    = new GameManager(gameDevice);

            sceneManager = new SceneManager(gameDevice);
            IScene dungeon = new DungeonScene(gameManager, gameDevice);
            IScene boss    = new BossScene(gameManager, gameDevice);
            IScene town    = new TownScene(gameManager, gameDevice);

            sceneManager.AddScene(SceneType.Load, new Load(gameDevice));
            sceneManager.AddScene(SceneType.Logo, new LogoScene(gameDevice));
            sceneManager.AddScene(SceneType.Title, new SceneFader(new Title(gameDevice), gameDevice));
            sceneManager.AddScene(SceneType.LoadTown, new LoadTown(gameManager, gameDevice));
            sceneManager.AddScene(SceneType.Town, new SceneFader(town, gameDevice));
            sceneManager.AddScene(SceneType.UpgradeStore, new UpgradeStore(town, gameManager, gameDevice));
            sceneManager.AddScene(SceneType.LoadShop, new LoadShop(town, gameManager, gameDevice));
            sceneManager.AddScene(SceneType.ItemShop, new ItemShop(town, gameManager, gameDevice));
            sceneManager.AddScene(SceneType.Quest, new GuildScene(town, gameManager, gameDevice));
            sceneManager.AddScene(SceneType.Depot, new Depot(town, gameManager, gameDevice));
            sceneManager.AddScene(SceneType.DungeonSelect, new SceneFader(new DungeonSelect(town, gameManager, gameDevice), gameDevice));
            sceneManager.AddScene(SceneType.LoadMap, new LoadMap(gameManager, gameDevice));
            sceneManager.AddScene(SceneType.Dungeon, new SceneFader(dungeon, gameDevice));
            sceneManager.AddScene(SceneType.LoadBoss, new LoadBossScene(gameManager, gameDevice));
            sceneManager.AddScene(SceneType.Boss, new SceneFader(boss, gameDevice));
            sceneManager.AddScene(SceneType.Pause, new PauseScene(dungeon, boss, town, gameManager, gameDevice));
            sceneManager.Change(SceneType.Load);

            base.Initialize();
        }
Exemplo n.º 2
0
        public override void AddScenes()
        {
            SceneManager.AddScene(dungeonScene = new DungeonScene());
            SceneManager.AddScene(playScene    = new StartScene());

            dungeonScene.Name = "Dugneon";
            playScene.Name    = "Play";
        }
Exemplo n.º 3
0
 private void removeStateVariables()
 {
     //remove all state variables
     DataManager.Instance.SetProgress(null);
     ZoneManager.Instance.Cleanup();
     DungeonScene.InitInstance();
     GroundScene.InitInstance();
     LuaEngine.Instance.Reset();
     LuaEngine.Instance.ReInit();
 }
Exemplo n.º 4
0
 public IEnumerator <YieldInstruction> Hit(BattleContext context)
 {
     DungeonScene.EventEnqueueFunction <BattleEvent> function = (StablePriorityQueue <GameEventPriority, Tuple <GameEventOwner, Character, BattleEvent> > queue, Priority maxPriority, ref Priority nextPriority) =>
     {
         //include the universal effect here
         DataManager.Instance.UniversalEvent.AddEventsToQueue(queue, maxPriority, ref nextPriority, DataManager.Instance.UniversalEvent.OnHits);
         AddEventsToQueue <BattleEvent>(queue, maxPriority, ref nextPriority, OnHits);
     };
     foreach (Tuple <GameEventOwner, Character, BattleEvent> effect in DungeonScene.IterateEvents <BattleEvent>(function))
     {
         yield return(CoroutineManager.Instance.StartCoroutine(effect.Item3.Apply(effect.Item1, effect.Item2, context)));
     }
 }
Exemplo n.º 5
0
 public IEnumerator <YieldInstruction> Hit(BattleContext context)
 {
     DungeonScene.EventEnqueueFunction <BattleEvent> function = (StablePriorityQueue <GameEventPriority, EventQueueElement <BattleEvent> > queue, Priority maxPriority, ref Priority nextPriority) =>
     {
         //include the universal effect here
         DataManager.Instance.UniversalEvent.AddEventsToQueue(queue, maxPriority, ref nextPriority, DataManager.Instance.UniversalEvent.OnHits, null);
         ZoneManager.Instance.CurrentMap.MapEffect.AddEventsToQueue(queue, maxPriority, ref nextPriority, ZoneManager.Instance.CurrentMap.MapEffect.OnHits, null);
         AddEventsToQueue <BattleEvent>(queue, maxPriority, ref nextPriority, OnHits, null);
     };
     foreach (EventQueueElement <BattleEvent> effect in DungeonScene.IterateEvents <BattleEvent>(function))
     {
         yield return(CoroutineManager.Instance.StartCoroutine(effect.Event.Apply(effect.Owner, effect.OwnerChar, context)));
     }
 }
Exemplo n.º 6
0
        //public IEnumerator<YieldInstruction> ArriveOnTile(Character character)

        //public IEnumerator<YieldInstruction> ArriveOnTile(Character character, bool checkItem, bool wantItem, bool noTrap)



        private IEnumerator <YieldInstruction> ProcessUseItem(GroundChar character, int invSlot, bool held)
        {
            InvItem invItem = null;

            if (held)
            {
                Character activeChar = DataManager.Instance.Save.ActiveTeam.Players[invSlot];
                invItem = activeChar.EquippedItem;
            }
            else
            {
                invItem = DataManager.Instance.Save.ActiveTeam.GetInv(invSlot);
            }

            ItemData itemEntry = (ItemData)invItem.GetData();

            switch (itemEntry.UsageType)
            {
            case ItemData.UseType.Learn:
            {
                ItemIndexState effect = itemEntry.ItemStates.GetWithDefault <ItemIndexState>();
                int            skill  = effect.Index;

                Character player = (Character)character.Data;
                int       learn  = -1;
                yield return(CoroutineManager.Instance.StartCoroutine(DungeonScene.TryLearnSkill(player, skill, (int slot) => { learn = slot; }, () => { })));

                if (learn > -1)
                {
                    yield return(CoroutineManager.Instance.StartCoroutine(DungeonScene.LearnSkillWithFanfare(player, skill, learn)));
                }
                else
                {
                    yield break;
                }
            }
            break;
            }

            if (held)
            {
                Character activeChar = DataManager.Instance.Save.ActiveTeam.Players[invSlot];
                activeChar.EquippedItem = new InvItem();
            }
            else
            {
                DataManager.Instance.Save.ActiveTeam.RemoveFromInv(invSlot);
            }
        }
Exemplo n.º 7
0
        private IEnumerator <YieldInstruction> checkLevelSkills(Character chara, int oldLevel)
        {
            DungeonScene.GetLevelSkills(chara, oldLevel);

            foreach (int skill in DungeonScene.GetLevelSkills(chara, oldLevel))
            {
                int learn = -1;

                yield return(CoroutineManager.Instance.StartCoroutine(DungeonScene.TryLearnSkill(chara, skill, (int slot) => { learn = slot; }, () => { })));

                if (learn > -1)
                {
                    yield return(CoroutineManager.Instance.StartCoroutine(DungeonScene.LearnSkillWithFanfare(chara, skill, learn)));
                }
            }
        }
Exemplo n.º 8
0
        public AILogic(Enemy character)
        {
            AI = character;
            DungeonScene scene = (DungeonScene)SceneManager.GetCurrentScene();

            player = scene.Player;
            random = new Random();

            movementElapsedTime = 0;
            attackElapsedTime   = 0;
            waitElapsedTime     = 0;

            attackDuration   = 0;
            movementDuration = 0;
            waitDuration     = 0;

            movementDirection = new Vector(0, 0);

            stateSwitch = true;
        }
Exemplo n.º 9
0
        public override void Initialize()
        {
            Name             = "Player";
            Character        = new Charles();
            Character.Holder = "Player";
            TotalHealth      = Character.MaxHealth;
            CurrentHealth    = TotalHealth;
            elapsedTintTime  = hitTime;
            elapsedRollTime  = rollCooldown;

            KeyCount         = 0;
            KeysUI           = new List <Key>();
            Rolling          = false;
            rollVelocity     = new Vector(0, 0);
            lastAimDirection = new Vector2(1, 0);
            Involnerable     = false;

            scene = (DungeonScene)SceneManager.GetCurrentScene();

            Character.OnSpawn();

            Sprite       = GetComponent <Sprite>();
            Animation    = GetComponent <Animation>();
            Transform    = GetComponent <Transform>();
            boxCollision = GetComponent <BoxCollision>();
            Physics      = GetComponent <Physics>();

            boxCollision.HandleCollision = handleCollision;
            boxCollision.Layer           = CollisionLayers.Player;

            Animation.CurrentAnimation = Character.IdleAnimation;
            Sprite.ContentName         = Character.SpriteSheet;

            jumpTrailStart = scene.CreateEntity <Trail>();
            jumpTrailEnd   = scene.CreateEntity <Trail>();
        }
Exemplo n.º 10
0
 public static int GetDualEffectiveness(Character attacker, Character target, BattleData skill)
 {
     return(DungeonScene.GetEffectiveness(attacker, target, skill, target.Element1) + DungeonScene.GetEffectiveness(attacker, target, skill, target.Element2));
 }
Exemplo n.º 11
0
 public static int GetDualEffectiveness(Character attacker, Character target, int targetElement)
 {
     return(DungeonScene.GetEffectiveness(attacker, target, targetElement, target.Element1) + DungeonScene.GetEffectiveness(attacker, target, targetElement, target.Element2));
 }