Пример #1
0
        /// <summary>
        /// Adds a random Todo-item
        /// </summary>
        private async Task AddRandomTodo()
        {
            // Add todo with random name
            await AddTodo(RandomNameGenerator.GetRandomName());

            // Enter rename mode
            SelectedTodo.RenameActive = true;
        }
Пример #2
0
        static void Main(string[] args)
        {
            RandomNameGenerator rng     = new RandomNameGenerator();
            ICoffeeFactory      factory = new CoffeeFactory();

            for (int i = 0; i < 1000; i++)
            {
                ICoffee c1 = factory.CreateCoffee(nameof(Cappuccino));
                c1.Serve(rng.GetRandomName());
                ICoffee c2 = factory.CreateCoffee(nameof(Espresso));
                c2.Serve(rng.GetRandomName());
                ICoffee c3 = factory.CreateCoffee(nameof(LatteDoppio));
                c3.Serve(rng.GetRandomName());
                ICoffee c4 = factory.CreateCoffee(nameof(LatteGrande));
                c4.Serve(rng.GetRandomName());
                ICoffee c5 = factory.CreateCoffee(nameof(LatteTriplo));
                c5.Serve(rng.GetRandomName());
            }
        }
Пример #3
0
        static void Main(string[] args)
        {
            RandomNameGenerator rng = new RandomNameGenerator();

            for (int i = 0; i < 1000; i++)
            {
                ICoffee c1 = new Cappuccino(rng.GetRandomName());
                c1.Serve();
                ICoffee c2 = new Espresso(rng.GetRandomName());
                c2.Serve();
                ICoffee c3 = new LatteDoppio(rng.GetRandomName());
                c3.Serve();
                ICoffee c4 = new LatteGrande(rng.GetRandomName());
                c4.Serve();
                ICoffee c5 = new LatteTriplo(rng.GetRandomName());
                c5.Serve();
            }

            //Console.WriteLine();
            //Console.WriteLine( $"{Coffee.CoffeesCreated} objects created");
        }
Пример #4
0
    public GameObject CreateCharacter3(int startingRank = 1)
    {
        GameObject     character = Instantiate(bear);
        CharacterStats c         = character.GetComponent <CharacterStats>();

        c.SetName(RandomNameGenerator.GetRandomName());

        for (int i = 1; i < startingRank; i++)
        {
            character.GetComponent <CharacterStats>().RankUp();
        }

        return(character);
    }
Пример #5
0
    public GameObject CreateRandomUnit()
    {
        //Get list of all possible units to randomly choose from
        List <GameObject> allUnits = new List <GameObject> {
            wolf, rabbit, bear
        };

        int rng = Random.Range(0, allUnits.Count);

        GameObject     character = Instantiate(allUnits[rng], new Vector3(-1, -1, 0), new Quaternion());
        CharacterStats c         = character.GetComponent <CharacterStats>();

        c.SetName(RandomNameGenerator.GetRandomName());

        return(character);
    }
Пример #6
0
    void CreateNewCampaign()
    {
        string name1 = RandomNameGenerator.GetRandomName();
        string name2 = RandomNameGenerator.GetRandomName();
        string name3 = RandomNameGenerator.GetRandomName();
        string name4 = RandomNameGenerator.GetRandomName();

        Debug.Log("Player 1 is " + name1);
        Debug.Log("Player 2 is " + name2);
        Debug.Log("Player 3 is " + name3);
        Debug.Log("Player 4 is " + name4);


        // todo: skill point resets?

        SkillStorage.SetName(1, name1);
        SkillStorage.SetName(2, name2);
        SkillStorage.SetName(3, name3);
        SkillStorage.SetName(4, name4);

        GameManager.Instance.ResetDeath();
        GameManager.Instance.ShowUpgradeScreen();
    }
Пример #7
0
 public void ButtonCallFromInspector()
 {
     playerName = RandomNameGenerator.GetRandomName();
 }
Пример #8
0
    //[Tooltip("n means something")]
    //public int n;

    // Use this for initialization
    void Start()
    {
        health     = 50;
        playerName = RandomNameGenerator.GetRandomName();
    }
Пример #9
0
    public void InitializeTaggingManager()
    {
        m_UIManager = FindObjectOfType <UIManager>();

        RandomNameGenerator randomNameGenerator = new RandomNameGenerator();

        m_playersIdentifiers = FindObjectsOfType <TaggingIdentifier>().ToList();
        PlayerInfoUI[] playerInfoUI = FindObjectsOfType <PlayerInfoUI>();

        // Inject all PlayerInfoUI to Players
        if (playerInfoUI.Length == m_playersIdentifiers.Count)
        {
            for (int i = 0; i < m_playersIdentifiers.Count; i++)
            {
                m_playersIdentifiers[i].PlayerInfo = playerInfoUI[i];

                if (m_playersIdentifiers[i].IsUserPlayer)
                {
                    string playerName = PlayerPrefs.GetString("PLAYER_INPUT_NAME");
                    if (playerName != "")
                    {
                        m_playersIdentifiers[i].PlayerName = playerName;
                    }
                    else
                    {
                        m_playersIdentifiers[i].PlayerName = randomNameGenerator.GetRandomName();
                    }
                }
                else
                {
                    m_playersIdentifiers[i].PlayerName = randomNameGenerator.GetRandomName();
                }
            }
        }
        else
        {
            Debug.LogWarning($"There are more or less PlayerInfo scripts than Players in the scene!! You have {m_playersIdentifiers.Count} players and {playerInfoUI.Length} info scripts!");
            foreach (PlayerInfoUI infoUI in playerInfoUI)
            {
                infoUI.gameObject.SetActive(false);
            }
        }

        // Inject all ids into tagging identifiers
        for (int i = 0; i < m_playersIdentifiers.Count; i++)
        {
            m_playersIdentifiers[i].PlayerIdentifier = i;
            m_playersIdentifiers[i].taggingManager   = this;

            // Subscribing every player's UpdateWhoIsTag function into the manager
            OnPlayerWasTagged += m_playersIdentifiers[i].UpdateWhoIsTag;
        }

        // Initializing All AI
        List <AIController> allAIPlayers = FindObjectsOfType <AIController>().ToList();
        int currentIndex        = 0;
        int amountOfTryHardAI   = Random.Range(1, 3);
        int amountOfCollectorAI = Random.Range(1, 3);

        // Having 1 or 2 Try Hard AI
        for (int i = 0; i < amountOfTryHardAI; i++)
        {
            allAIPlayers[currentIndex].MakeTryHardAI();
            currentIndex++;
        }

        // Having 1 or 2 Power Up Collector AI
        for (int i = 0; i < amountOfCollectorAI; i++)
        {
            allAIPlayers[currentIndex].MakePowerUpCollectorAI();
            currentIndex++;
        }

        // the remaining AI is baseline!
        for (; currentIndex < allAIPlayers.Count; currentIndex++)
        {
            allAIPlayers[currentIndex].MakeAIBaseline();
        }
    }