示例#1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            CharacterBehavior cb;
            if (other.transform.GetComponent <CharacterBehavior>())
            {
                cb = other.transform.GetComponent <CharacterBehavior>();
            }
            else
            {
                cb = other.transform.parent.GetComponent <CharacterBehavior>();
            }

            //cb.Hit();
            Debug.Log("Mortal HIT PLAYER ____________ ARREGLAR!!!!!!!");
        }
        else if (other.gameObject.CompareTag("enemy"))
        {
            MmoCharacter enemy = other.gameObject.GetComponent <MmoCharacter>();
            if (enemy.state == MmoCharacter.states.DEAD)
            {
                return;
            }

            enemy.Die();
        }
    }
示例#2
0
    void OnTriggerEnter(Collider other)
    {
        switch (other.tag)
        {
        case "wall":
            addExplotionWall();
            Destroy();
            break;

        case "floor":
            addExplotion(0.2f);
            Destroy();
            break;

        case "enemy":
            MmoCharacter enemy = other.gameObject.GetComponent <MmoCharacter>();
            if (enemy.state == MmoCharacter.states.DEAD)
            {
                return;
            }

            enemy.Die();
            Destroy();
            break;

        case "destroyable":
            other.gameObject.SendMessage("breakOut", other.gameObject.transform.position, SendMessageOptions.DontRequireReceiver);
            Destroy();
            break;
        }
    }
    void OnTriggerEnter(Collider other)
    {
        if (!isActive)
        {
            return;
        }
        if (exploted)
        {
            return;
        }

        switch (other.tag)
        {
        case "wall":
            addExplotionWall();
            SetScore(180);
            Destroy();
            break;

        case "floor":
            addExplotion(0.2f);
            SetScore(100);
            Destroy();
            break;

        case "enemy":
            MmoCharacter enemy = other.gameObject.GetComponent <MmoCharacter> ();

            //esto funca para los bosses:-----------------------
            if (enemy)
            {
                if (enemy.state == MmoCharacter.states.DEAD)
                {
                    return;
                }
                SetScore(enemy.score);
                enemy.Die();
            }
            else
            {
                other.gameObject.SendMessage("breakOut", other.gameObject.transform.position, SendMessageOptions.DontRequireReceiver);
            }
            //---------------------------------------------------

            Destroy();
            break;

        case "destroyable":
            SetScore(70);
            other.gameObject.SendMessage("breakOut", other.gameObject.transform.position, SendMessageOptions.DontRequireReceiver);
            Destroy();
            break;

        case "boss":
            SetScore(120);
            other.gameObject.SendMessage("breakOut", other.gameObject.transform.position, SendMessageOptions.DontRequireReceiver);
            Destroy();
            break;

        case "firewall":
            //SetScore(70);
            //	other.gameObject.SendMessage("breakOut",other.gameObject.transform.position, SendMessageOptions.DontRequireReceiver);
            Vector3 rot = transform.localEulerAngles;
            rot.y += 180 + other.gameObject.GetComponentInParent <SceneObject>().transform.localEulerAngles.y;
            transform.localEulerAngles = rot;
            break;

        case "Player":
            if (Data.Instance.playMode != Data.PlayModes.VERSUS)
            {
                return;
            }
            CharacterBehavior cb = other.gameObject.GetComponentInParent <CharacterBehavior> ();
            if (cb == null ||
                cb.player.id == playerID ||
                cb.state == CharacterBehavior.states.CRASH ||
                cb.state == CharacterBehavior.states.FALL ||
                cb.state == CharacterBehavior.states.DEAD)
            {
                return;
            }

            //chequea si el projectil es del otro team
            if (team_for_versus == cb.team_for_versus)
            {
                return;
            }

            Data.Instance.GetComponent <FramesController> ().ForceFrameRate(0.05f);
            Data.Instance.events.RalentaTo(1, 0.05f);
            cb.Hit();
            Destroy();
            break;
        }
    }
