Наследование: MonoBehaviour
 public State(StateMachine stateMachine, Action action = null, Init init = null, Finish finish = null)
 {
     _action = action;
     _init = init;
     _finish = finish;
     _mother = stateMachine;
     _transitions = new List<Transition>();
 }
Пример #2
0
 public void OpenFinishPopup(Finish f)
 {
     if (f == Finish.Win)
     {
         winnerLabel.text = "Win";
     }
     else
     {
         winnerLabel.text = "Lose";
     }
 }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     checkpoints = GameObject.FindGameObjectsWithTag("Checkpoint");
     startUp = GameObject.Find("GlobalScripts").GetComponent<StartUp>();
     finish = GameObject.Find("CheckpointFinish").GetComponent<Finish>();
     this.gameObject.collider.material.bounceCombine = PhysicMaterialCombine.Multiply;
     //this.gameObject.collider.material.bounciness = 1F;
     powerLine = PowerLine.GetComponent<LineRenderer>();
     powerLine.SetWidth(0.5f,0.5f);
     powerLine.SetVertexCount(2);
     powerLine.SetColors(new Color(1F, 0F, 0F, 1F), new Color(1F, 0F, 0F, 1F));
     aimLine = AimLine.GetComponent<LineRenderer>();
     aimLine.SetWidth(0.05f,0.05f);
     aimLine.SetVertexCount(2);
     aimLine.SetColors(new Color(0.8F, 0.8F, 0.8F, 0.8F), new Color(0.8F, 0.8F, 0.8F, 0.8F));
 }
Пример #4
0
    void Start()
    {
        #if UNITY_STANDALONE
        InitPC();
        #elif UNITY_XBOXONE
        InitXBoxOne();
        #endif

        highScoreList = new List<KeyValuePair<string, float>>();
        finishScript = GameObject.Find("Finish").GetComponent<Finish>();

        filePath = Application.persistentDataPath + "/" + Application.loadedLevelName + ".txt";
        if (File.Exists(filePath))
        {
            StreamReader file = new StreamReader(filePath);
            string row;
            while ((row = file.ReadLine()) != null)
            {
                highScoreList.Add(new KeyValuePair<string, float>(row.Split(":".ToCharArray())[0], float.Parse(row.Split(":".ToCharArray())[1])));//new KeyPair(row.Split(":".ToCharArray())[0], row.Split(":".ToCharArray())[1], true));
            }
            file.Close();
        }
    }
        //showing placed object in the gamefield
        private void FormLevelEditor_Paint(object sender, PaintEventArgs e)
        {
            if (ObstacleList != null)
            {
                List <Mine>            mines            = new List <Mine>();
                List <Tree>            trees            = new List <Tree>();
                List <Sandbag>         sandbags         = new List <Sandbag>();
                List <Mud>             muds             = new List <Mud>();
                List <Missilelauncher> missilelaunchers = new List <Missilelauncher>();
                Finish finish = new Finish(-50, -50);
                foreach (Obstacle obstacle in ObstacleList)
                {
                    switch (obstacle.ToString())
                    {
                    case "WarGame.Model.Mine":
                        mines.Add(obstacle as Mine);
                        break;

                    case "WarGame.Model.Tree":
                        trees.Add(obstacle as Tree);
                        break;

                    case "WarGame.Model.Sandbag":
                        sandbags.Add(obstacle as Sandbag);
                        break;

                    case "WarGame.Model.Mud":
                        muds.Add(obstacle as Mud);
                        break;

                    case "WarGame.Model.Missilelauncher":
                        missilelaunchers.Add(obstacle as Missilelauncher);
                        break;

                    case "WarGame.Model.Finish":
                        finish = obstacle as Finish;
                        break;
                    }
                }
                foreach (Mud mud in muds)
                {
                    e.Graphics.DrawImage(mud.image, mud.x, mud.y);
                    if (gameEngine.DevMode)
                    {
                        e.Graphics.DrawRectangle(Pens.Red, mud.rect);
                    }
                }
                foreach (Sandbag sandbag in sandbags)
                {
                    e.Graphics.DrawImage(sandbag.image, sandbag.x, sandbag.y);
                    if (gameEngine.DevMode)
                    {
                        e.Graphics.DrawRectangle(Pens.Yellow, sandbag.rect);
                    }
                }
                foreach (Tree tree in trees)
                {
                    e.Graphics.DrawImage(tree.image, tree.x, tree.y);
                    if (gameEngine.DevMode)
                    {
                        e.Graphics.DrawRectangle(Pens.Green, tree.rect);
                    }
                }
                foreach (Mine mine in mines)
                {
                    e.Graphics.DrawImage(mine.image, mine.x, mine.y);
                    if (gameEngine.DevMode)
                    {
                        e.Graphics.DrawRectangle(Pens.Red, mine.rect);
                    }
                }
                foreach (Missilelauncher missilelauncher in missilelaunchers)
                {
                    e.Graphics.DrawImage(missilelauncher.image, missilelauncher.x, missilelauncher.y);
                    if (gameEngine.DevMode)
                    {
                        e.Graphics.DrawRectangle(Pens.Red, missilelauncher.rect);
                    }
                }
                e.Graphics.DrawImage(finish.image, finish.x, finish.y);
                if (gameEngine.DevMode)
                {
                    e.Graphics.DrawRectangle(Pens.Blue, finish.rect);
                }
                //painting player
                Player player = new Player();
                e.Graphics.DrawImage(player.image, (int)(player.x - (player.width * (player.scale / 200))), (int)(player.y - (player.height * (player.scale / 200))));

                if (gameEngine.DevMode)
                {
                    e.Graphics.DrawRectangle(Pens.Blue, player.rect);
                }
                this.Invalidate();
            }
        }
Пример #6
0
    // Use this for initialization
    void Start()
    {
        hud = GameObject.FindGameObjectWithTag("Player").GetComponent<HUD>();
        topTen = GameObject.FindGameObjectWithTag("HighScore");
        hsText = topTen.GetComponent<Text>();
        finish = GameObject.FindGameObjectWithTag("Finish");
        fScript = finish.GetComponent<Finish>();
        scoreObj = GameObject.FindGameObjectWithTag("TopTen");
        hsOverlay = GameObject.Find("HSimage");
        screen = GameObject.FindGameObjectWithTag("ScreenOverlay");
        hsButton = GameObject.Find("HSButton").GetComponent<Button>();

        tempScore = 0;

        hsDone = false;

        highScore = new int[10];
        highScore[0] = 50000;
        highScore[1] = 25000;
        highScore[2] = 10000;
        highScore[3] = 5000;
        highScore[4] = 2500;
        highScore[5] = 1250;
        highScore[6] = 1000;
        highScore[7] = 500;
        highScore[8] = 125;
        highScore[9] = 50;
    }
Пример #7
0
        /**
         * Method that will remove finishes from the material with the passed reference.
         * It is assumed that a list with 1 or more objects is received.
         *
         * Validations performed:
         * 1. Validation of the passed material's reference (database);
         * 2. The received list has 1 or more elements.
         * FOREACH FINISH RECEIVED {
         * 3. Validation of the existence of each finish received, in the material with the passed reference.
         * 4. Validation for duplication between received finishes.
         * }
         */
        public ValidationOutput RemoveFinishesFromMaterial(string reference, IEnumerable <FinishDto> enumerableFinishDto)
        {
            ValidationOutput validationOutput = new ValidationOutputBadRequest();
            List <FinishDto>
            listFinishDto =
                new List <FinishDto>(
                    enumerableFinishDto);     //Since we receive an IEnumerable, we need to have something concrete

            //1.
            validationOutput = new ValidationOutputNotFound();
            if (!MaterialExists(reference))
            {
                validationOutput.AddError("Reference of material",
                                          "No material with the reference '" + reference + "' exists in the system.");
                return(validationOutput);
            }

            //2.
            if (listFinishDto.Count == 0)
            {
                validationOutput.AddError("Finishes selected", "No finishes were selected!");
                return(validationOutput);
            }

            Material      materialToModify = _materialRepository.GetByReference(reference);
            List <Finish> finishesToDelete = new List <Finish>();

            foreach (var currentFinishDto in listFinishDto)
            {
                validationOutput = new ValidationOutputBadRequest();

                Finish currentFinish = _mapper.Map <Finish>(currentFinishDto);

                //3.
                if (!materialToModify.ContainsFinish(currentFinish))
                {
                    validationOutput.AddError("Finish",
                                              "Finish with the reference '" + currentFinish.Reference + "' does not exist in material '" +
                                              reference + "'!");
                    return(validationOutput);
                }

                //4.
                if (finishesToDelete.Contains(currentFinish))
                {
                    validationOutput.AddError("Finish",
                                              "Finish with the reference '" + currentFinish.Reference +
                                              "' is duplicated in the list of selected finishes.");
                    return(validationOutput);
                }

                finishesToDelete.Add(currentFinish);
            }

            foreach (var finishToDelete in finishesToDelete)
            {
                materialToModify.RemoveFinish(finishToDelete);
            }

            _materialRepository.Update(materialToModify);
            return(validationOutput);
        }
