示例#1
0
文件: Board.cs 项目: BradZzz/Moheum
        public Board(Battle.Configurations.Configurations configuration)
        {
            /*
             * Things the board needs to have:
             * # of Jewels
             * Jewel Dimensions (Board Configs)
             * Where Jewels are
             * Board Mechanics(Start Turn, End Turn)
             */

            this.configuration = configuration;
            boardData          = new BoardData(configuration);

            ProcessCascadeBoardMechanics   = new CascadeBoardMechanics(this);
            ProcessEndGameBoardMechanics   = new EndGameBoardMechanics(this);
            ProcessSelectBoardMechanics    = new SelectBoardMechanics(this);
            ProcessStartGameBoardMechanics = new StartGameBoardMechanics(this);
            ProcessSwapBoardMechanics      = new SwapBoardMechanics(this);
            UnselectBoardMechanics         = new UnselectBoardMechanics(this);
            ActivateAbilityMechanics       = new ActivateAbilityMechanics(this);
            InvokeActivateAbilityMechanics = new InvokeActivateAbilityMechanics(this);
            RemoveJewelBoardMechanics      = new RemoveJewelBoardMechanics(this);

            Mechanics.Add(ProcessCascadeBoardMechanics);
            Mechanics.Add(ProcessEndGameBoardMechanics);
            Mechanics.Add(ProcessSelectBoardMechanics);
            Mechanics.Add(ProcessStartGameBoardMechanics);
            Mechanics.Add(ProcessSwapBoardMechanics);
            Mechanics.Add(UnselectBoardMechanics);
            Mechanics.Add(ActivateAbilityMechanics);
            Mechanics.Add(InvokeActivateAbilityMechanics);
            Mechanics.Add(RemoveJewelBoardMechanics);
        }
示例#2
0
        private void Test()
        {
            if (RaceIsOn)
            {
                throw new Exception("Гонка уже началась! Сначала остановите гонку");
            }

            Bolides.AddRange(new List <Bolide>()
            {
                new Bolide("Ferrari", TrackWidth, TrackHeight),
                new Bolide("RedBull", TrackWidth, TrackHeight),
                new Bolide("ForceIndia", TrackWidth, TrackHeight),
                new Bolide("Mercedes", TrackWidth, TrackHeight),
            });
            foreach (Bolide bolide in Bolides)
            {
                Mechanic mechanic = new Mechanic(bolide.Name, bolide);
                mechanic.SetPosition(TrackWidth, TrackHeight);
                Mechanics.Add(mechanic);

                ReparingLoader repaing = new ReparingLoader(bolide.Name, bolide);
                repaing.SetPosition(TrackWidth, TrackHeight);
                Loaders.Add(repaing);

                SafetyCar safety = new SafetyCar(bolide.Name, bolide);
                safety.SetPosition(TrackWidth, TrackHeight);
                Loaders.Add(safety);
            }
        }
示例#3
0
        public void AddRacer(string Name)
        {
            if (!RaceIsOn)
            {
                Bolide newbolide = new Bolide(Name, TrackWidth, TrackHeight);
                Bolides.Add(newbolide);

                Mechanic newmechanic = new Mechanic(Name, newbolide);
                newmechanic.SetPosition(TrackWidth, TrackHeight);
                Mechanics.Add(newmechanic);


                ReparingLoader newloader = new ReparingLoader(Name, newbolide);
                newloader.SetPosition(TrackWidth, TrackHeight);
                Loaders.Add(newloader);

                SafetyCar safety = new SafetyCar(Name, newbolide);
                safety.SetPosition(TrackWidth, TrackHeight);
                Loaders.Add(safety);

                SetStartGrid();
            }
            else
            {
                throw new Exception("Гонка уже началась! Сначала остановите гонку");
            }
        }
示例#4
0
 public void Load(string file)
 {
     if (!IsLoaded)
     {
         Mechanics.Clear();
         var listItems = JsonConvert.DeserializeObject <List <MechanicJsonData> >(Resources.Load <TextAsset>(file).text);
         listItems.ForEach(item => Mechanics.Add(item.planetId, new MechanicData(item)));
         IsLoaded = true;
     }
 }
示例#5
0
        public void AddMechanic(int generatorId, int count)
        {
            MechanicInfo mechanic = null;

            if (Mechanics.ContainsKey(generatorId))
            {
                mechanic = Mechanics[generatorId];
                mechanic.AddMechanic(count);
            }
            else
            {
                mechanic = new MechanicInfo(generatorId, count);
                Mechanics.Add(mechanic.Id, mechanic);
                GameEvents.OnMechanicAdded(mechanic);
            }
        }
示例#6
0
        public void AddRacer(string Name)
        {
            if (!RaceIsOn)
            {
                Bolide newbolide = new Bolide(Name);
                Bolides.Add(newbolide);

                Mechanic newmechanic = new Mechanic(Name, newbolide);
                newmechanic.SetPosition(TrackWidth, TrackHeight);
                Mechanics.Add(newmechanic);

                SetStartGrid();
            }
            else
            {
                throw new Exception("Гонка уже началась! Сначала остановите гонку");
            }
        }
示例#7
0
        private void Test()
        {
            if (RaceIsOn)
            {
                throw new Exception("Гонка уже началась! Сначала остановите гонку");
            }

            Bolides.AddRange(new List <Bolide>()
            {
                new Bolide("Ferrari"),
                new Bolide("RedBull"),
                new Bolide("ForceIndia"),
                new Bolide("Mercedes"),
            });
            foreach (Bolide bolide in Bolides)
            {
                Mechanic mechanic = new Mechanic(bolide.Name, bolide);
                mechanic.SetPosition(TrackWidth, TrackHeight);
                Mechanics.Add(mechanic);
            }

            ReparingLoader reparing1 = new ReparingLoader("Loader1");

            reparing1.SetPosition(TrackWidth, TrackHeight);
            Loaders.Add(reparing1);

            ReparingLoader reparing2 = new ReparingLoader("Loader2");

            reparing2.SetPosition(TrackWidth, TrackHeight);
            Loaders.Add(reparing2);

            CleaningLoader cleaning1 = new CleaningLoader("Loader3");

            cleaning1.SetPosition(TrackWidth, TrackHeight);
            Loaders.Add(cleaning1);

            CleaningLoader cleaning2 = new CleaningLoader("Loader4");

            cleaning2.SetPosition(TrackWidth, TrackHeight);
            Loaders.Add(cleaning2);
        }
示例#8
0
        public override void LoadSave(object obj)
        {
            MechanicServiceSave save = obj as MechanicServiceSave;

            if (save != null)
            {
                Mechanics.Clear();
                save.Validate();
                foreach (var kvp in save.mechanics)
                {
                    Mechanics.Add(kvp.Key, new MechanicInfo(kvp.Value));
                }


                ReparedViewCount = save.repairedViewCount;
                IsLoaded         = true;
            }
            else
            {
                LoadDefaults();
            }
        }
示例#9
0
 public void SetFromExternalDataSource(IEnumerable <MechanicData> mechanics)
 {
     Mechanics.Clear();
     mechanics.ToList().ForEach(item => Mechanics.Add(item.PlanetId, item));
     IsLoaded = true;
 }
示例#10
0
 void AddMechanic(BaseGameMechanics mechanic) => Mechanics.Add(mechanic);