Ejemplo n.º 1
0
        private void HandleSpawning(SpawnHouse building)
        {
            string nameOfNextSpawn = building.GetActions()[RandomUtils.Choose(building.GetProbabilityArray())];

            if (nameOfNextSpawn != null && nameOfNextSpawn != "")
            {
                // TODO: change hardcoded center shift to the one derived from a variable
                var newSpawnPoint = WorkManager.GetRandomDestinationPoint(building.transform.position, 30);

                if (newSpawnPoint.HasValue)
                {
                    building.SetSpawnPoint(newSpawnPoint.Value);
                    building.PerformAction(nameOfNextSpawn);
                }
            }
        }
Ejemplo n.º 2
0
        public override void Load()
        {
            var background = RandomUtils.Choose(Ressources.ParalaxeForest, Ressources.ParalaxeMontain);

            Rise.Scene.SetBackground(background);

            var title = new Label
            {
                Text       = Game.Name,
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, -72),
                Font       = Ressources.FontAlagard,
                TextSize   = 3f,
            };

            var subTitle = new Label
            {
                Text       = "\"Tales of the unknow\"",
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, -16),
                Font       = Ressources.FontRomulus,
                TextSize   = 1f,
            };

            var continueButton = new Button("Continue")
            {
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, 72),
            }.RegisterMouseClickEvent((sender) => Game.Play(Game.GetLastGame()));

            var newGameButton = new Button
            {
                Text       = "New",
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, 72 * 2),
                UnitBound  = new Rectangle(0, 0, 256, 64),
            }.RegisterMouseClickEvent((sender) => Game.New("world", Rise.Rnd.Next(), GENERATOR.DEFAULT));

            Container = new Container(title, subTitle, newGameButton, Game.GetLastGame() != null ? continueButton : null);
        }
Ejemplo n.º 3
0
        protected virtual AudioClip ChooseClip(AudioClip[] clips)
        {
            switch (_clipSelection)
            {
            case ClipSelectionMode.Random:
                return(RandomUtils.Choose(clips));

            case ClipSelectionMode.Shuffle:
                if (_shuffleBag == null)
                {
                    _shuffleBag = new ShuffleBag <AudioClip>(clips);
                }

                return(_shuffleBag.GetNext());

            case ClipSelectionMode.ClampedSequence:
                return(clips[Mathf.Min(_clipIndex++, clips.Length - 1)]);

            case ClipSelectionMode.LoopingSequence:
                return(clips[MathUtils.WrapIndex(_clipIndex++, clips.Length)]);
            }

            return(null);
        }
Ejemplo n.º 4
0
        public override void Load()
        {
            var background = RandomUtils.Choose(Ressources.ParalaxeForest, Ressources.ParalaxeMontain);

            Rise.Scene.SetBackground(background);

            var title = new Label
            {
                Text       = Game.Name,
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, -72),
                Font       = Ressources.FontAlagard,
                TextSize   = 3f,
            };

            var subTitle = new Label
            {
                Text       = "\"Tales of the unknow\"",
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, -16),
                Font       = Ressources.FontRomulus,
                TextSize   = 1f,
            };

            var copyright = new Label
            {
                Text     = "© 2017-2018 MAKER",
                Anchor   = Anchor.Bottom,
                Origine  = Anchor.Bottom,
                Font     = Ressources.FontRomulus,
                TextSize = 1f
            };

            var continueButton = new Button
            {
                Text       = "Continue",
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, 72),
                UnitBound  = new Rectangle(0, 0, 256, 64),
            }
            .RegisterMouseClickEvent((sender) => Game.Play(Game.GetLastGame()));

            var menu = new WidgetTabContainer
            {
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitBound  = new Rectangle(0, 0, 600, 720),
                TabAnchore = Rise.Platform.Family == PlatformFamily.Mobile ? TabAnchore.Bottom : TabAnchore.Left,
                Tabs       =
                {
                    new Tab
                    {
                        Icon    = new Sprite(Ressources.TileIcons, new Point(0, 4)),
                        Content = new Container(title, subTitle, copyright, Game.GetLastGame() != null ? continueButton : null)
                    },

                    new TabNewWorld(),
                    new TabLoadWorld(),
                    new TabMultiplayerConnect(),
                    new TabOption(),
                }
            };

            Container = new Container(menu);
        }