Пример #8
0
 protected virtual void OnFinish() => Finish?.Invoke();
Пример #9
0
        /// <summary>
        /// Returns the task data as XML formatted for Excel.
        /// </summary>
        /// <returns>The task data as XML formatted for Excel.</returns>
        public string ToXml()
        {
            string s = "";

            //s += "<Row>" + System.Environment.NewLine;
            //s += "<Cell><Data ss:Type=\"String\">" + Wbs + "</Data></Cell>" + System.Environment.NewLine;
            //s += "<Cell><Data ss:Type=\"String\">" + ToXml(Name) + "</Data></Cell>" + System.Environment.NewLine;
            //s += "<Cell ss:StyleID=\"s21\"><Data ss:Type=\"DateTime\">" + StartDateExcelFormat + "</Data></Cell>" + System.Environment.NewLine;
            //s += "<Cell ss:StyleID=\"s21\"><Data ss:Type=\"DateTime\">" + FinishDateExcelFormat + "</Data></Cell>" + System.Environment.NewLine;
            //s += "<Cell><Data ss:Type=\"Number\">" + (PercentComplete /100.0) + "</Data></Cell>" + System.Environment.NewLine;
            //s += "</Row>" + System.Environment.NewLine;

            s += "<Task>" + System.Environment.NewLine;
            s += "<UID>" + UID + "</UID>" + System.Environment.NewLine;
            s += "<ID>" + ID + "</ID>" + System.Environment.NewLine;
            s += "<Name>" + ToXml(Name) + "</Name>" + System.Environment.NewLine;
            s += "<Active>" + Convert.ToInt16(Active) + "</Active>" + System.Environment.NewLine;
            s += "<Manual>0</Manual>" + System.Environment.NewLine;
            s += "<Type>0</Type>" + System.Environment.NewLine;
            s += "<IsNull>0</IsNull>" + System.Environment.NewLine;
            s += "<CreateDate>" + CreatedDate.ToString("yyyy-MM-dd'T'HH:mm:ss") + "</CreateDate>" + System.Environment.NewLine;
            s += "<WBS>" + Wbs + "</WBS>" + System.Environment.NewLine;
            s += "<OutlineNumber>" + OutlineNumber + "</OutlineNumber>" + System.Environment.NewLine;
            s += "<OutlineLevel>" + OutlineLevel + "</OutlineLevel>" + System.Environment.NewLine;

            s += "<Priority>500</Priority>" + System.Environment.NewLine;

            s += "<Start>" + Start.ToString("yyyy-MM-dd'T'HH:mm:ss") + "</Start>" + System.Environment.NewLine;
            s += "<Finish>" + Finish.ToString("yyyy-MM-dd'T'HH:mm:ss") + "</Finish>" + System.Environment.NewLine;

            s += "<Duration>PT64H0M0S</Duration>" + System.Environment.NewLine;
            s += "<ManualStart>2017-12-01T08:00:00</ManualStart>" + System.Environment.NewLine;
            s += "<ManualFinish>2017-12-12T17:00:00</ManualFinish>" + System.Environment.NewLine;
            s += "<ManualDuration>PT64H0M0S</ManualDuration>" + System.Environment.NewLine;
            s += "<DurationFormat>7</DurationFormat>" + System.Environment.NewLine;
            s += "<Work>PT0H0M0S</Work>" + System.Environment.NewLine;
            s += "<Stop>2017-12-12T17:00:00</Stop>" + System.Environment.NewLine;
            s += "<Resume>2017-12-12T17:00:00</Resume>" + System.Environment.NewLine;
            s += "<ResumeValid>0</ResumeValid>" + System.Environment.NewLine;
            s += "<EffortDriven>0</EffortDriven>" + System.Environment.NewLine;
            s += "<Recurring>0</Recurring>" + System.Environment.NewLine;
            s += "<OverAllocated>0</OverAllocated>" + System.Environment.NewLine;
            s += "<Estimated>0</Estimated>" + System.Environment.NewLine;
            s += "<Milestone>0</Milestone>" + System.Environment.NewLine;
            s += "<Summary>0</Summary>" + System.Environment.NewLine;
            s += "<DisplayAsSummary>0</DisplayAsSummary>" + System.Environment.NewLine;
            s += "<Critical>0</Critical>" + System.Environment.NewLine;
            s += "<IsSubproject>0</IsSubproject>" + System.Environment.NewLine;
            s += "<IsSubprojectReadOnly>0</IsSubprojectReadOnly>" + System.Environment.NewLine;
            s += "<ExternalTask>0</ExternalTask>" + System.Environment.NewLine;
            s += "<EarlyStart>2017-12-01T08:00:00</EarlyStart>" + System.Environment.NewLine;
            s += "<EarlyFinish>2017-12-12T17:00:00</EarlyFinish>" + System.Environment.NewLine;
            s += "<LateStart>2017-12-01T08:00:00</LateStart>" + System.Environment.NewLine;
            s += "<LateFinish>2017-12-12T17:00:00</LateFinish>" + System.Environment.NewLine;
            s += "<StartVariance>0</StartVariance>" + System.Environment.NewLine;
            s += "<FinishVariance>0</FinishVariance>" + System.Environment.NewLine;
            s += "<WorkVariance>0.00</WorkVariance>" + System.Environment.NewLine;
            s += "<FreeSlack>0</FreeSlack>" + System.Environment.NewLine;
            s += "<TotalSlack>0</TotalSlack>" + System.Environment.NewLine;
            s += "<StartSlack>0</StartSlack>" + System.Environment.NewLine;
            s += "<FinishSlack>0</FinishSlack>" + System.Environment.NewLine;
            s += "<FixedCost>0</FixedCost>" + System.Environment.NewLine;
            s += "<FixedCostAccrual>3</FixedCostAccrual>" + System.Environment.NewLine;

            s += "<PercentComplete>" + PercentComplete + "</PercentComplete>" + System.Environment.NewLine;

            s += "<PercentWorkComplete>100</PercentWorkComplete>" + System.Environment.NewLine;
            s += "<Cost>0</Cost>" + System.Environment.NewLine;
            s += "<OvertimeCost>0</OvertimeCost>" + System.Environment.NewLine;
            s += "<OvertimeWork>PT0H0M0S</OvertimeWork>" + System.Environment.NewLine;
            s += "<ActualStart>2017-12-01T08:00:00</ActualStart>" + System.Environment.NewLine;
            s += "<ActualFinish>2017-12-12T17:00:00</ActualFinish>" + System.Environment.NewLine;
            s += "<ActualDuration>PT64H0M0S</ActualDuration>" + System.Environment.NewLine;
            s += "<ActualCost>0</ActualCost>" + System.Environment.NewLine;
            s += "<ActualOvertimeCost>0</ActualOvertimeCost>" + System.Environment.NewLine;
            s += "<ActualWork>PT0H0M0S</ActualWork>" + System.Environment.NewLine;
            s += "<ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>" + System.Environment.NewLine;
            s += "<RegularWork>PT0H0M0S</RegularWork>" + System.Environment.NewLine;
            s += "<RemainingDuration>PT0H0M0S</RemainingDuration>" + System.Environment.NewLine;
            s += "<RemainingCost>0</RemainingCost>" + System.Environment.NewLine;
            s += "<RemainingWork>PT0H0M0S</RemainingWork>" + System.Environment.NewLine;
            s += "<RemainingOvertimeCost>0</RemainingOvertimeCost>" + System.Environment.NewLine;
            s += "<RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>" + System.Environment.NewLine;
            s += "<ACWP>0.00</ACWP>" + System.Environment.NewLine;
            s += "<CV>0.00</CV>" + System.Environment.NewLine;
            s += "<ConstraintType>6</ConstraintType>" + System.Environment.NewLine;
            s += "<CalendarUID>-1</CalendarUID>" + System.Environment.NewLine;
            s += "<ConstraintDate>2017-12-12T17:00:00</ConstraintDate>" + System.Environment.NewLine;
            s += "<LevelAssignments>1</LevelAssignments>" + System.Environment.NewLine;
            s += "<LevelingCanSplit>1</LevelingCanSplit>" + System.Environment.NewLine;
            s += "<LevelingDelay>0</LevelingDelay>" + System.Environment.NewLine;
            s += "<LevelingDelayFormat>8</LevelingDelayFormat>" + System.Environment.NewLine;
            s += "<IgnoreResourceCalendar>0</IgnoreResourceCalendar>" + System.Environment.NewLine;
            s += "<HideBar>0</HideBar>" + System.Environment.NewLine;
            s += "<Rollup>0</Rollup>" + System.Environment.NewLine;
            s += "<BCWS>0.00</BCWS>" + System.Environment.NewLine;
            s += "<BCWP>0.00</BCWP>" + System.Environment.NewLine;
            s += "<PhysicalPercentComplete>0</PhysicalPercentComplete>" + System.Environment.NewLine;
            s += "<EarnedValueMethod>0</EarnedValueMethod>" + System.Environment.NewLine;
            s += "<PredecessorLink>" + System.Environment.NewLine;
            s += "  <PredecessorUID>147</PredecessorUID>" + System.Environment.NewLine;
            s += "  <Type>1</Type>" + System.Environment.NewLine;
            s += "  <CrossProject>0</CrossProject>" + System.Environment.NewLine;
            s += "  <LinkLag>0</LinkLag>" + System.Environment.NewLine;
            s += "  <LagFormat>7</LagFormat>" + System.Environment.NewLine;
            s += "</PredecessorLink>" + System.Environment.NewLine;
            s += "<IsPublished>1</IsPublished>" + System.Environment.NewLine;
            s += "<CommitmentType>0</CommitmentType>" + System.Environment.NewLine;
            s += "<ExtendedAttribute>" + System.Environment.NewLine;
            s += "  <FieldID>188743731</FieldID>" + System.Environment.NewLine;
            s += "  <Value>Yes</Value>" + System.Environment.NewLine;
            s += "</ExtendedAttribute>" + System.Environment.NewLine;
            s += "  <TimephasedData>" + System.Environment.NewLine;
            s += "      <Type>11</Type>" + System.Environment.NewLine;
            s += "      <UID>149</UID>" + System.Environment.NewLine;
            s += "      <Start>2017-12-12T08:00:00</Start>" + System.Environment.NewLine;
            s += "      <Finish>2017-12-12T17:00:00</Finish>" + System.Environment.NewLine;
            s += "      <Unit>2</Unit>" + System.Environment.NewLine;
            s += "      <Value>12.5</Value>" + System.Environment.NewLine;
            s += "  </TimephasedData>" + System.Environment.NewLine;
            s += "</Task>";



            return(s);
        }
