예제 #1
0
    public void InitGameRound()
    {
        //Mouse stuffs
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;

        //Reset important things.
        ReservedAppearances = new List <CharacterGen.Appearance>();
        CelebTargets.Clear();
        PhotosThisRound.Clear();

        //Get CharacterInformations in scene so they can be assigned a random few celebrities.
        List <CharacterInformation> allCharacters = new List <CharacterInformation>(FindObjectsOfType <CharacterInformation>());
        //Grab a celebrities from the database
        List <CharacterInformation.Character> allCelebs = new List <CharacterInformation.Character>(Database.GetAllCharacters());

        //Pick 3 random celebrities from the database and assign them
        for (int counter = 0; counter < NumberOfCelebsPerRound; counter++)
        {
            //Select random celeb
            int selectedCelebIndex = Random.Range(0, allCelebs.Count);

            //Select random character from scene to make become this celeb
            int selectedCharacterIndex = Random.Range(0, allCharacters.Count);
            allCharacters[selectedCharacterIndex].AssignCharacter(allCelebs[selectedCelebIndex]);
            //Debug.Log(allCharacters[selectedCelebIndex])
            //Let selected char pick some identifying features
            CharacterGen.Appearance appearance = allCharacters[selectedCharacterIndex].GenerateFeatures();
            ReservedAppearances.Add(appearance);
            IndicateCelebColors.SetCelebAppearance(counter, appearance);

            //record that this celeb is a target this round, then remove them from the pools of potentially picked celebs and characters.
            CelebTargets.Add(allCharacters[selectedCharacterIndex], -1);
            allCelebs.RemoveAt(selectedCelebIndex);
            allCharacters.RemoveAt(selectedCharacterIndex);
        }

        //Generate outfits for the rest of the characters
        foreach (CharacterInformation character in allCharacters)
        {
            character.GenerateFeatures();
        }

        //Tell player to start moving? Maybe? If that's necessary?
    }
예제 #2
0
    public void RegisterPhoto(string path, List <CharacterInformation.Character> celebritiesInPhoto)
    {
        Photo newPhoto = new Photo(path, GameNumber);

        newPhoto.CelebritiesInPhoto = new List <CharacterInformation.Character>(celebritiesInPhoto);
        newPhoto.RoundTakenDuring   = _gameNumber;
        newPhoto.LoadImage();

        //Record index of PhotosThisRound with their associated celebrities
        CharacterInformation[] celebsInScene = new CharacterInformation[CelebTargets.Keys.Count];
        CelebTargets.Keys.CopyTo(celebsInScene, 0);
        for (int i = 0; i < celebsInScene.Length; i++)
        {
            CharacterInformation.Character celebChar = celebsInScene[i].GetInfo();
            if (newPhoto.CelebritiesInPhoto.Contains(celebChar))
            {
                int celebPhotoIndex = PhotosThisRound.Count;
                CelebTargets[celebsInScene[i]] = celebPhotoIndex;
                //TEMP tell player that they took a picture of that celeb
                IndicateCelebColors.SetCelebFound(i);
            }
        }
        PhotosThisRound.Add(newPhoto);
    }
예제 #3
0
 private void OnDestroy()
 {
     Instance = null;
 }
예제 #4
0
 private void Awake()
 {
     Instance = this;
 }