Exemplo n.º 1
0
    /*private Vector3 GenerateTarget()
     * {
     *  //int randTarget = Random.Range(0, build.getBuildings.Length);
     *  //GameObject theTarget = build.getBuildings[randTarget];
     *  //return theTarget.transform.position;
     * }*/

    private void GenerateAction()
    {
        if (Random.Range(0, 3600) < 20 && !isInMovement)
        {
            //int chooseAction = Random.Range(0, 100);
            //Debug.Log(isArrived);
            //if (chooseAction <= stayHomePercentage)
            //{
            //    Debug.Log("Pas voir copaing");
            //    isInMovement = false;
            //}
            //else if (chooseAction <= goToPeoplePercentage)
            //{
            //    Debug.Log("Voir copaing !!");
            //    isInMovement = true;
            //    agent.SetDestination(target);

            //}
            //else if (chooseAction <= goToCenterPercentage)
            //{
            //    Debug.Log("Peut être copaing ?");
            //    isInMovement = true;
            //    agent.SetDestination(target);
            //}
            //else
            //{
            //    Debug.Log("WTF");
            //}
            EnumChoice choice = setChoice(70, 20, 10);
            switch (choice)
            {
            case EnumChoice.home:
                Debug.Log("Pas voir copaing");
                break;

            case EnumChoice.center:
                Debug.Log("Peut être copaing ?");
                break;

            case EnumChoice.people:
                Debug.Log("Voir copaing !!");
                agent.SetDestination(target);
                break;

            default:
                Debug.Log("WTF");
                break;
            }
        }
        if (isArrived)
        {
            //Debug.Break();
            isArrived = false;
            InvokeRepeating("DestinationToHouse", timeStaying, 10f);
        }
    }
Exemplo n.º 2
0
        /// <summary>
        /// Boucle du jeu.
        /// </summary>
        public void LoopGame()
        {
            EnumChoice choice = EnumChoice.None;

            while (choice != EnumChoice.Exit)
            {
                choice = EnumChoice.None;
                hangmanController.DisplayOptions();
                if (int.TryParse(Console.ReadLine(), out int number))
                {
                    Console.Clear();
                    if (Enum.IsDefined(typeof(EnumChoice), number))
                    {
                        choice = (EnumChoice)number;
                        switch (choice)
                        {
                        case EnumChoice.ChooseFile:
                            ChooseFileOption();
                            break;

                        case EnumChoice.Play:
                            PlayOption();
                            break;

                        case EnumChoice.DisplayScores:
                            DisplayScoresOption();
                            break;

                        case EnumChoice.AddNewWord:
                            hangmanController.AddNewWord();
                            break;

                        case EnumChoice.SaveFile:
                            SaveFile();
                            break;

                        case EnumChoice.Exit:
                            Environment.Exit(0);
                            break;
                        }
                        Console.WriteLine();
                    }
                }
                else
                {
                    Console.Clear();
                    Console.WriteLine("Choix incorrect!\n");
                }
            }
            Console.ReadLine();
        }
Exemplo n.º 3
0
    private void SetTarget()
    {
        EnumChoice choice = setChoice(70, 20, 10);

        switch (choice)
        {
        case EnumChoice.home:
            target = home;
            break;

        case EnumChoice.center:
            target = centers[Random.Range(0, centers.Count)];
            break;

        case EnumChoice.people:
            target = friends[Random.Range(0, friends.Count)];
            break;

        default:
            Debug.Log("WTF");
            break;
        }
    }
Exemplo n.º 4
0
        private Tuple <Decision, int> ChooseEnum(Duel duel, int numberOfChoicesMade, List <Tuple <Decision, int> > decisions, EnumChoice choice)
        {
            //TODO: Atm only Petrova is supported.
            var options = duel.GetPlayer(choice.Player).BattleZone.Cards.SelectMany(x => x.Subtypes).Except(choice.Excluded.Cast <Subtype>());

            if (!options.Any())
            {
                options = duel.GetPlayer(choice.Player).AllCards.SelectMany(x => x.Subtypes).Except(choice.Excluded.Cast <Subtype>());
            }
            foreach (var option in options)
            {
                var currentChoice = new EnumDecision(option);
                using var duelCopy = new Duel(duel);
                var newChoice = duelCopy.Continue(currentChoice);
                _optionsRemaining -= options.Count();
                var foo = Choose(newChoice, duelCopy, currentChoice, numberOfChoicesMade + 1);
                decisions.Add(new Tuple <Decision, int>(currentChoice, foo.Item2));
            }
            return(Choose(choice, decisions));
        }