Beispiel #1
0
 void Start()
 {
     /// LoadManager.startLoad(this, "file:///" + Application.dataPath + "/StreamingAssets/zombie_windows", delegate()
     //{ ZombieFactory._Instance.LoadLeval(1); });
     Invoke("LoadNextLevel", 1f);
     currentZombieCount = BossFactory.Updayezombie();
 }
Beispiel #2
0
        private void ShowBossButtons()
        {
            foreach (var bossButtonPair in _bossButtons)
            {
                var bossButton = bossButtonPair.Value;

                bossButton.SubstituteEntity.EnableSynchronization(true);

                var hasRelation = _bossRelations.ContainsKey(bossButton.Name);

                var available = !hasRelation ||
                                (Game.PlayerData.BossBeatenCounter(BossFactory.StringToBossType(_bossRelations[bossButton.Name].Item1)) > 0 &&
                                 Game.PlayerData.BossBeatenCounter(BossFactory.StringToBossType(_bossRelations[bossButton.Name].Item2)) > 0);

                var hidden = Game.PlayerData.BossAttempts(BossFactory.StringToBossType(bossButton.Name)) == 0;

                if (!hasRelation || (available && !hidden))
                {
                    var beaten = Game.PlayerData.BossBeatenCounter(BossFactory.StringToBossType(bossButton.Name)) > 0;

                    bossButton.Animator().AddTextureSwap(
                        "Graphics/GUI/BossSelection/unknown-boss-button",
                        Assets.GetTexture2D("Graphics/GUI/BossSelection/xmas-" + bossButton.Name + "-" + ((beaten) ? "beaten" : "available") + "-button")
                        );
                }
                else
                {
                    bossButton.Name = "Unknown";
                }

                Game.GuiManager.AddButton(bossButton);
            }

            EnableBossButtons();
        }
Beispiel #3
0
        // TODO: This should be handled by the ScreenManager
        public override void Show(bool reset = false)
        {
            base.Show(reset);

            _player.Initialize();
            _boss = BossFactory.CreateBoss(BossType.Debug, Game, _player.Position);
            _boss.Initialize();
        }
Beispiel #4
0
 /// <summary>
 /// 加载下一关
 /// </summary>
 public void LoadNextLevel()
 {
     Debug.Log("加载当前关卡:" + currentLevel);
     BossFactory.LoadLevel(currentLevel);
     BossFactory.Updayezombie();
     //通知ui显示
     GameMainUI.Instance.InitGameMainData(currentLevel.ToString(), BossFactory.Instance.getCurrentLevelzombieCount.ToString());
 }
Beispiel #5
0
        private void OnBossButtonAction(object button, Point position)
        {
            var spriterGuiButton = button as SpriterGuiButton;
            var bossType         = BossFactory.StringToBossType(spriterGuiButton.Name);

            if (bossType != BossType.Unknown)
            {
                OpenBossPanel(bossType);
            }
        }
        private void OnBossButtonAction(object button, Point position)
        {
            var spriterGuiButton = button as SpriterGuiButton;

            // Make sure the ball is entirely visible
            spriterGuiButton.SubstituteEntity.SubstituteAnimator.Color =
                new Color(spriterGuiButton.SubstituteEntity.SubstituteAnimator.Color, 1f);

            var bossType = BossFactory.StringToBossType(spriterGuiButton.Name);

            if (bossType != BossType.Unknown)
            {
                OpenBossPanel(bossType);
            }
        }
 public BossStatement(ShootingGame game, List<string> args)
 {
     this.game = game;
     if (args.Count < 2)
     {
         throw new FormatException("b without boss name.");
     }
     var name = args[1];
     if (name == "test")
     {
         factory = new TestBossFactory(game);
     }
     else
     {
         throw new FormatException(string.Format("Unknown boss name \"{0}\"", name));
     }
 }
