Ejemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (dead)
        {
            return;
        }
        var fat = collision.GetComponent <FatScript>();

        if (fat.Fat == 4)
        {
            Kill();
            return;
        }
        var  deltay = collision.transform.position.y - transform.position.y;
        var  player = collision.GetComponent <PlatformingCharacter>();
        bool onTop  = deltay > .1f && player.VMomentum < 0f;

        if (onTop)
        {
            ScreenFreeze.Freeze(6);
            if (fat.Fat < 3)
            {
                player.VMomentum = player.jumpForce;
            }
            if (fat.Fat == 3)
            {
                player.VMomentum = player.jumpForce * .5f;
            }
            if (fat.Fat > 1)
            {
                Kill();
            }
            else
            {
                Flinch();
            }
        }
        else
        {
            MySceneManager.Kill();
            // Debug.Log("Kill!");
        }
    }
Ejemplo n.º 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        // FindObjectOfType<Win>().NeedCoin--;
        AudioPool.PlaySound(transform.position, GetSound);
        var fatty = collision.transform.GetComponent <FatScript>();

        if (dietFood)
        {
            fatty.DecreaseFat();
        }
        else
        {
            fatty.IncreaseFat();
        }
        var platty = collision.transform.GetComponent <Mobile>();

        platty.HMomentum *= .75f;
        if (platty.VMomentum > 0f)
        {
            platty.VMomentum *= .5f;
        }
        ScreenFreeze.Freeze(5);
        Destroy(gameObject);
    }