Пример #10
0
        /**
         * Method that will remove price history from the material with the passed reference.
         * It is assumed that a list with 1 or more objects is received.
         *
         * Validations performed:
         * 1. Validation of the passed material's reference (database);
         * 2. The received list has 1 or more elements.
         * 3. Validation of the passed finish's reference (database);
         * FOREACH PRICE HISTORY RECEIVED {
         * 4. Validation of the existence of each price history received, in the material with the passed dto.
         * 5. Validation for duplication between received price history.
         * 6. Validation that the date of the price history is future
         * }
         */
        public ValidationOutput DeleteFinishPriceHistoryFromMaterial(string reference, string finishReference,
                                                                     IEnumerable <PriceHistoryDto> enumerableHistoryDto)
        {
            List <PriceHistoryDto>
            listPriceHistoryDto =
                new List <PriceHistoryDto>(
                    enumerableHistoryDto);     //Since we receive an IEnumerable, we need to have something concrete

            ValidationOutput validationOutput = new ValidationOutputBadRequest();

            //1.
            validationOutput = new ValidationOutputNotFound();
            if (!MaterialExists(reference))
            {
                validationOutput.AddError("Reference of material",
                                          "No material with the reference '" + reference + "' exists in the system.");
                return(validationOutput);
            }

            //2.
            if (listPriceHistoryDto.Count == 0)
            {
                validationOutput.AddError("Selected price history", "No price history were selected!");
                return(validationOutput);
            }

            Material            materialToModify     = _materialRepository.GetByReference(reference);
            List <PriceHistory> priceHistoryToDelete = new List <PriceHistory>();

            //3.
            if (!materialToModify.ContainsFinish(finishReference))
            {
                validationOutput.AddError("Finish",
                                          "Finish with the reference '" + finishReference + "' does not exist in material '" +
                                          reference + "'!");
                return(validationOutput);
            }

            Finish finishToModify = materialToModify.GetFinish(finishReference);

            foreach (var currentPriceHistoryDto in listPriceHistoryDto)
            {
                validationOutput = new ValidationOutputBadRequest();
                PriceHistory currentPriceHistory = _mapper.Map <PriceHistory>(currentPriceHistoryDto);

                //4.
                if (!finishToModify.ContainsPriceHistory(currentPriceHistory))
                {
                    validationOutput.AddError("Price History",
                                              "Price History with the date '" + currentPriceHistory.Date + "' does not exist in finish '" +
                                              finishReference + "'!");
                    return(validationOutput);
                }

                //5.
                if (priceHistoryToDelete.Contains(currentPriceHistory))
                {
                    validationOutput.AddError("Price History",
                                              "Price History with the date '" + currentPriceHistory.Date +
                                              "' is duplicated in the list of selected price history.");
                    return(validationOutput);
                }

                //6.
                if (currentPriceHistoryDto.Date.CompareTo(DateTime.Now) < 0)
                {
                    validationOutput.AddError("Price History",
                                              "Price History with the date '" + currentPriceHistory.Date +
                                              "' can't be deleted.");
                    return(validationOutput);
                }

                priceHistoryToDelete.Add(currentPriceHistory);
            }

            foreach (var priceToDelete in priceHistoryToDelete)
            {
                finishToModify.RemovePriceHistory(priceToDelete);
            }

            //Removes the old Finish
            materialToModify.RemoveFinish(materialToModify.GetFinish(finishReference));

            //Adds the new one
            materialToModify.AddFinish(finishToModify);


            _materialRepository.Update(materialToModify);
            return(validationOutput);
        }
Пример #11
0
 void Start()
 {
     pm = FindObjectOfType <PlayerManager>();
     fm = FindObjectOfType <Finish>();
 }
Пример #12
0
 public SportCar(Finish method) : base(method)
 {
 }