Beispiel #8
0
        public override void Show(bool reset = false)
        {
            base.Show(reset);

            Game.GameManager.StartNewGame();

            Game.SpriteBatchManager.AddSpriterAnimator(_spriterFile["GameScreen"], Layer.UI);

            Game.SpriteBatchManager.UILabels.Add(_timerLabelShadow);
            Game.SpriteBatchManager.UILabels.Add(_timerLabel);
            Game.SpriteBatchManager.UISprites.Add(_hpBar);

            var level = BossFactory.BossTypeToBackgroundLevel(Game.GameManager.GetCurrentBoss().BossType);

            ((GradientBackground)Game.SpriteBatchManager.Background).ChangeGradientColors(GameConfig.BackgroundGradients[level].Item1, GameConfig.BackgroundGradients[level].Item2);

            Game.MusicManager.PlayGameMusic(true);
        }
Beispiel #9
0
 public BowserFireball(bool travelingLeft, int positionInGameX, int positionInGameY) : base(null, new Point(), new Vector2())
 {
     this.SpriteFactory      = BossFactory.GetInstance();
     this.IsCollidable       = true;
     this.SetYPositionInGame = positionInGameY + 32;
     if (travelingLeft)
     {
         this.Sprite             = this.SpriteFactory.CreateProduct(BossTypes.FireballLeft);
         this.SetXPositionInGame = positionInGameX;
         this.XSpeed             = -6.0f;
     }
     else
     {
         this.Sprite             = this.SpriteFactory.CreateProduct(BossTypes.FireballRight);
         this.SetXPositionInGame = positionInGameX + 68;
         this.XSpeed             = 6.0f;
     }
 }
Beispiel #10
0
 /// <summary>
 /// 检测结束死亡
 /// </summary>
 public void ZombieDeadNotify()
 {
     currentZombieCount--;
     if (currentZombieCount <= Random.Range(1, 3))
     {
         currentZombieCount += BossFactory.Updayezombie();
     }
     if (currentZombieCount <= 0)
     {
         Debug.Log("Game Over.....");
         RootCanvas.setActive("BoderRedImage/GameSucess", true);
         EventTriggerListener.GetName("SucessNextButton").onClick = delegate(GameObject obj)
         {
             currentLevel++;
             LoadNextLevel();
             RootCanvas.setActive("BoderRedImage/GameSucess", false);
         };
         if (currentLevel >= 6)
         {
             RootCanvas.setActive("BoderRedImage/AllSucess", true);
         }
     }
 }
Beispiel #11
0
        public static GameObject CheckCharacters(Entity entity)
        {
            switch (entity.Type)
            {
            case "Player":
                GameObject mario = Mario.GetInstance();
                ((Mario)mario).CheckpointPosition = entity.CheckpointX;
                if (((Mario)mario).Checkpoint)
                {
                    mario.PositionInGame = new Point(entity.CheckpointX, entity.CheckpointY);
                }
                else
                {
                    mario.PositionInGame = new Point(entity.X, entity.Y);
                }
                CostumeChanger.GetInstance().Setup();
                return(mario);

            case "Goomba":
                return(new Goomba(EnemyFactory.GetInstance(), new Point(entity.X, entity.Y)));

            case "GreenKoopa":
                return(new Koopa(EnemyFactory.GetInstance(), new Point(entity.X, entity.Y), false));

            case "RedKoopa":
                return(new Koopa(EnemyFactory.GetInstance(), new Point(entity.X, entity.Y), true));

            case "PiranhaPlant":
                return(new PiranhaPlant(EnemyFactory.GetInstance(), new Point(entity.X, entity.Y)));

            case "Bowser":
                return(new Bowser(BossFactory.GetInstance(), new Point(entity.X, entity.Y)));

            default:
                return(null);
            }
        }
