Ejemplo n.º 1
0
    private IEnumerator ObserveTimesClicked()
    {
        float timeElapsed = 0;

        while (true)
        {
            if (timesClicked == 1)
            {
                timeElapsed += Time.deltaTime;
                if (timeElapsed >= awaitTime)
                {
                    timeElapsed  = 0;
                    timesClicked = 0;
                    clickedLily  = null;
                    player.FaceClickedPosition(player.ThrowTongue);
                }
            }
            else if (timesClicked >= 2 && !jumping)
            {
                jumping = true;
                player.FaceClickedPosition(delegate
                {
                    player.JumpToAnotherWaterLily(clickedLily.transform);
                });
                timeElapsed  = 0;
                timesClicked = 0;
            }
            yield return(null);
        }
    }
Ejemplo n.º 2
0
    private void HandleMouseClick()
    {
        RaycastHit2D hit  = new RaycastHit2D();
        WaterLily    lily = hit.GetComponentFromMousePositionClicked <WaterLily>(viewCamera);

        if (!lily || !lily.isReachable)
        {
            player.FaceClickedPosition(player.ThrowTongue);
        }
        else
        {
            if (lily == clickedLily)
            {
                timesClicked++;
            }
            else
            {
                clickedLily  = lily;
                timesClicked = 0;
                timesClicked++;
            }
        }
    }
Ejemplo n.º 3
0
    private void CollidChecker_OnEnteredObject(IObject collidingObject)
    {
        tCollidingObject = collidingObject;

        //---방해물 or 장애물 충돌---
        if (collidingObject is Laplas)
        {
            character.animator.SetTrigger(s_HitHash);
            // Life 감소는 Laplas에서

            //m_isMovable = false;
            m_Audio.PlayOneShot(crashing);

            if (prefep_crash != null)
            {
                Instantiate(prefep_crash, transform.position, Quaternion.Euler(new Vector3(-90, 0, 0)));
            }
        }

        else if (collidingObject is Beaver)
        {
            character.animator.SetTrigger(s_HitHash);
            moveDirection = new Vector3(0, 3, -3);
            m_Audio.PlayOneShot(crashing);

            if (prefep_crash != null)
            {
                Instantiate(prefep_crash, transform.position, Quaternion.Euler(new Vector3(-90, 0, 0)));
            }
        }

        else if (collidingObject is Catfish)
        {
            character.animator.SetTrigger(s_HitHash);
            moveDirection = new Vector3(0, 3, -3);
            m_Audio.PlayOneShot(crashing);

            if (prefep_crash != null)
            {
                Instantiate(prefep_crash, transform.position, Quaternion.Euler(new Vector3(-90, 0, 0)));
            }
        }

        else if (collidingObject is SeaOtter_body)
        {
            character.animator.SetTrigger(s_HitHash);
            moveDirection = new Vector3(0, 3, -3);
            m_Audio.PlayOneShot(crashing);

            if (prefep_crash != null)
            {
                Instantiate(prefep_crash, transform.position, Quaternion.Euler(new Vector3(-90, 0, 0)));
            }
        }

        else if (collidingObject is Hipo)
        {
            character.animator.SetTrigger(s_HitHash);
            moveDirection = new Vector3(0, 3, -3);
            m_Audio.PlayOneShot(crashing);

            if (prefep_crash != null)
            {
                Instantiate(prefep_crash, transform.position, Quaternion.Euler(new Vector3(-90, 0, 0)));
            }
        }

        else if (collidingObject is Snake_body)
        {
            character.animator.SetTrigger(s_HitHash);
            moveDirection = new Vector3(0, 3, -3);
            m_Audio.PlayOneShot(crashing);

            if (prefep_crash != null)
            {
                Instantiate(prefep_crash, transform.position, Quaternion.Euler(new Vector3(-90, 0, 0)));
            }
        }
        // ---바운스---
        else if (collidingObject is Alocasia)
        {
            m_Audio.PlayOneShot(bounce);

            if (prefep_crash != null)
            {
                Instantiate(prefep_crash, transform.position, Quaternion.Euler(new Vector3(-90, 0, 0)));
            }
        }

        //---착지 가능 충돌---
        else if (collidingObject is WaterLily)
        {
            character.animator.SetBool(s_JumpHash, false);
            WaterLily lily = collidingObject as WaterLily;
            transform.eulerAngles = Vector3.zero;
            moveDirection         = Vector3.zero;
            m_Audio.PlayOneShot(landing);

            if (prefep_dust != null)
            {
                Instantiate(prefep_dust, transform.position, Quaternion.Euler(new Vector3(-90, 0, 0)));
            }

            StartCoroutine(BindingPlayerPosition(lily.transform));
        }

        else if (collidingObject is SeaOtter)
        {
            character.animator.SetBool(s_JumpHash, false);
            jumpEnable    = true;
            moveDirection = Vector3.zero;

            transform.eulerAngles = Vector3.zero;
            m_Audio.PlayOneShot(landing);

            // 마지막 위치 저장
            lastPosition = transform.position;

            if (prefep_dust != null)
            {
                Instantiate(prefep_dust, transform.position, Quaternion.Euler(new Vector3(-90, 0, 0)));
            }
        }

        else if (collidingObject is Rocks)
        {
            character.animator.SetBool(s_JumpHash, false);
            jumpEnable    = true;
            moveDirection = Vector3.zero;

            transform.eulerAngles = Vector3.zero;
            m_Audio.PlayOneShot(landing);

            // 마지막 위치 저장
            lastPosition = transform.position;

            if (prefep_dust != null)
            {
                Instantiate(prefep_dust, transform.position, Quaternion.Euler(new Vector3(-90, 0, 0)));
            }
        }
        //---Item 충돌---
        else if (collidingObject is Star)
        {
            Star++;
            Star objStar = collidingObject as Star;
            Destroy(objStar.gameObject);
            m_Audio.PlayOneShot(getStar);

            if (prefep_stars != null)
            {
                Instantiate(prefep_stars, transform.position, Quaternion.Euler(new Vector3(-90, 0, 0)));
            }
        }

        else if (collidingObject is Coin)
        {
            Coin++;

            Coin objCoin = collidingObject as Coin;
            Destroy(objCoin.gameObject);
            m_Audio.PlayOneShot(getCoin);

            if (prefep_dollar != null)
            {
                Instantiate(prefep_dollar, transform.position, Quaternion.Euler(new Vector3(-90, 0, 0)));
            }
        }

        else if (collidingObject is Apple)
        {
            Life += 10f;
            Apple objApple = collidingObject as Apple;
            Destroy(objApple.gameObject);
            m_Audio.PlayOneShot(getStar);

            if (prefep_spray != null)
            {
                Instantiate(prefep_spray, transform.position, Quaternion.Euler(new Vector3(-90, 0, 0)));
            }
        }

        else if (collidingObject is Snake_head)
        {
            Coin++;

            m_Audio.PlayOneShot(getCoin);

            if (prefep_dollar != null)
            {
                Instantiate(prefep_dollar, transform.position, Quaternion.Euler(new Vector3(-90, 0, 0)));
            }
        }
    }