Ejemplo n.º 1
0
    public BattleTable DetectBattleTable(Player player)
    {
        player.transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition + Vector3.forward * 70);

        RaycastHit hit;

        if (Physics.Raycast(player.transform.position, player.transform.position - Camera.main.ScreenToWorldPoint(Input.mousePosition), out hit, Mathf.Infinity))
        {
            if (hit.collider.gameObject.CompareTag("BattleTable"))
            {
                mBattleTable = hit.collider.gameObject.GetComponent <BattleTable>();
                if (mBattleTable.PlayerIsHere() && player.PlayerState == ePlayerState.Battle)
                {
                    mBattleTable.StateChange();
                }
            }
            else
            {
                mBattleTable = null;
            }
        }

        return(mBattleTable);
    }
Ejemplo n.º 2
0
    private void OnMouseUp()
    {
        if (!bIsMove)
        {
            return;
        }

        if (mBattleTable != null)
        {
            if (!mBattleTable.PlayerIsHere())
            {
                switch (mPlayerState)
                {
                case ePlayerState.Waiting:

                    transform.position = mBattleTable.transform.position + Vector3.up * 0.5f;
                    mPlayerState       = ePlayerState.Battle;

                    CurrentBattleState(mBattleType);
                    mBattleTable.StateChange();

                    break;

                case ePlayerState.Battle:

                    transform.position = mStartPos;
                    SubtractPlayerState();
                    mPlayerState = ePlayerState.Waiting;

                    break;

                default:
                    break;
                }
            }
            else
            {
                switch (mPlayerState)
                {
                case ePlayerState.Waiting:

                    transform.position = mStartPos;
                    mPlayerState       = ePlayerState.Waiting;

                    break;

                case ePlayerState.Battle:

                    transform.position = mStartPos;
                    SubtractPlayerState();
                    mPlayerState = ePlayerState.Waiting;

                    break;

                default:
                    break;
                }
            }
        }
        else
        {
            if (mPlayerState == ePlayerState.Battle)
            {
                SubtractPlayerState();
            }

            mPlayerState       = ePlayerState.Waiting;
            transform.position = mStartPos;
        }
    }