Beispiel #12
0
        protected override void InitializeSpriterGui()
        {
            Animators["BossSelection"].AnimationFinished += BossSelectionScreen_AnimationFinished;
            Animators["BossPanel"].AnimationFinished     += BossPanel_AnimationFinished;

            Animators["Ball"].zIndex(9);
            Animators["Garland"].zIndex(5);
            Animators["BossPanel"].zIndex(10);

            // Christmas tree's balls
            foreach (var bossName in _bossNames)
            {
                var ballAnimator = Animators["Ball"].Clone();
                ballAnimator.Play("Balance");
                ballAnimator.Progress = (float)Game.GameManager.Random.NextDouble();
                ballAnimator.Speed    = 0.5f + (float)Game.GameManager.Random.NextDouble();

                var hasRelation = _bossRelations.ContainsKey(bossName);

                if (hasRelation)
                {
                    _bossGarlands.Add(new SpriterSubstituteEntity(
                                          "xmas-" + _bossRelations[bossName].Item1 + "-" + bossName + "-garland.png",
                                          Animators["BossSelection"], Animators["Garland"].Clone()
                                          ));

                    _bossGarlands.Add(new SpriterSubstituteEntity(
                                          "xmas-" + _bossRelations[bossName].Item2 + "-" + bossName + "-garland.png",
                                          Animators["BossSelection"], Animators["Garland"].Clone()
                                          ));
                }

                var bossButton = new SpriterGuiButton(
                    Game.ViewportAdapter, bossName, "Graphics/GUI/BossSelection/xmas-" + bossName + "-available-button.png",
                    ballAnimator, Animators["BossSelection"]
                    );

                bossButton.Action += OnBossButtonAction;
                _bossButtons.Add(BossFactory.StringToBossType(bossName), bossButton);
            }

            // Boss panel buttons
            _closeBossPanelButton = new SpriterGuiButton(
                Game.ViewportAdapter, "CloseBossPanel", "Graphics/GUI/BossSelection/boss-panel-close-button.png",
                Animators["CloseButton"], Animators["BossPanel"]
                );

            _startBattleBossPanelButton = new SpriterGuiButton(
                Game.ViewportAdapter, "StartBattleBossPanel", "Graphics/GUI/BossSelection/boss-panel-battle-button.png",
                Animators["BattleButton"], Animators["BossPanel"]
                );

            _closeBossPanelButton.Action       += BossPanelCloseButtonAction;
            _startBattleBossPanelButton.Action += BossPanelStartBattleButtonAction;

            _closeBossPanelButton.Animator().zIndex(11);
            _startBattleBossPanelButton.Animator().zIndex(11);

            _bossPanelButtons.Add(_closeBossPanelButton);
            _bossPanelButtons.Add(_startBattleBossPanelButton);

            // Labels
            _bossNameLabel    = new SpriterGuiLabel("Unknown", Assets.GetFont("Graphics/Fonts/ui-title"), "boss-panel-title-label.png", Animators["BossPanel"], true);
            _bestTimeLabel    = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-best-time-label.png", Animators["BossPanel"]);
            _playTimeLabel    = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-play-time-label.png", Animators["BossPanel"]);
            _playerDeathLabel = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-player-deaths-label.png", Animators["BossPanel"]);
            _bossDeathLabel   = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-boss-deaths-label.png", Animators["BossPanel"]);

            _bossPanelLabels.Add(_bossNameLabel);
            _bossPanelLabels.Add(_bestTimeLabel);
            _bossPanelLabels.Add(_playTimeLabel);
            _bossPanelLabels.Add(_playerDeathLabel);
            _bossPanelLabels.Add(_bossDeathLabel);

            base.InitializeSpriterGui();

            ResetUI();
        }
        private void ShowBossButtons()
        {
            foreach (var bossButtonPair in _bossButtons)
            {
                var bossButton = bossButtonPair.Value;
                var bossType   = BossFactory.StringToBossType(bossButton.Name);

                bossButton.SubstituteEntity.EnableSynchronization(true);

                var hasRelation = _bossRelations.ContainsKey(bossButton.Name);

                var available = !hasRelation ||
                                (Game.PlayerData.BossBeatenCounter(BossFactory.StringToBossType(_bossRelations[bossButton.Name].Item1)) > 0 &&
                                 Game.PlayerData.BossBeatenCounter(BossFactory.StringToBossType(_bossRelations[bossButton.Name].Item2)) > 0);

                if (Array.IndexOf(GameConfig.EnabledBosses, bossType) == -1)
                {
                    available = false;
                }

                if (available)
                {
                    var beaten = Game.PlayerData.BossBeatenCounter(bossType) > 0;
                    var hidden = Game.PlayerData.DeathCounter(bossType) == 0 && Game.PlayerData.BossBeatenCounter(bossType) == 0;
                    var buttonTextureSwapName = "xmas-" + bossButton.Name + "-" + ((beaten) ? "beaten" : "available") + "-button";

                    if (hasRelation && hidden)
                    {
                        buttonTextureSwapName = "hidden-boss-button";
                    }

                    if (hasRelation)
                    {
                        var relation1     = _bossRelations[bossButton.Name].Item1;
                        var relation2     = _bossRelations[bossButton.Name].Item2;
                        var animationName = (beaten) ? "FlashBeaten" : "FlashAvailable";

                        _bossGarlands[relation1 + "-" + bossButton.Name].SubstituteAnimator.Play(animationName);
                        _bossGarlands[relation2 + "-" + bossButton.Name].SubstituteAnimator.Play(animationName);

                        _bossGarlands[relation1 + "-" + bossButton.Name].SubstituteAnimator.Speed = 0.5f + (float)Game.GameManager.Random.NextDouble() / 2f;
                        _bossGarlands[relation2 + "-" + bossButton.Name].SubstituteAnimator.Speed = 0.5f + (float)Game.GameManager.Random.NextDouble() / 2f;

                        _bossGarlands[relation1 + "-" + bossButton.Name].SubstituteAnimator.Progress = (float)Game.GameManager.Random.NextDouble();
                        _bossGarlands[relation2 + "-" + bossButton.Name].SubstituteAnimator.Progress = (float)Game.GameManager.Random.NextDouble();
                    }

                    bossButton.Animator().AddTextureSwap(
                        "Graphics/GUI/BossSelection/unknown-boss-button",
                        Assets.GetTexture2D("Graphics/GUI/BossSelection/" + buttonTextureSwapName)
                        );
                }
                else
                {
                    bossButton.Name = "Unknown";
                }

                Game.GuiManager.AddButton(bossButton);
            }

            EnableBossButtons();
        }