示例#4
0
    void OnTriggerEnter(Collider other)
    {
        if (!isActive)
        {
            return;
        }
        if (exploted)
        {
            return;
        }
        Breakable breakable;

        switch (other.tag)
        {
        case "wall":
            addExplotionWall();
            SetScore(ScoresManager.score_for_destroying_wall, ScoresManager.types.DESTROY_WALL);
            ResetProjectil();
            break;

        case "floor":
            addExplotion(0.2f);
            SetScore(ScoresManager.score_for_destroying_floor, ScoresManager.types.DESTROY_FLOOR);
            ResetProjectil();
            break;

        case "enemy":
            MmoCharacter enemy = other.gameObject.GetComponent <MmoCharacter> ();
            //esto funca para los bosses:-----------------------
            if (enemy)
            {
                if (enemy.state == MmoCharacter.states.DEAD)
                {
                    return;
                }
                // Debug.Log(other.gameObject.name + " total:  score_for_breaking " + ScoresManager.score_for_breaking + "score: " + enemy.score);

                SetScore(ScoresManager.score_for_killing + enemy.score, ScoresManager.types.KILL);
                enemy.Die();
            }
            else
            {
                breakable = other.gameObject.GetComponent <Breakable>();
                breakable.breakOut(other.gameObject.transform.position, true);
                //  Debug.Log(other.gameObject.name + "   score_for_breaking " + ScoresManager.score_for_breaking + "score: " + breakable.GetSceneObject().score);

                SetScore(ScoresManager.score_for_killing + breakable.GetSceneObject().score, ScoresManager.types.KILL);
                //other.gameObject.SendMessage("breakOut",other.gameObject.transform.position, SendMessageOptions.DontRequireReceiver);
            }
            //---------------------------------------------------

            ResetProjectil();
            break;

        case "destroyable":
            breakable = other.gameObject.GetComponent <Breakable>();
            int total = ScoresManager.score_for_breaking + breakable.GetSceneObject().score;
            //Debug.Log(other.gameObject.name + " total: " + total + "   score_for_breaking " + ScoresManager.score_for_breaking + "score: " + breakable.GetSceneObject().score);
            SetScore(total, ScoresManager.types.BREAKING);
            breakable.breakOut(other.gameObject.transform.position, true);
            // other.gameObject.SendMessage("breakOut",other.gameObject.transform.position, SendMessageOptions.DontRequireReceiver);
            ResetProjectil();
            break;

        case "boss":
            SetScore(ScoresManager.score_for_boss, ScoresManager.types.BOSS);
            other.gameObject.GetComponent <Boss>().breakOut();

            // other.gameObject.SendMessage("breakOut",other.gameObject.transform.position, SendMessageOptions.DontRequireReceiver);
            ResetProjectil();
            break;

        case "firewall":
            //SetScore(70);
            //	other.gameObject.SendMessage("breakOut",other.gameObject.transform.position, SendMessageOptions.DontRequireReceiver);
            Vector3 rot = transform.localEulerAngles;
            rot.y += 180 + other.gameObject.GetComponentInParent <SceneObject>().transform.localEulerAngles.y;
            transform.localEulerAngles = rot;
            break;

        case "Player":
            if (Data.Instance.playMode != Data.PlayModes.VERSUS)
            {
                return;
            }
            CharacterBehavior cb = other.gameObject.GetComponentInParent <CharacterBehavior> ();
            if (cb == null ||
                cb.player.id == playerID ||
                cb.state == CharacterBehavior.states.CRASH ||
                cb.state == CharacterBehavior.states.FALL ||
                cb.state == CharacterBehavior.states.DEAD)
            {
                return;
            }

            //chequea si el projectil es del otro team
            //if (team_for_versus == cb.team_for_versus)
            //	return;

            Data.Instance.framesController.ForceFrameRate(0.05f);
            Data.Instance.events.RalentaTo(1, 0.05f);
            cb.Hit();
            ResetProjectil();
            break;
        }
    }
示例#5
0
    void OnTriggerEnter(Collider other)
    {
        if (!isActive)
        {
            return;
        }
        if (exploted)
        {
            return;
        }

        switch (other.tag)
        {
        case "wall":
            addExplotionWall();
            Reset();
            break;

        case "floor":
            addExplotion(0.2f);
            Reset();
            break;

        case "enemy":
            MmoCharacter enemy = other.gameObject.GetComponent <MmoCharacter> ();

            if (enemy)
            {
                if (enemy.state == MmoCharacter.states.DEAD)
                {
                    return;
                }
                enemy.Die();
            }
            else
            {
                other.gameObject.SendMessage("breakOut", other.gameObject.transform.position, SendMessageOptions.DontRequireReceiver);
            }
            Reset();
            break;

        case "destroyable":
            other.gameObject.SendMessage("breakOut", other.gameObject.transform.position, SendMessageOptions.DontRequireReceiver);
            Reset();
            break;

        case "boss":
            other.gameObject.SendMessage("breakOut", other.gameObject.transform.position, SendMessageOptions.DontRequireReceiver);
            Reset();
            break;

        case "firewall":
            Vector3 rot = transform.localEulerAngles;
            rot.y += 180 + other.gameObject.GetComponentInParent <SceneObject>().transform.localEulerAngles.y;
            transform.localEulerAngles = rot;
            break;

        case "Player":
            if (Data.Instance.playMode != Data.PlayModes.VERSUS)
            {
                return;
            }
            CharacterBehavior cb = other.gameObject.GetComponentInParent <CharacterBehavior> ();
            if (cb == null ||
                cb.state == CharacterBehavior.states.CRASH ||
                cb.state == CharacterBehavior.states.FALL ||
                cb.state == CharacterBehavior.states.DEAD)
            {
                return;
            }

            Data.Instance.GetComponent <FramesController> ().ForceFrameRate(0.05f);
            Data.Instance.events.RalentaTo(1, 0.05f);
            cb.Hit();
            Reset();
            break;
        }
    }