示例#1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        ICrushObject objecCrus = other.GetComponent <ICrushObject>();

        if (objecCrus != null)
        {
            if (particlePunch != null)
            {
                particlePunch.transform.position = other.transform.position;
                particlePunch.gameObject.SetActive(true);
            }
            objecCrus.Crush(state != null ? state.typeC : TypeCrush.Middle);
        }
        else
        {
            if (other.CompareTag("Resorte"))
            {
                state.FinishDownCrush();
            }
        }
    }
示例#2
0
    void KillAll()
    {
        for (int i = 0; i < especialRequest.Count; i++)
        {
            if (especialRequest[i] != null)
            {
                especialRequest[i].Kill();
            }
        }
        //Aqui cheque lso objetos Icrush que esten alrededor
        Collider2D[] result = new Collider2D[10];
        bool         killer = Physics2D.OverlapCircleNonAlloc(transform.position, DistanceExplode, result, whatsKill) > 0;

        if (killer)
        {
            for (int i = 0; i < result.Length; ++i)
            {
                if (result[i] != null)
                {
                    if (result[i].CompareTag("Player"))
                    {
                        result[i].GetComponent <MoveState>().Kill();
                    }
                    else
                    {
                        ICrushObject objectCr = result[i].GetComponent <ICrushObject>();
                        if (objectCr != null)
                        {
                            if (objectCr != kill)
                            {
                                objectCr.Crush(TypeCrush.NONE);
                            }
                        }
                    }
                }
            }
        }
        especialRequest.Clear();
    }