Beispiel #14
0
 public Engine()
 {
     this.bossFactory = new BossFactory();
     this.heroes      = new HashSet <BaseHero>();
     this.heroFactory = new HeroFactory();
 }
Beispiel #15
0
 void Awake()
 {
     Instance = this;
 }
Beispiel #16
0
 public void LoadBoss(BossType bossType)
 {
     _boss = BossFactory.CreateBoss(bossType, _game, _player.Position);
 }
        private void InitializeSpriterGui()
        {
            SpriterFile["Main"].AnimationFinished      += BossSelectionScreen_AnimationFinished;
            SpriterFile["BossPanel"].AnimationFinished += BossPanel_AnimationFinished;

            SpriterFile["Garland"].ZIndex(5);
            SpriterFile["BallHook"].ZIndex(6);
            SpriterFile["Ball"].ZIndex(9);
            SpriterFile["BossPanel"].ZIndex(10);

            // Christmas tree's balls
            foreach (var bossName in _bossNames)
            {
                var ballAnimator = SpriterFile["Ball"].Clone();
                var hasRelation  = _bossRelations.ContainsKey(bossName);

                for (int i = 0; i < 10; i++)
                {
                    _ballHooks.Add(new SpriterSubstituteEntity("garland-forbidden-ball.png", SpriterFile["Main"], SpriterFile["BallHook"].Clone(), "garland-forbidden-ball_00" + i));
                }

                if (hasRelation)
                {
                    var garlandAnimator1 = SpriterFile["Garland"].Clone();
                    var garlandAnimator2 = SpriterFile["Garland"].Clone();

                    garlandAnimator1.Play("FlashForbidden");
                    garlandAnimator2.Play("FlashForbidden");
                    garlandAnimator1.Speed    = 0.5f + (float)Game.GameManager.Random.NextDouble() / 2f;
                    garlandAnimator2.Speed    = 0.5f + (float)Game.GameManager.Random.NextDouble() / 2f;
                    garlandAnimator1.Progress = (float)Game.GameManager.Random.NextDouble();
                    garlandAnimator2.Progress = (float)Game.GameManager.Random.NextDouble();

                    _bossGarlands.Add(
                        _bossRelations[bossName].Item1 + "-" + bossName,
                        new SpriterSubstituteEntity(
                            "xmas-" + _bossRelations[bossName].Item1 + "-" + bossName + "-garland.png",
                            SpriterFile["Main"], garlandAnimator1
                            )
                        );

                    _bossGarlands.Add(
                        _bossRelations[bossName].Item2 + "-" + bossName,
                        new SpriterSubstituteEntity(
                            "xmas-" + _bossRelations[bossName].Item2 + "-" + bossName + "-garland.png",
                            SpriterFile["Main"], garlandAnimator2
                            )
                        );
                }

                var bossButton = new SpriterGuiButton(
                    Game.ViewportAdapter, bossName, "Graphics/GUI/BossSelection/xmas-" + bossName + "-available-button.png",
                    ballAnimator, SpriterFile["Main"], "Balance", null, "Audio/SE/select1"
                    );

                bossButton.SubstituteEntity.SubstituteAnimator.Progress = (float)Game.GameManager.Random.NextDouble();
                bossButton.SubstituteEntity.SubstituteAnimator.Speed    = 0.5f + (float)Game.GameManager.Random.NextDouble();

                bossButton.Action += OnBossButtonAction;
                _bossButtons.Add(BossFactory.StringToBossType(bossName), bossButton);
            }

            // Boss panel buttons
            var closeBossPanelButton = new SpriterGuiButton(
                Game.ViewportAdapter, "CloseBossPanel", "Graphics/GUI/BossSelection/boss-panel-close-button.png",
                SpriterFile["CloseButton"], SpriterFile["BossPanel"], "Idle", null, "Audio/SE/select4"
                );

            var startBattleBossPanelButton = new SpriterGuiButton(
                Game.ViewportAdapter, "StartBattleBossPanel", "Graphics/GUI/BossSelection/boss-panel-battle-button.png",
                SpriterFile["BattleButton"], SpriterFile["BossPanel"], "Idle", null, "Audio/SE/select2"
                );

            closeBossPanelButton.Action       += BossPanelCloseButtonAction;
            startBattleBossPanelButton.Action += BossPanelStartBattleButtonAction;

            closeBossPanelButton.Animator().ZIndex(11);
            startBattleBossPanelButton.Animator().ZIndex(11);

            _bossPanelButtons.Add(closeBossPanelButton);
            _bossPanelButtons.Add(startBattleBossPanelButton);

            // Labels
            _bossNameLabel    = new SpriterGuiLabel("Unknown", Assets.GetFont("Graphics/Fonts/ui-title"), "boss-panel-title-label.png", SpriterFile["BossPanel"], Vector2.Zero, true);
            _bestTimeLabel    = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-best-time-label.png", SpriterFile["BossPanel"], Vector2.Zero);
            _playTimeLabel    = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-play-time-label.png", SpriterFile["BossPanel"], Vector2.Zero);
            _playerDeathLabel = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-player-deaths-label.png", SpriterFile["BossPanel"], Vector2.Zero);
            _bossDeathLabel   = new SpriterGuiLabel("", Assets.GetFont("Graphics/Fonts/ui"), "boss-panel-boss-deaths-label.png", SpriterFile["BossPanel"], Vector2.Zero);

            _bossPanelLabels.Add(_bossNameLabel);
            _bossPanelLabels.Add(_bestTimeLabel);
            _bossPanelLabels.Add(_playTimeLabel);
            _bossPanelLabels.Add(_playerDeathLabel);
            _bossPanelLabels.Add(_bossDeathLabel);

            ResetUI();
        }