Example #1
0
    void OnCollisionStay2D(Collision2D coll)
    {
        if (coll.gameObject.tag == "Boss")
        {
            P = (EntityData)entityData;
            if (P.GetNumDragons() > 0)
            {
                D = ((EntityData)entityData).GetActiveDragon();
            }
            else
            {
                D = null;
            }
            EntityData E = (EntityData)Resources.Load("ScriptableObjects/Dragons/Boss");

            GlobalFlags.SetPlayerPosition(new Vector2(transform.position.x, transform.position.y));
            GlobalFlags.SetCombatManagerFlags(P, D, E);

            GlobalFlags.SetBossFlag(true);
        }


        if ((coll.gameObject.tag == "Enemy" && enterBattleDelay <= 0f))
        {
            P = (EntityData)entityData;
            if (P.GetNumDragons() > 0)
            {
                D = ((EntityData)entityData).GetActiveDragon();
            }
            else
            {
                D = null;
            }
            EntityData E = (EntityData)coll.gameObject.GetComponent <Entity>().entityData;

            GlobalFlags.SetPlayerPosition(new Vector2(transform.position.x, transform.position.y));
            GlobalFlags.SetCombatManagerFlags(P, D, E);

            GlobalFlags.SetBossFlag(false);

            state = PlayerState.Battling;

            SoundManager.Instance.StopMusic();

            GameManager.instance.PushState(StateManagement.GameStateType.Battle);
        }



        //if (coll.gameObject.tag == "Enemy" && enterBattleDelay <= 0f) {

        //    P = (EntityData)entityData;
        //    if (P.GetNumDragons() > 0)
        //        D = ((EntityData)entityData).GetActiveDragon();
        //    else
        //        D = null;

        //    EntityData E = (EntityData)coll.gameObject.GetComponent<Entity>().entityData;

        //    GlobalFlags.SetPlayerPosition(new Vector2(transform.position.x, transform.position.y));
        //    GlobalFlags.SetCombatManagerFlags(P, D, E);
        //    GlobalFlags.SetBossFlag(false);

        //    state = PlayerState.Battling;

        //    SoundManager.Instance.StopMusic();

        //    GameManager.instance.PushState(StateManagement.GameStateType.Battle);
        //}
    }