Пример #13
0
        private void Entertainment_btn1_Click(object sender, EventArgs e)
        {
            if (RB1.Checked)
            {
                if (!File.Exists(Watch_fileLoc))
                {
                    FileStream   aFile = new FileStream(Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Questions of good and evil, right and wrong are commonly thought unanswerable by science. But Sam Harris argues that science can -- and should -- be an authority on moral issues, shaping human values and setting out what constitutes a good life. Adored by secularists, feared by the pious, Sam Harris' best-selling books argue that religion is ruinous and, worse, stupid -- and that questioning religious faith might just save civilization.");
                    sw.WriteLine("Does science ruin the magic of life? In this grumpy but charming monologue, Robin Ince makes the argument against. The more we learn about the astonishing behavior of the universe -- the more we stand in awe.The rational-minded Robin Ince conducts live experiments in comedy.");
                    sw.WriteLine("In a zippy demo at TED U, AnnMarie Thomas shows how two different kinds of homemade play dough can be used to demonstrate electrical properties -- by lighting up LEDs, spinning motors, and turning little kids into circuit designers. AnnMarie Thomas works on the playful side of engineering -- using cool tools to teach and help others.");
                    sw.WriteLine("What if every scientist could share their data as easily as they tweet about their lunch? Michael Nielsen calls for scientists to embrace new tools for collaboration that will enable discoveries to happen at the speed of Twitter. (Filmed at TEDxWaterloo.) A physicist turned writer, Michael Nielsen believes online communication and collaboration tools are revolutionizing the way we make scientific discoveries.");
                    sw.WriteLine("In tough economic times, our exploratory science programs -- from space probes to the LHC -- are first to suffer budget cuts. Brian Cox explains how curiosity-driven science pays for itself, powering innovation and a profound appreciation of our existence.Physicist Brian Cox has two jobs: working with the Large Hadron Collider at CERN, and explaining big science to the general public. He's a professor at the University of Manchester.");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream   aFile = new FileStream(Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Questions of good and evil, right and wrong are commonly thought unanswerable by science. But Sam Harris argues that science can -- and should -- be an authority on moral issues, shaping human values and setting out what constitutes a good life. Adored by secularists, feared by the pious, Sam Harris' best-selling books argue that religion is ruinous and, worse, stupid -- and that questioning religious faith might just save civilization.");
                    sw.WriteLine("Does science ruin the magic of life? In this grumpy but charming monologue, Robin Ince makes the argument against. The more we learn about the astonishing behavior of the universe -- the more we stand in awe.The rational-minded Robin Ince conducts live experiments in comedy.");
                    sw.WriteLine("In a zippy demo at TED U, AnnMarie Thomas shows how two different kinds of homemade play dough can be used to demonstrate electrical properties -- by lighting up LEDs, spinning motors, and turning little kids into circuit designers. AnnMarie Thomas works on the playful side of engineering -- using cool tools to teach and help others.");
                    sw.WriteLine("What if every scientist could share their data as easily as they tweet about their lunch? Michael Nielsen calls for scientists to embrace new tools for collaboration that will enable discoveries to happen at the speed of Twitter. (Filmed at TEDxWaterloo.) A physicist turned writer, Michael Nielsen believes online communication and collaboration tools are revolutionizing the way we make scientific discoveries.");
                    sw.WriteLine("In tough economic times, our exploratory science programs -- from space probes to the LHC -- are first to suffer budget cuts. Brian Cox explains how curiosity-driven science pays for itself, powering innovation and a profound appreciation of our existence.Physicist Brian Cox has two jobs: working with the Large Hadron Collider at CERN, and explaining big science to the general public. He's a professor at the University of Manchester.");
                    sw.Close();
                    aFile.Close();
                }
            }

            else if (RB2.Checked)
            {
                if (!File.Exists(Not_Watch_fileLoc))
                {
                    FileStream   aFile = new FileStream(Not_Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Questions of good and evil, right and wrong are commonly thought unanswerable by science. But Sam Harris argues that science can -- and should -- be an authority on moral issues, shaping human values and setting out what constitutes a good life. Adored by secularists, feared by the pious, Sam Harris' best-selling books argue that religion is ruinous and, worse, stupid -- and that questioning religious faith might just save civilization.");
                    sw.WriteLine("Does science ruin the magic of life? In this grumpy but charming monologue, Robin Ince makes the argument against. The more we learn about the astonishing behavior of the universe -- the more we stand in awe.The rational-minded Robin Ince conducts live experiments in comedy.");
                    sw.WriteLine("In a zippy demo at TED U, AnnMarie Thomas shows how two different kinds of homemade play dough can be used to demonstrate electrical properties -- by lighting up LEDs, spinning motors, and turning little kids into circuit designers. AnnMarie Thomas works on the playful side of engineering -- using cool tools to teach and help others.");
                    sw.WriteLine("What if every scientist could share their data as easily as they tweet about their lunch? Michael Nielsen calls for scientists to embrace new tools for collaboration that will enable discoveries to happen at the speed of Twitter. (Filmed at TEDxWaterloo.) A physicist turned writer, Michael Nielsen believes online communication and collaboration tools are revolutionizing the way we make scientific discoveries.");
                    sw.WriteLine("In tough economic times, our exploratory science programs -- from space probes to the LHC -- are first to suffer budget cuts. Brian Cox explains how curiosity-driven science pays for itself, powering innovation and a profound appreciation of our existence.Physicist Brian Cox has two jobs: working with the Large Hadron Collider at CERN, and explaining big science to the general public. He's a professor at the University of Manchester.");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream   aFile = new FileStream(Not_Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Questions of good and evil, right and wrong are commonly thought unanswerable by science. But Sam Harris argues that science can -- and should -- be an authority on moral issues, shaping human values and setting out what constitutes a good life. Adored by secularists, feared by the pious, Sam Harris' best-selling books argue that religion is ruinous and, worse, stupid -- and that questioning religious faith might just save civilization.");
                    sw.WriteLine("Does science ruin the magic of life? In this grumpy but charming monologue, Robin Ince makes the argument against. The more we learn about the astonishing behavior of the universe -- the more we stand in awe.The rational-minded Robin Ince conducts live experiments in comedy.");
                    sw.WriteLine("In a zippy demo at TED U, AnnMarie Thomas shows how two different kinds of homemade play dough can be used to demonstrate electrical properties -- by lighting up LEDs, spinning motors, and turning little kids into circuit designers. AnnMarie Thomas works on the playful side of engineering -- using cool tools to teach and help others.");
                    sw.WriteLine("What if every scientist could share their data as easily as they tweet about their lunch? Michael Nielsen calls for scientists to embrace new tools for collaboration that will enable discoveries to happen at the speed of Twitter. (Filmed at TEDxWaterloo.) A physicist turned writer, Michael Nielsen believes online communication and collaboration tools are revolutionizing the way we make scientific discoveries.");
                    sw.WriteLine("In tough economic times, our exploratory science programs -- from space probes to the LHC -- are first to suffer budget cuts. Brian Cox explains how curiosity-driven science pays for itself, powering innovation and a profound appreciation of our existence.Physicist Brian Cox has two jobs: working with the Large Hadron Collider at CERN, and explaining big science to the general public. He's a professor at the University of Manchester.");
                    sw.Close();
                    aFile.Close();
                }
            }

            Finish frm = new Finish();

            frm.Show();
            this.Close();
        }
Пример #14
0
        private void Entertainment_btn1_Click(object sender, EventArgs e)
        {
            if (RB1.Checked)
            {
                if (!File.Exists(Watch_fileLoc))
                {
                    FileStream   aFile = new FileStream(Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("At TED@MotorCity, Lisa Gansky, author of The Mesh, talks about a future of business that's about sharing all kinds of stuff, either via smart and tech-enabled rental or, more boldly, peer-to-peer. Examples across industries -- from music to cars -- show how close we are to this meshy future.Lisa Gansky is the author of The Mesh: Why the Future of Business Is Sharing, and the instigator behind the Mesh Directory (www.meshing.it).");
                    sw.WriteLine("At his carpet company, Ray Anderson has increased sales and doubled profits while turning the traditional take / make / waste. industrial system on its head. In a gentle, understated way, he shares a powerful vision for sustainable commerce.Ray Anderson founded the company that makes covetable Flor carpeting. But behind the fresh design is a decades-deep commitment to sustainable ways of doing business -- culminating in the Mission Zero plan. ");
                    sw.WriteLine("When the dotcom bubble burst, hotelier Chip Conley went in search of a business model based on happiness. In an old friendship with an employee and in the wisdom of a Buddhist king, he learned that success comes from what you count. Chip Conley creates joyful hotels, where he hopes his employees, customers and investors alike can realize their full potential. His books share that philosophy with the wider world");
                    sw.WriteLine("John Gerzema says there's an upside to the recent financial crisis -- the opportunity for positive change. In talk talk, he identifies four major cultural shifts driving new consumer behavior and shows how businesses are evolving to connect with thoughtful spending. (Filmed at TEDxKC.) John Gerzema uses data, analysis and decades of experience to identify trends and develop daring new approaches to advertising");
                    sw.WriteLine("Ten percent of American businesses disappear every year. … It’s far higher than the failure rate of, say, Americans. Ten percent of Americans don’t disappear every year. Which leads us to conclude American businesses fail faster than Americans, and therefore American businesses are evolving faster than Americans");
                    sw.WriteLine("Economics writer Tim Harford studies complex systems -- and finds a surprising link among the successful ones: they were built through trial and error. In this sparkling talk from TEDGlobal 2011, he asks us to embrace our randomness and start making better mistakes.Tim Harford's writings reveal the economic ideas behind everyday experiences");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream   aFile = new FileStream(Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("At TED@MotorCity, Lisa Gansky, author of The Mesh, talks about a future of business that's about sharing all kinds of stuff, either via smart and tech-enabled rental or, more boldly, peer-to-peer. Examples across industries -- from music to cars -- show how close we are to this meshy future.Lisa Gansky is the author of The Mesh: Why the Future of Business Is Sharing, and the instigator behind the Mesh Directory (www.meshing.it).");
                    sw.WriteLine("At his carpet company, Ray Anderson has increased sales and doubled profits while turning the traditional take / make / waste. industrial system on its head. In a gentle, understated way, he shares a powerful vision for sustainable commerce.Ray Anderson founded the company that makes covetable Flor carpeting. But behind the fresh design is a decades-deep commitment to sustainable ways of doing business -- culminating in the Mission Zero plan. ");
                    sw.WriteLine("When the dotcom bubble burst, hotelier Chip Conley went in search of a business model based on happiness. In an old friendship with an employee and in the wisdom of a Buddhist king, he learned that success comes from what you count. Chip Conley creates joyful hotels, where he hopes his employees, customers and investors alike can realize their full potential. His books share that philosophy with the wider world");
                    sw.WriteLine("John Gerzema says there's an upside to the recent financial crisis -- the opportunity for positive change. In talk talk, he identifies four major cultural shifts driving new consumer behavior and shows how businesses are evolving to connect with thoughtful spending. (Filmed at TEDxKC.) John Gerzema uses data, analysis and decades of experience to identify trends and develop daring new approaches to advertising");
                    sw.WriteLine("Ten percent of American businesses disappear every year. … It’s far higher than the failure rate of, say, Americans. Ten percent of Americans don’t disappear every year. Which leads us to conclude American businesses fail faster than Americans, and therefore American businesses are evolving faster than Americans");
                    sw.WriteLine("Economics writer Tim Harford studies complex systems -- and finds a surprising link among the successful ones: they were built through trial and error. In this sparkling talk from TEDGlobal 2011, he asks us to embrace our randomness and start making better mistakes.Tim Harford's writings reveal the economic ideas behind everyday experiences");
                    sw.Close();
                    aFile.Close();
                }
            }

            else if (RB2.Checked)
            {
                if (!File.Exists(Not_Watch_fileLoc))
                {
                    FileStream   aFile = new FileStream(Not_Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("At TED@MotorCity, Lisa Gansky, author of The Mesh, talks about a future of business that's about sharing all kinds of stuff, either via smart and tech-enabled rental or, more boldly, peer-to-peer. Examples across industries -- from music to cars -- show how close we are to this meshy future.Lisa Gansky is the author of The Mesh: Why the Future of Business Is Sharing, and the instigator behind the Mesh Directory (www.meshing.it).");
                    sw.WriteLine("At his carpet company, Ray Anderson has increased sales and doubled profits while turning the traditional take / make / waste. industrial system on its head. In a gentle, understated way, he shares a powerful vision for sustainable commerce.Ray Anderson founded the company that makes covetable Flor carpeting. But behind the fresh design is a decades-deep commitment to sustainable ways of doing business -- culminating in the Mission Zero plan. ");
                    sw.WriteLine("When the dotcom bubble burst, hotelier Chip Conley went in search of a business model based on happiness. In an old friendship with an employee and in the wisdom of a Buddhist king, he learned that success comes from what you count. Chip Conley creates joyful hotels, where he hopes his employees, customers and investors alike can realize their full potential. His books share that philosophy with the wider world");
                    sw.WriteLine("John Gerzema says there's an upside to the recent financial crisis -- the opportunity for positive change. In talk talk, he identifies four major cultural shifts driving new consumer behavior and shows how businesses are evolving to connect with thoughtful spending. (Filmed at TEDxKC.) John Gerzema uses data, analysis and decades of experience to identify trends and develop daring new approaches to advertising");
                    sw.WriteLine("Ten percent of American businesses disappear every year. … It’s far higher than the failure rate of, say, Americans. Ten percent of Americans don’t disappear every year. Which leads us to conclude American businesses fail faster than Americans, and therefore American businesses are evolving faster than Americans");
                    sw.WriteLine("Economics writer Tim Harford studies complex systems -- and finds a surprising link among the successful ones: they were built through trial and error. In this sparkling talk from TEDGlobal 2011, he asks us to embrace our randomness and start making better mistakes.Tim Harford's writings reveal the economic ideas behind everyday experiences");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream   aFile = new FileStream(Not_Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("At TED@MotorCity, Lisa Gansky, author of The Mesh, talks about a future of business that's about sharing all kinds of stuff, either via smart and tech-enabled rental or, more boldly, peer-to-peer. Examples across industries -- from music to cars -- show how close we are to this meshy future.Lisa Gansky is the author of The Mesh: Why the Future of Business Is Sharing, and the instigator behind the Mesh Directory (www.meshing.it).");
                    sw.WriteLine("At his carpet company, Ray Anderson has increased sales and doubled profits while turning the traditional take / make / waste. industrial system on its head. In a gentle, understated way, he shares a powerful vision for sustainable commerce.Ray Anderson founded the company that makes covetable Flor carpeting. But behind the fresh design is a decades-deep commitment to sustainable ways of doing business -- culminating in the Mission Zero plan. ");
                    sw.WriteLine("When the dotcom bubble burst, hotelier Chip Conley went in search of a business model based on happiness. In an old friendship with an employee and in the wisdom of a Buddhist king, he learned that success comes from what you count. Chip Conley creates joyful hotels, where he hopes his employees, customers and investors alike can realize their full potential. His books share that philosophy with the wider world");
                    sw.WriteLine("John Gerzema says there's an upside to the recent financial crisis -- the opportunity for positive change. In talk talk, he identifies four major cultural shifts driving new consumer behavior and shows how businesses are evolving to connect with thoughtful spending. (Filmed at TEDxKC.) John Gerzema uses data, analysis and decades of experience to identify trends and develop daring new approaches to advertising");
                    sw.WriteLine("Ten percent of American businesses disappear every year. … It’s far higher than the failure rate of, say, Americans. Ten percent of Americans don’t disappear every year. Which leads us to conclude American businesses fail faster than Americans, and therefore American businesses are evolving faster than Americans");
                    sw.WriteLine("Economics writer Tim Harford studies complex systems -- and finds a surprising link among the successful ones: they were built through trial and error. In this sparkling talk from TEDGlobal 2011, he asks us to embrace our randomness and start making better mistakes.Tim Harford's writings reveal the economic ideas behind everyday experiences");
                    sw.Close();
                    aFile.Close();
                }
            }

            if (length == 4 || length == 3 || length == 1)
            {
                if (Next == "Religious")
                {
                    Religious_1 frm = new Religious_1(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Environment")
                {
                    Environment frm = new Environment(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Sports")
                {
                    Sports_1 frm = new Sports_1(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Politics")
                {
                    Politics frm = new Politics(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Medical")
                {
                    Medical frm = new Medical(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Science")
                {
                    Science frm = new Science(NewUserSlections);
                    frm.Show();
                }
                else
                {
                    Finish frm = new Finish();
                    frm.Show();
                }
            }

            else
            {
                Finish frm = new Finish();
                frm.Show();
            }
            this.Close();
        }
Пример #15
0
 public SportCar(int distance, Finish finish, Drive drive) : base(distance, 10, finish, drive)
 {
 }
Пример #16
0
 public Truck(Finish method) : base(method)
 {
 }
Пример #17
0
 protected void HaveFinish()
 {
     Finish.Invoke(this, new EventArgs());
 }
Пример #18
0
 // Use this for initialization
 void Start()
 {
     if (GameObject.FindObjectOfType<ConfirmScript>())
     {
         _p1Score = GameObject.FindObjectOfType<ConfirmScript>().SavedP1Score;
         _p2Score = GameObject.FindObjectOfType<ConfirmScript>().SavedP2Score;
         _levelScript = GameObject.FindObjectOfType<Player1LevelScript>();
         _levelp2Script = GameObject.FindObjectOfType<Player2LevelScript>();
         _finishScript = GameObject.FindObjectOfType<Finish>();
         _pauseScript = GameObject.FindObjectOfType<PauseScript>();
         _confirmScript = GameObject.FindObjectOfType<ConfirmScript>();
         _p1Text = GameObject.Find("P1 Text");
         _p2Text = GameObject.Find("P2 Text");
     }
 }
Пример #19
0
 private void WelcomeSkipButton_Clicked(object sender, EventArgs e)
 {
     Finish?.Invoke(this, new FirstRunFinishEventArgs());
 }
Пример #20
0
 protected virtual void OnFinish(string path)
 {
     Finish?.Invoke(path);
     Console.WriteLine(path);
 }
Пример #21
0
 protected void OnFinish()
 {
     Finish?.Invoke(this, EventArgs.Empty);
 }
Пример #22
0
    public static bool BuildLevel(Map mapToBuild, Transform parent)
    {
        GameObject[,] objectMap = new GameObject[Map.MapSize[0], Map.MapSize[1]]; // For establishing object links
        Dictionary <int[], int[]> linkStorage = new Dictionary <int[], int[]>();  // Store link information from map
        List <Enemy> generatedEnemies         = new List <Enemy>();               // Store enemies for player script
        Player       playerScript             = null;
        Finish       endScript = null;

        try
        {
            for (int x = 0; x < Map.MapSize[0]; x++)
            {
                for (int y = 0; y < Map.MapSize[1]; y++)
                {
                    Cell       cellToBuild = mapToBuild.GetCell(x, y);
                    GameObject builtObject = CreateObject(x, y, cellToBuild, parent);
                    if (cellToBuild.ObjectType == ObjectTypes.Enemy)
                    {
                        generatedEnemies.Add(builtObject.GetComponent <Enemy>());
                        switch (cellToBuild.Direction)
                        {
                        case 0:
                            builtObject.GetComponent <Enemy>().currentDirection = Direction.Right;
                            break;

                        case 1:
                            builtObject.GetComponent <Enemy>().currentDirection = Direction.Down;
                            break;

                        case 2:
                            builtObject.GetComponent <Enemy>().currentDirection = Direction.Left;
                            break;

                        case 3:
                        default:
                            builtObject.GetComponent <Enemy>().currentDirection = Direction.Up;
                            break;
                        }
                    }
                    else if (cellToBuild.ObjectType == ObjectTypes.Player)
                    {
                        playerScript               = builtObject.GetComponent <Player>();
                        playerScript.lifeLine      = GameObject.Find("Game Manager").GetComponent <LifeController>();
                        playerScript.startPosition = new Vector3(x, 1.5f, y);                         // Same as player objectY from CreateObject()
                    }
                    else if (cellToBuild.ObjectType == ObjectTypes.End)
                    {
                        endScript             = builtObject.GetComponent <Finish>();
                        endScript.nextButton  = panelNextButton;
                        endScript.retryButton = retryButton;
                    }
                    objectMap[x, y] = builtObject;
                    List <int[]> objectLinks = cellToBuild.Link;                    // Store link to link after all objects are built
                    foreach (int[] objectLink in objectLinks)
                    {
                        if (objectLink[0] >= 0 && objectLink[1] >= 0)
                        {
                            Debug.Log(linkStorage.Count);
                            linkStorage.Add(new int[] { x, y }, new int[] { objectLink[0], objectLink[1] }); // Save coords of linked objects
                        }
                    }
                }
            }
            Debug.Log(linkStorage.Count);
            foreach (KeyValuePair <int[], int[]> link in linkStorage)           // Link triggers and gates
            {
                Debug.Log("Entered kvp loop");
                GameObject linkSource      = objectMap[link.Key[0], link.Key[1]];     // Get source object
                GameObject linkDestination = objectMap[link.Value[0], link.Value[1]]; // Get linked object
                Debug.Log(linkSource);
                GateTrigger gateSource = linkSource.GetComponent <GateTrigger>();     // Check if source object is a gate
                if (gateSource == null)                                               // If not gate then next cell
                {
                    Debug.Log("Iteration skipped");
                    continue;
                }
                gateSource.Link.Add(linkDestination);                 // Set object to disable by trigger
            }
            if (playerScript != null)
            {
                playerScript.enemyList = generatedEnemies;
                foreach (Enemy enemyScript in generatedEnemies)
                {
                    enemyScript.player = playerScript;
                }
            }
        }
        catch (Exception e)
        {
            Debug.Log("Level build failed: " + e.Message);
            return(false);
        }
        return(true);
    }
Пример #23
0
 public override void AddDest(Transition link)
 {
     Finish.AddDest(link);
 }
Пример #24
0
 internal virtual void OnFinish(EventArgs e)
 {
     Finish?.Invoke(this, e);
 }
Пример #25
0
 public virtual void OnFinish(EventArgs e)
 {
     Os.Dispose();
     Finish?.Invoke(this, e);
 }
Пример #26
0
        /**
         * Validations performed:
         *
         * 1. The received list has 1 or more elements.
         * FOREACH FINISH RECEIVED {
         * 2. Validation of each finish's reference (business rules);
         * 3. Validation of each finish's definition (business rules);
         * 4. Validation of the existence of each finish received, in the material with the passed reference.
         * 5. Validation for duplication between received finishes.
         * }
         */
        private ValidationOutput PrivateAddFinishesToMaterial(string reference,
                                                              IEnumerable <FinishDto> enumerableFinishDto)
        {
            List <FinishDto>
            listFinishDto =
                new List <FinishDto>(
                    enumerableFinishDto);     //Since we receive an IEnumerable, we need to have something concrete

            //1.
            ValidationOutput validationOutput = new ValidationOutputBadRequest();

            if (listFinishDto.Count == 0)
            {
                validationOutput.AddError("Finishes selected", "No finishes were selected!");
                return(validationOutput);
            }

            Material      materialToModify = _materialRepository.GetByReference(reference);
            List <Finish> finishesToAdd    = new List <Finish>();

            foreach (var currentFinishDto in listFinishDto)
            {
                validationOutput = new ValidationOutputBadRequest();

                //2.
                validationOutput = _finishDTOValidator.DTOReferenceIsValid(currentFinishDto.Reference);
                if (validationOutput.HasErrors())
                {
                    return(validationOutput);
                }

                //3.
                validationOutput = _finishDTOValidator.DTOIsValidForRegister(currentFinishDto);
                if (validationOutput.HasErrors())
                {
                    return(validationOutput);
                }

                Finish currentFinish = _mapper.Map <Finish>(currentFinishDto);

                //4.
                if (materialToModify.ContainsFinish(currentFinish))
                {
                    validationOutput.AddError("Finish",
                                              "Finish with the reference '" + currentFinish.Reference + "' already exists in material '" +
                                              reference + "'!");
                    return(validationOutput);
                }

                //5.
                if (finishesToAdd.Contains(currentFinish))
                {
                    validationOutput.AddError("Finish",
                                              "Finish with the reference '" + currentFinish.Reference +
                                              "' is duplicated in the list of selected finishes.");
                    return(validationOutput);
                }

                finishesToAdd.Add(currentFinish);
            }

            foreach (var finishToAdd in listFinishDto)
            {
                AddNewPriceToFinishHistory(finishToAdd);
                finishToAdd.IsActive = true;
                Finish currentFinish = _mapper.Map <Finish>(finishToAdd);
                materialToModify.AddFinish(currentFinish);
            }

            validationOutput.DesiredReturn = enumerableFinishDto;
            _materialRepository.Update(materialToModify);
            return(validationOutput);
        }
Пример #27
0
 public string FinishString()
 {
     return(Finish.ToString(Finish.Date == Start.Date ? "t" : "g"));
 }
Пример #28
0
        /**
         * Method that will add prices that the finish with the passed reference in the material with, equally, the passed reference will have, in the future.
         * It is assumed that a list with 1 or more objects is received.
         *
         * Validations performed:
         * 1. Validation of the passed material's reference (database);
         * 2. The received list has 1 or more elements.
         * 3. Validation of the passed finish's reference (existence in the material);
         * FOREACH PRICE HISTORY RECEIVED {
         * 4. Validation of each price history's definition (business rules);
         * 6. Validation of the existence of each price history received, in the the finish of material with the passed reference.
         * 5. Validation for duplication between received price history items.
         * }
         */
        public ValidationOutput AddPriceHistoryItemsToFinishOfMaterial(string materialReference, string finishReference,
                                                                       IEnumerable <PriceHistoryDto> enumerablePriceHistoryDto)
        {
            ValidationOutput validationOutput = new ValidationOutputBadRequest();

            List <PriceHistoryDto> listPriceHistoryDto = new List <PriceHistoryDto>(enumerablePriceHistoryDto);

            //1.
            validationOutput = new ValidationOutputNotFound();
            if (!MaterialExists(materialReference))
            {
                validationOutput.AddError("Reference of material",
                                          "No material with the reference '" + materialReference + "' exists in the system.");
                return(validationOutput);
            }

            //2.
            if (listPriceHistoryDto.Count == 0)
            {
                validationOutput.AddError("Price history items defined", "No price history items were defined!");
                return(validationOutput);
            }

            Material materialToModify = _materialRepository.GetByReference(materialReference);

            //3.
            validationOutput = new ValidationOutputNotFound();
            if (!materialToModify.ContainsFinish(finishReference))
            {
                validationOutput.AddError("Reference of finish",
                                          "No finish with the reference '" + finishReference + "' exists in the material '" +
                                          materialReference + "'.");
                return(validationOutput);
            }

            Finish finishToModify = materialToModify.GetFinish(finishReference);

            List <PriceHistory> priceHistoryItemsToAdd = new List <PriceHistory>();

            validationOutput = new ValidationOutputBadRequest();
            foreach (var currentPriceHistoryDto in listPriceHistoryDto)
            {
                //4.
                validationOutput = _priceHistoryDTOValidator.DTOIsValid(currentPriceHistoryDto);
                if (validationOutput.HasErrors())
                {
                    return(validationOutput);
                }

                PriceHistory currentPriceHistory = _mapper.Map <PriceHistory>(currentPriceHistoryDto);

                //5.
                if (finishToModify.ContainsPriceHistory(currentPriceHistory))
                {
                    validationOutput.AddError("Price history item",
                                              "A price history item set to the date " + currentPriceHistory.Date + " with the price " +
                                              currentPriceHistory.Price.Value + " has already been defined in the finish '" +
                                              finishReference +
                                              "' present in the material '" + materialReference + "'!");
                    return(validationOutput);
                }

                //6.
                if (priceHistoryItemsToAdd.Contains(currentPriceHistory))
                {
                    validationOutput.AddError("Price history item",
                                              "A price history item is duplicated in the list of defined price history items.");
                    return(validationOutput);
                }

                priceHistoryItemsToAdd.Add(currentPriceHistory);
            }

            foreach (var priceHistoryItemToAdd in priceHistoryItemsToAdd)
            {
                finishToModify.AddPriceToHistory(priceHistoryItemToAdd);
            }

            validationOutput.DesiredReturn = enumerablePriceHistoryDto;
            _materialRepository.Update(materialToModify);
            return(validationOutput);
        }
Пример #29
0
 private void Level4()
 {
     for (int i = 0; i < 3; i++)
     {
         Blocklist.Add(new LevelBlock(i * 100, 700));
     }
     for (int i = 0; i < 3; i++)
     {
         Blocklist.Add(new LevelBlock(i * 100, 500));
     }
     for (int i = 0; i < 3; i++)
     {
         Blocklist.Add(new LevelBlock(i * 100, 300));
     }
     for (int i = 0; i < 3; i++)
     {
         Blocklist.Add(new LevelBlock(i * 100, 100));
     }
     Blocklist.Add(new LevelBlock(200, 600));
     Blocklist.Add(new LevelBlock(200, 400));
     Blocklist.Add(new LevelBlock(200, 200));
     //
     for (int i = 0; i < 4; i++)
     {
         Blocklist.Add(new LevelBlock(600, 100 * i));
     }
     for (int i = 3; i < 6; i++)
     {
         Blocklist.Add(new LevelBlock(i * 100, 700));
     }
     for (int i = 7; i < 12; i++)
     {
         Blocklist.Add(new LevelBlock(i * 100, 700));
     }
     Blocklist.Add(new LevelBlock(1100, 600));
     //
     for (int i = 0; i < 6; i++)
     {
         Blocklist.Add(new LevelBlock(1500, 100 * i));
     }
     for (int i = 11; i < 15; i++)
     {
         Blocklist.Add(new LevelBlock(i * 100, 500));
     }
     for (int i = 7; i < 10; i++)
     {
         Blocklist.Add(new LevelBlock(i * 100, 300));
     }
     for (int i = 11; i < 15; i++)
     {
         Blocklist.Add(new LevelBlock(i * 100, 100));
     }
     //
     Traplist.Add(new TrapBlock(1050, 690));
     Traplist.Add(new TrapBlock(1450, 490));
     //
     Enemylist.Add(new EnemyBlock(150, 450, 150));
     Enemylist.Add(new EnemyBlock(150, 250, 150));
     Enemylist.Add(new EnemyBlock(550, 650, 250));
     Enemylist.Add(new EnemyBlock(1000, 650, 300));
     Enemylist.Add(new EnemyBlock(1400, 450, 300));
     Enemylist.Add(new EnemyBlock(950, 250, 250));
     //
     Finish.Add(new FinishBlock(1450, 50));
     //
     Currentlevel = 0;
     Changelevel();
 }
Пример #30
0
 protected virtual void OnFinish(SystemVisitorEventArgs e) => Finish?.Invoke(this, e);
Пример #31
0
 void Open(Finish fish)
 {
     types.Add(fish);
 }
        //opening the dialogs for choosing an existing level
        private void loadLevel()
        {
            OpenFileDialog BrowseFile = new OpenFileDialog();

            BrowseFile.Filter      = "XML Files (*.xml)|*.xml";
            BrowseFile.FilterIndex = 0;
            BrowseFile.DefaultExt  = "xml";
            if (BrowseFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                ObstacleList.Clear();
                doc = new XmlDocument();
                try
                {
                    doc.Load(BrowseFile.FileName);
                }
                catch (Exception e)
                {
                    MessageBox.Show("Level Could't be read please check your file. Error: " + e, "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                XmlNodeList xmlnode;
                xmlnode = doc.GetElementsByTagName("object");
                for (int i = 0; i < xmlnode.Count; i++)
                {
                    string name  = xmlnode[i].ChildNodes.Item(0).InnerText;
                    int    xaxis = Convert.ToInt32(xmlnode[i].ChildNodes.Item(1).InnerText);
                    int    yaxis = Convert.ToInt32(xmlnode[i].ChildNodes.Item(2).InnerText);
                    string speed = xmlnode[i].ChildNodes.Item(3).InnerText;
                    //adding the objects to the object list
                    switch (name)
                    {
                    case "tree":
                        Tree tree = new Tree(xaxis, yaxis);
                        ObstacleList.Add(tree);
                        Console.WriteLine("Tree added to list.");
                        break;

                    case "sandbag":
                        Sandbag sandbag = new Sandbag(xaxis, yaxis);
                        ObstacleList.Add(sandbag);
                        Console.WriteLine("Tree added to list.");
                        break;

                    case "mine":
                        Mine mine = new Mine(xaxis, yaxis);
                        ObstacleList.Add(mine);
                        Console.WriteLine("Tree added to list.");
                        break;

                    case "mud":
                        Mud mud = new Mud(xaxis, yaxis);
                        ObstacleList.Add(mud);
                        Console.WriteLine("Tree added to list.");
                        break;

                    case "finish":
                        Finish finish = new Finish(xaxis, yaxis);
                        ObstacleList.Add(finish);
                        Console.WriteLine("Tree added to list.");
                        break;

                    case "missilelauncher":
                        ObstacleList.Add(new Missilelauncher(xaxis, yaxis));
                        Console.WriteLine("Missilelauncher added to list.");
                        break;

                    default:
                        break;
                    }
                }
            }
        }
Пример #33
0
    private void Awake()
    {
        Instance_ = this;
        enemyList = new List<EnemyAI>();
        enemySummonZoneList = new List<SummonZone>();

        tileArray = new TileType[height, width];
        finish = Finish.None;
        currentItem = ItemType.None;

        for (int i = 0; i < height; i++)
        {
            for (int j = 0; j < width; j++)
            {
                tileArray[i, j] = new TileType();
            }
        }

        fileManager = new FileManager();
    }
 private void OnFinish()
 {
     Finish?.Invoke(this, null);
     _skip  = false;
     _break = false;
 }
Пример #35
0
 public ClickSync(Finish finish, Sync sync)
 {
     _finish = finish;
     _sync   = sync;
 }
Пример #36
0
        private void Entertainment_btn1_Click(object sender, EventArgs e)
        {
            if (RB1.Checked)
            {
                if (!File.Exists(Watch_fileLoc))
                {
                    FileStream   aFile = new FileStream(Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Pastor Rick Warren, author of The Purpose-Driven Life, reflects on his own crisis of purpose in the wake of his book's wild success. He explains his belief that God's intention is for each of us to use our talents and influence to do good.Pastor Rick Warren is the author of The Purpose-Driven Life, which has sold more than 30 million copies worldwide. His has become an immensely influential voice seeking to apply the values of his faith to issues such as global poverty, HIV/AIDS and injustice.");
                    sw.WriteLine("Speaking at TED in 1998, Rev. Billy Graham marvels at technology's power to improve lives and change the world -- but says the end of evil, suffering and death will come only after the world accepts Christ. A legendary talk from TED's archives. The Rev. Billy Graham is a religious leader with a worldwide reach. In his long career as an evangelist, he has spoken to millions and been an advisor to US presidents");
                    sw.WriteLine("Julia Sweeney (God Said, Ha!) performs the first 15 minutes of her 2006 solo show Letting Go of God. When two young Mormon missionaries knock on her door one day, it touches off a quest to completely rethink her own beliefs. As a solo performer, comic actor Julia Sweeney explores love, cancer, family and faith. Her latest solo show and CD, Letting Go of God, is about the quest for something I could really believe in -- which turns out to be no God at all");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream   aFile = new FileStream(Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Pastor Rick Warren, author of The Purpose-Driven Life, reflects on his own crisis of purpose in the wake of his book's wild success. He explains his belief that God's intention is for each of us to use our talents and influence to do good.Pastor Rick Warren is the author of The Purpose-Driven Life, which has sold more than 30 million copies worldwide. His has become an immensely influential voice seeking to apply the values of his faith to issues such as global poverty, HIV/AIDS and injustice.");
                    sw.WriteLine("Speaking at TED in 1998, Rev. Billy Graham marvels at technology's power to improve lives and change the world -- but says the end of evil, suffering and death will come only after the world accepts Christ. A legendary talk from TED's archives. The Rev. Billy Graham is a religious leader with a worldwide reach. In his long career as an evangelist, he has spoken to millions and been an advisor to US presidents");
                    sw.WriteLine("Julia Sweeney (God Said, Ha!) performs the first 15 minutes of her 2006 solo show Letting Go of God. When two young Mormon missionaries knock on her door one day, it touches off a quest to completely rethink her own beliefs. As a solo performer, comic actor Julia Sweeney explores love, cancer, family and faith. Her latest solo show and CD, Letting Go of God, is about the quest for something I could really believe in -- which turns out to be no God at all");
                    sw.Close();
                    aFile.Close();
                }
            }

            else if (RB2.Checked)
            {
                if (!File.Exists(Not_Watch_fileLoc))
                {
                    FileStream   aFile = new FileStream(Not_Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Pastor Rick Warren, author of The Purpose-Driven Life, reflects on his own crisis of purpose in the wake of his book's wild success. He explains his belief that God's intention is for each of us to use our talents and influence to do good.Pastor Rick Warren is the author of The Purpose-Driven Life, which has sold more than 30 million copies worldwide. His has become an immensely influential voice seeking to apply the values of his faith to issues such as global poverty, HIV/AIDS and injustice.");
                    sw.WriteLine("Speaking at TED in 1998, Rev. Billy Graham marvels at technology's power to improve lives and change the world -- but says the end of evil, suffering and death will come only after the world accepts Christ. A legendary talk from TED's archives. The Rev. Billy Graham is a religious leader with a worldwide reach. In his long career as an evangelist, he has spoken to millions and been an advisor to US presidents");
                    sw.WriteLine("Julia Sweeney (God Said, Ha!) performs the first 15 minutes of her 2006 solo show Letting Go of God. When two young Mormon missionaries knock on her door one day, it touches off a quest to completely rethink her own beliefs. As a solo performer, comic actor Julia Sweeney explores love, cancer, family and faith. Her latest solo show and CD, Letting Go of God, is about the quest for something I could really believe in -- which turns out to be no God at all");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream   aFile = new FileStream(Not_Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Pastor Rick Warren, author of The Purpose-Driven Life, reflects on his own crisis of purpose in the wake of his book's wild success. He explains his belief that God's intention is for each of us to use our talents and influence to do good.Pastor Rick Warren is the author of The Purpose-Driven Life, which has sold more than 30 million copies worldwide. His has become an immensely influential voice seeking to apply the values of his faith to issues such as global poverty, HIV/AIDS and injustice.");
                    sw.WriteLine("Speaking at TED in 1998, Rev. Billy Graham marvels at technology's power to improve lives and change the world -- but says the end of evil, suffering and death will come only after the world accepts Christ. A legendary talk from TED's archives. The Rev. Billy Graham is a religious leader with a worldwide reach. In his long career as an evangelist, he has spoken to millions and been an advisor to US presidents");
                    sw.WriteLine("Julia Sweeney (God Said, Ha!) performs the first 15 minutes of her 2006 solo show Letting Go of God. When two young Mormon missionaries knock on her door one day, it touches off a quest to completely rethink her own beliefs. As a solo performer, comic actor Julia Sweeney explores love, cancer, family and faith. Her latest solo show and CD, Letting Go of God, is about the quest for something I could really believe in -- which turns out to be no God at all");
                    sw.Close();
                    aFile.Close();
                }
            }

            if (length == 4 || length == 3 || length == 1)
            {
                if (Next == "Environment")
                {
                    Environment frm = new Environment(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Sports")
                {
                    Sports_1 frm = new Sports_1(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Politics")
                {
                    Politics frm = new Politics(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Medical")
                {
                    Medical frm = new Medical(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Science")
                {
                    Science frm = new Science(NewUserSlections);
                    frm.Show();
                }
                else
                {
                    Finish frm = new Finish();
                    frm.Show();
                }
            }

            else
            {
                Finish frm = new Finish();
                frm.Show();
            }

            this.Close();
        }
 public IApplyFilter Finish(Finish model)
 {
     throw new NotImplementedException();
 }
Пример #38
0
        private void Entertainment_btn1_Click(object sender, EventArgs e)
        {
            if (RB1.Checked)
            {
                if (!File.Exists(Watch_fileLoc))
                {
                    FileStream   aFile = new FileStream(Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Lewis Pugh talks about his record-breaking swim across the North Pole. He braved the icy waters (in a Speedo) to highlight the melting icecap. Watch for astonishing footage -- and some blunt commentary on the realities of supercold-water swims. Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest.");
                    sw.WriteLine("After he swam the North Pole, Lewis Pugh vowed never to take another cold-water dip. Then he heard of Lake Imja in the Himalayas, created by recent glacial melting, and Lake Pumori, a body of water at an altitude of 5300 m on Everest -- and so began a journey that would teach him a radical new way to approach swimming and think about climate change.Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream   aFile = new FileStream(Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Lewis Pugh talks about his record-breaking swim across the North Pole. He braved the icy waters (in a Speedo) to highlight the melting icecap. Watch for astonishing footage -- and some blunt commentary on the realities of supercold-water swims. Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest.");
                    sw.WriteLine("After he swam the North Pole, Lewis Pugh vowed never to take another cold-water dip. Then he heard of Lake Imja in the Himalayas, created by recent glacial melting, and Lake Pumori, a body of water at an altitude of 5300 m on Everest -- and so began a journey that would teach him a radical new way to approach swimming and think about climate change.Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest");
                    sw.Close();
                    aFile.Close();
                }
            }

            else if (RB2.Checked)
            {
                if (!File.Exists(Not_Watch_fileLoc))
                {
                    FileStream   aFile = new FileStream(Not_Watch_fileLoc, FileMode.Create, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Lewis Pugh talks about his record-breaking swim across the North Pole. He braved the icy waters (in a Speedo) to highlight the melting icecap. Watch for astonishing footage -- and some blunt commentary on the realities of supercold-water swims. Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest.");
                    sw.WriteLine("After he swam the North Pole, Lewis Pugh vowed never to take another cold-water dip. Then he heard of Lake Imja in the Himalayas, created by recent glacial melting, and Lake Pumori, a body of water at an altitude of 5300 m on Everest -- and so began a journey that would teach him a radical new way to approach swimming and think about climate change.Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest");
                    sw.Close();
                    aFile.Close();
                }
                else
                {
                    FileStream   aFile = new FileStream(Not_Watch_fileLoc, FileMode.Append, FileAccess.Write);
                    StreamWriter sw    = new StreamWriter(aFile);
                    sw.WriteLine("Lewis Pugh talks about his record-breaking swim across the North Pole. He braved the icy waters (in a Speedo) to highlight the melting icecap. Watch for astonishing footage -- and some blunt commentary on the realities of supercold-water swims. Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest.");
                    sw.WriteLine("After he swam the North Pole, Lewis Pugh vowed never to take another cold-water dip. Then he heard of Lake Imja in the Himalayas, created by recent glacial melting, and Lake Pumori, a body of water at an altitude of 5300 m on Everest -- and so began a journey that would teach him a radical new way to approach swimming and think about climate change.Pushing his body through epic cold-water swims, Lewis Gordon Pugh wants to draw attention to our global climate. He's just back from swimming in a meltwater lake on the slopes of Mount Everest");
                    sw.Close();
                    aFile.Close();
                }
            }

            if (length == 4 || length == 3 || length == 1)
            {
                if (Next == "Politics")
                {
                    Politics frm = new Politics(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Medical")
                {
                    Medical frm = new Medical(NewUserSlections);
                    frm.Show();
                }

                else if (Next == "Science")
                {
                    Science frm = new Science(NewUserSlections);
                    frm.Show();
                }
                else
                {
                    Finish frm = new Finish();
                    frm.Show();
                }
            }
            else
            {
                Finish frm = new Finish();
                frm.Show();
            }

            this.Close();
        }
Пример #39
0
    private void Update()
    {
        playerDeathCountLabel.text = playerDeathCount.ToString();
        enemyDeathCountLabel.text = enemyDeathCount.ToString();

        if (flag == null || player == null || isGameOver == true)
            return;

        if (player.isDead == true && playerDeathCount > 0)
        {
            player.isDead = false;
            StartCoroutine(playerSummonZone.SummonPlayer(player));
            playerDeathCount--;
        }

        enemyLiveCount = enemyList.Count;

        foreach (EnemyAI enemy in enemyList)
        {
            if (enemy.IsDead == true)
            {
                if (enemyDeathCount <= 0)
                {
                    enemyLiveCount--;
                    continue;
                }

                enemy.IsDead = false;
                StartCoroutine(enemySummonZoneList[Random.Range(0, enemyList.Count)].SummonEnemy(enemy));
                enemyDeathCount--;
                continue;
            }
        }

        if (flag.isDead == true || (playerDeathCount <= 0 && player.isDead == true))
        {
            finish = Finish.Lose;
        }
        else if (enemyDeathCount <= 0 && enemyLiveCount <= 0)
        {
            finish = Finish.Win;
        }

        if (finish != Finish.None)
        {
            isGameOver = true;
            GameObject DrawObject = CreateObjectPrefab("Prefabs/FinishPanel", Vector3.zero);
            DrawObject.GetComponent<FinishPopup>().OpenFinishPopup(finish);
            DrawObject.GetComponent<FinishPopup>().SetScore = currentScore;
        }

        // 아이템이 생성
        // 무적 아이템, 전체 적 폭발 아이템, 적 일시정지 아이템
        // 20초마다 생성. 10초안에 안먹으면 삭제
        itemTimer += Time.deltaTime;
        if (itemTimer > 20f)
        {
            int rand = Random.Range(0, 3);
            item.CreateItem((ItemType)rand);
            itemTimer = 0;
        }
    }