private void OnTriggerStay2D(Collider2D collision)
    {
        Astronaut a = collision.gameObject.GetComponent <Astronaut>();

        if ((a != null) && (a.Alive))
        {
            if (EtherealBehavior)
            {
                if (EtherealWillingToTeach)
                {
                    if (!isStunned())
                    {
                        a.SendBackToEtherealCheckpoint();
                    }
                }
            }
            else
            {
                if (!isStunned())
                {
                    if ((Time.time - a.lastDamageTakenTime) >= 2f)
                    {
                        Vector3 dif = (a.transform.position - this.transform.position);
                        HitsDone += 1f;
                        if (a.TakeDamage(20f, dif.normalized * 4f + new Vector3(0f, 0f, 0f)))
                        {
                            HitsDone += 4f;
                        }
                    }
                }
            }
        }
    }
Esempio n. 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Astronaut plr = collision.GetComponent <Astronaut>();

        if ((plr != null) && (plr.Alive) && (!plr.Invulnerable) && (Live))
        {
            if (!EtherealBehavior)
            {
                Vector3 dif = (plr.transform.position - this.transform.position);
                plr.TakeDamage(30f * DamageMultiplier, dif.normalized * 10f + new Vector3(0f, plr.JumpSpeed / 4f, 0f));
                if (plr.Alive)
                {
                    if ((!plr.Frozen) && ((Time.time - plr.UnfreezeTime) >= 1.5f))
                    {
                        plr.freeze(1.1f * FreezeTimeMultiplier);
                    }
                }
            }
            else
            {
                plr.SendBackToEtherealCheckpoint();
            }

            explode();
        }
        else if ((collision.gameObject.CompareTag("Geometry")) || (collision.gameObject.GetComponent <IceBlock>() != null) || (collision.gameObject.GetComponent <IcePillar>() != null))
        {
            explode();
        }
    }
    private void OnCollision(Collider2D col)
    {
        Astronaut a = col.gameObject.GetComponent <Astronaut>();

        if ((a != null) && (a.Alive))
        {
            if (!Permafrozen)
            {
                a.SendBackToEtherealCheckpoint();
            }
        }
    }
    private void OnCollisionEnter2D(Collision2D collision)
    {
        Astronaut a = collision.gameObject.GetComponent <Astronaut>();

        if ((a != null) && (a.Alive))
        {
            if (EtherealBehavior)
            {
                //teleport the player backward
                if (EtherealWillingToTeach)
                {
                    a.SendBackToEtherealCheckpoint();
                }
            }
            else
            {
                if (!isStunned())
                {
                    if ((Time.time - a.lastDamageTakenTime) >= 2f)
                    {
                        Vector3 dif = (a.transform.position - this.transform.position);
                        HitsDone += 1f;
                        if (Astronaut.AggressionLevel > 0)
                        {
                            if ((!a.Frozen) && ((Time.time - a.UnfreezeTime) >= 1.5f))
                            {
                                a.freeze(.5f * Astronaut.AggressionLevel);
                            }
                        }
                        if (a.TakeDamage(20f, dif.normalized * 10f + new Vector3(0f, a.JumpSpeed, 0f)))
                        {
                            HitsDone += 4f;
                        }
                    }
                }
            }
        }
    }