예제 #1
0
    //Удаление всех дублей, начиная с номера number, а также переключение управления на парадоксальный дубль
    public void DeleteDoubles(int number, CharacterController paradox)
    {
        GameObject[] doubles = GameObject.FindGameObjectsWithTag (Tags.character);
        for (int i=0; i<doubles.Length; i++)
        {
            if (doubles [i].GetComponent<CharacterController> ().GetNumber () > number)
            {
                Destroy (doubles [i]);
                //doubles [i].GetComponent<CharacterController> ().SetReturning();
            }
        }
        for (int i=chronology.chronology.Count-1; i>number; i--)
        {
            if (i<appearances.Count)
                appearances.RemoveAt(i);
            chronology.chronology.RemoveAt(i);

        }
        PlayerPrefs.SetFloat ("beginTime", 0f);
        for (int i=0;i<appearances.Count;i++)
        {
            if (appearances[i].time<PlayerPrefs.GetFloat("beginTime"))
                PlayerPrefs.SetFloat("beginTime", appearances[i].time);
        }
        for (int i=chronology.chronology[number].sequence.Count-1; i>paradox.GetActNumber(); i--)
            chronology.chronology [number].sequence.RemoveAt (i);
        paradox.underControl = true;
        mainCharacter = paradox.transform;
        begin = false;
    }