예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (!hasMoved && (transform.position - startPos).magnitude > 2f)
        {
            hasMoved = true;
        }

        if (Input.GetKeyUp(KeyCode.Escape))
        {
//			BackToStart (true);
            Invoke("BackToStart", 1f);
            dimmer.FadeIn(1f);
        }

        transform.localScale = Vector3.MoveTowards(transform.localScale, targetSize, Time.deltaTime);

        grounded = false;

        for (int i = -1; i < 2; i++)
        {
            Vector3 spot         = transform.position + i * Vector3.left * 0.5f;
            bool    spotGrounded = Physics2D.Raycast(spot, Vector3.down, 1f, groundLayer);

            Color c = spotGrounded ? Color.green : Color.red;
            Debug.DrawRay(spot, Vector3.down, c);

            if (spotGrounded)
            {
                grounded = true;
                break;
            }
        }

        RollCheck();
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape) && Application.platform != RuntimePlatform.WebGLPlayer && !Application.isEditor)
        {
            interacted = true;
            Debug.Log("Quit...");
            Application.Quit();
            return;
        }

        if (Input.GetMouseButton(0))
        {
            return;
        }

        if (canStart && Input.anyKeyDown && !interacted && !Input.GetKey(KeyCode.Escape))
        {
            interacted = true;
            anim.SetTrigger("hide");
            dimmer.FadeIn(0.5f);
            Invoke("StartGame", 2f);

            AudioManager.Instance.PlayEffectAt(8, Vector3.zero, 0.5f);
            AudioManager.Instance.PlayEffectAt(9, Vector3.zero, 0.5f);
        }
    }
예제 #3
0
    void DoEnd()
    {
        dimmer.FadeIn(2f);
        Tweener.Instance.ScaleTo(logo, logoSize, 0.4f, 1.7f, TweenEasings.BounceEaseOut);

        Invoke("DoSound", 1.7f);
    }
예제 #4
0
    // Update is called once per frame
    void Update()
    {
        if (canGo && Input.GetKeyDown(KeyCode.Escape))
        {
            if (Application.platform != RuntimePlatform.WebGLPlayer)
            {
                dimmer.FadeIn(1f);
                CancelInvoke("DoQuit");
                Invoke("DoQuit", 1.1f);
                return;
            }
        }

        if (Application.isEditor)
        {
            Time.timeScale = Input.GetKey(KeyCode.Tab) ? 5f : 1f;
        }
    }
예제 #5
0
    public void ShowEnd(string text)
    {
        dimmer.SetText(text);
        dimmer.FadeIn(1f);

        AudioManager.Instance.melodyVolume = 0f;

        Invoke("EnableEnd", 1.5f);
    }
예제 #6
0
 // Update is called once per frame
 void Update()
 {
     if (canGo && Input.anyKeyDown)
     {
         CancelInvoke("ChangeScene");
         Invoke("ChangeScene", 1.1f);
         dimmer.FadeIn(1f);
         AudioManager.Instance.PlayEffectAt(28, Vector3.zero, 2f);
         cam.Chromate(0.25f * 4f, 0.1f * 4f);
     }
 }
예제 #7
0
    void Update()
    {
        StatsManager.Instance.AddTime(Time.deltaTime);

        if (Input.GetKeyDown(KeyCode.Space))
        {
            StartProcessing();
            AudioManager.Instance.PlayEffectAt(10, Vector3.zero, 1.5f);
            AudioManager.Instance.PlayEffectAt(19, Vector3.zero, 1.5f);
            AudioManager.Instance.PlayEffectAt(22, Vector3.zero, 1.5f);
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            dimmer.FadeIn(1f);
            CancelInvoke("BackToStart");
            Invoke("BackToStart", 1.1f);
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            Restart();
            AudioManager.Instance.PlayEffectAt(10, Vector3.zero, 1.5f);
            AudioManager.Instance.PlayEffectAt(19, Vector3.zero, 1.5f);
            AudioManager.Instance.PlayEffectAt(22, Vector3.zero, 1.5f);
        }

        if (Application.isEditor)
        {
            Time.timeScale = Input.GetKey(KeyCode.Tab) ? 5f : 1f;

            if (Input.GetKeyDown(KeyCode.KeypadPlus))
            {
                EndLevel();
            }
        }
    }
