Наследование: MonoBehaviour
Пример #1
0
    IEnumerator Start()
    {
        if (LeadingFrog)
        {
            Level1Manager.NextTurn += () => StartCoroutine(WaitAndStartNextTurn());
            while (Level1Manager.Instance == null)
            {
                yield return(new WaitForEndOfFrame());
            }
            GameObject go = Level1Manager.Instance.GetFreeKuvshinka();
            transform.SetParent(go.transform);
            transform.localPosition = Vector3.zero;
            Level1Manager.Instance.SetLeadingFrogPosition(go);
            yield return(new WaitForSecondsRealtime(2.0f));

            Level1Manager.NextTurn();
        }
        else
        {
            Level1Manager.CorrectKuvshinkaPointed += NextJump;
            while (Level1Manager.Instance == null)
            {
                yield return(new WaitForEndOfFrame());
            }
            GameObject go = Level1Manager.Instance.GetFreeKuvshinka();
            transform.SetParent(go.transform);
            transform.localPosition = Vector3.zero;
            Level1Manager.Instance.SetMyFrogPosition(go);
            while (Level1Manager.NextTurn == null)
            {
                yield return(new WaitForEndOfFrame());
            }
        }
    }
Пример #2
0
 void Awake()
 {
     zastavka.gameObject.SetActive(true);
     Instance = this;
     _rightWay = new ArrayList();
     ActiveObjectPointed += KuvshinkaPointed;
     ResetAttempts();
     Init();
     foreach (var digit in digits) digit.SetActive(false);
 }
Пример #3
0
 void Awake()
 {
     if (!instance)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Пример #4
0
    IEnumerator RotateAndJump(GameObject go)
    {
        var target = go.transform.position - RotationPoint.transform.position;
        var angle  = Vector3.Angle(transform.up, target);

        if (FrogAnimator != null)
        {
            FrogAnimator.Play("Rotate");
        }

        yield return(new WaitForSeconds(0.1f));

        if (RotationSpeed < 0.1)
        {
            RotationSpeed = 1f;
        }

        for (var i = 0; i < (int)(angle / RotationSpeed); i++)
        {
            transform.RotateAround(RotationPoint.position, Vector3.Cross(transform.up, target), RotationSpeed); // вескторное произведение чтобы определить направление поворота
            yield return(new WaitForSeconds(1f / 30f));                                                         // частота кадров анимации поворота
        }
        if (FrogAnimator != null)
        {
            FrogAnimator.Play("Jump");
        }
        for (var i = 0; i < 15; i++) // количество кадров анимации прыжка
        {
            transform.Translate(target / Mathf.Pow(2.005f, i + 1f), Space.World);
            yield return(new WaitForSeconds(1f / 30f)); // частота кадров анимации прыжка
        }
        transform.SetParent(go.transform);
        transform.localPosition = Vector3.zero;
        if (!LeadingFrog)
        {
            if (Level1Manager.Instance.LevelDownText.gameObject.activeSelf)
            {
                Level1Manager.Instance.LevelDownText.gameObject.SetActive(false);
                yield break;
            }
            Level1Manager.NextTurn();
        }
        else
        {
            if (Level1Manager.Instance.CurrentJumpsBeforeNextLevel < 1)
            {
                Level1Manager.Instance.LevelUp();
            }
            else
            {
                Level1Manager.Instance.Idle = true;
            }
        }
    }
Пример #5
0
 public void PointerDownReceived()
 {
     if (!Level1Manager.Instance.Idle)
     {
         return;                               // пока лягушка прыгает не принимаем нажатия
     }
     if (GameObjectToSend == null)
     {
         GameObjectToSend = gameObject;
     }
     Level1Manager.ActiveObjectPointed(GameObjectToSend);
 }
Пример #6
0
 void Awake()
 {
     zastavka.gameObject.SetActive(true);
     Instance             = this;
     _rightWay            = new ArrayList();
     ActiveObjectPointed += KuvshinkaPointed;
     ResetAttempts();
     Init();
     foreach (var digit in digits)
     {
         digit.SetActive(false);
     }
 }
Пример #7
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        soundEffects = GetComponent <AudioSource>();
        myLevel      = 1;
    }
    void Start()
    {
        text = GetComponent <Text>();

        GameOverText.GetComponent <Text>().enabled = false;

        PlayerHealth = MaxPlayerHealth;

        LevelManager = FindObjectOfType <Level1Manager>();

        LifeSystem = FindObjectOfType <LifeManager>();

        isDead = false;
    }
Пример #9
0
    private void Start()
    {
        //currentHappiness = GetComponent<Image>();
        manager = GetComponent <Level1Manager>();

        happyMax     = 100f;
        maxHappiness = 100f;
        UpdateHappiness();
        aMessage.text = "Good Morning";
        bMessage.text = "";
        messagec.text = "";
        messaged.text = "";
        minutes       = 0;
        hours         = 8;

        timer.text = hours + ":" + minutes.ToString("f0") + "AM";

        inBed = false;
    }
Пример #10
0
    //public Dialog dialog;
    //private ObjectPooler OP;

    private void Awake()
    {
        Instance = this;
    }
Пример #11
0
    void Start()
    {
        level1Manager = this;

        GameManager.gameManager.StartNarrative();
    }
Пример #12
0
 // populating it
 void Start()
 {
     Level1Manager = FindObjectOfType <Level1Manager>();
 }