Пример #1
0
        private string Promenade(int target)
        {
            // Create the dance
            Dance dance = new Dance(16);

            string[] moves = Aoc.Framework.Input.GetStringVector(this, ",");

            // Build an history of positions
            Dictionary <string, int> positions = new Dictionary <string, int>
            {
                [dance.ToString()] = 0
            };

            // Repeat dance until exhaustion
            int counter = 0;

            while (counter < target)
            {
                // Dance ~
                counter++;
                DanceSingle(dance, moves);

                // Look for a cycle
                string hash = dance.ToString();
                if (positions.ContainsKey(hash))
                {
                    // Found a cycle, skip forward
                    int length = counter - positions[hash];

                    // Skip the cycle as many times as possible
                    counter = target - ((target - counter) % length);
                }
            }
            return(dance.ToString());
        }
Пример #2
0
    GameObject CreateCharacter(Character character, Dance dance)
    {
        string charName  = character.ToString("g");
        string danceName = dance.ToString("g");

        GameObject instance = Instantiate(Resources.Load("Characters/" + charName)) as GameObject;
        var        spawn    = GameObject.Find("PlayerSpawnPoint").transform;

        instance.transform.position   = spawn.position;
        instance.transform.localScale = spawn.localScale;
        instance.transform.rotation   = spawn.rotation;

        instance.GetComponent <Animator>().runtimeAnimatorController =
            (RuntimeAnimatorController)Resources.Load("Dances/" + danceName,
                                                      typeof(RuntimeAnimatorController));

        return(instance);
    }
Пример #3
0
 public void setDance(int _dance)
 {
     Dance      = Dance + _dance;
     dance.text = Dance.ToString();
 }