예제 #8
0
    // Update is called once per frame
    void Update()
    {
        if (Input.anyKeyDown && !started)
        {
            started = true;
            dimmer.FadeIn(3f);
            Invoke("ChangeScene", 3f);

            Tweener.Instance.ScaleTo(logo, Vector3.zero, 0.5f, 0.3f, TweenEasings.QuadraticEaseIn);
            Tweener.Instance.ScaleTo(startHelp, new Vector3(3f, 0f, 1f), 0.5f, 0f, TweenEasings.QuadraticEaseIn);

            AudioManager.Instance.PlayEffectAt(1, Vector3.zero, 0.502f);
            AudioManager.Instance.PlayEffectAt(3, Vector3.zero, 1f);
            AudioManager.Instance.PlayEffectAt(5, Vector3.zero, 1f);
            AudioManager.Instance.PlayEffectAt(12, Vector3.zero, 1f);
            AudioManager.Instance.PlayEffectAt(14, Vector3.zero, 1f);

            Invoke("DelayedSound", 0.3f);
        }
    }
예제 #9
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape) && Application.platform != RuntimePlatform.WebGLPlayer && !Application.isEditor)
        {
            interacted = true;
            Debug.Log("Quit...");
            Application.Quit();
            return;
        }

        if (Input.GetMouseButton(0))
        {
            return;
        }

        if (canStart && Input.anyKeyDown && !interacted && !Input.GetKey(KeyCode.Escape))
        {
            interacted = true;

            if (anim)
            {
                anim.SetTrigger("hide");
            }

            textArea.text = "";
            EffectManager.Instance.AddEffect(2, effectSpot.position);
            EffectManager.Instance.AddEffect(9, effectSpot.position);

            dimmer.FadeIn(0.5f);
            Invoke("StartGame", 2f);

            AudioManager.Instance.Highpass(true);

            AudioManager.Instance.PlayEffectAt(1, effectSpot.position, 1f);
        }
    }
예제 #10
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Water")
        {
            Manager.Instance.hasDied = true;
            AudioManager.Instance.PlayEffectAt(30, transform.position, 1f);
            dimmer.FadeIn(1f);
            Invoke("Respawn", 1f);
        }

        if (collision.gameObject.tag == "Pickup")
        {
            var pu = collision.gameObject.GetComponent <Pickup>();

            if (pu.type == Pickup.Type.MaxHp)
            {
                Manager.Instance.disableThese.Add(pu.gameObject.name);
                hpMax++;
                hp++;
                cam.BaseEffect(1.5f);
                Grow();

                EffectManager.Instance.AddEffect(11, collision.transform.position);
            }

            if (pu.type == Pickup.Type.Hp)
            {
                hp++;

                if (hp > hpMax)
                {
                    hp = hpMax;
                }
                cam.BaseEffect(0.5f);

                EffectManager.Instance.AddEffect(11, collision.transform.position);

                AudioManager.Instance.PlayEffectAt(18, transform.position, 1f);
                AudioManager.Instance.PlayEffectAt(25, transform.position, 0.3f);
                AudioManager.Instance.PlayEffectAt(2, transform.position, 0.5f);
                AudioManager.Instance.PlayEffectAt(3, transform.position, 0.5f);
            }
            else
            {
                AudioManager.Instance.PlayEffectAt(0, transform.position, 1f);
                AudioManager.Instance.PlayEffectAt(25, transform.position, 1f);
                AudioManager.Instance.PlayEffectAt(2, transform.position, 1f);
                AudioManager.Instance.PlayEffectAt(3, transform.position, 1f);
            }

            if (pu.type == Pickup.Type.DoubleJump)
            {
                Manager.Instance.disableThese.Add(pu.gameObject.name);
                bandanna.SetActive(true);
                canDoubleJump = true;
                cam.BaseEffect(2.5f);
                Manager.Instance.hasBandanna = true;
                EffectManager.Instance.AddEffect(12, collision.transform.position);
            }

            if (pu.type == Pickup.Type.Damage)
            {
                Manager.Instance.disableThese.Add(pu.gameObject.name);
                blade.SetActive(true);
                damage = 2;
                cam.BaseEffect(2.5f);
                Manager.Instance.hasBlade = true;
                EffectManager.Instance.AddEffect(12, collision.transform.position);
            }

            EffectManager.Instance.AddEffect(1, collision.transform.position);
            EffectManager.Instance.AddEffect(2, collision.transform.position);

            UpdateHp();

            Destroy(pu.gameObject);
        }
    }
예제 #11
0
 void DoFade()
 {
     dimmer.FadeIn(1.5f);
 }