Esempio n. 1
0
    public void OnGridClicked(Vector2 XY)
    {
        if (m_action == Action.Movement)
        {
            int dist = (int)MathsUtils.CircleDistance(XY, m_playerManager.m_positionArrayFight);
            if (!m_playerManager.GetPlayerFight().CanMove(dist))
            {
                return;
            }
            //PlayerManagerFight.GoNear(m_map[(int)XY.x, (int)XY.y].transform.position);
            m_playerManager.GetPlayerFight().SendMovementInFightMessage(XY);

            OnStopGridHover(XY);

            //PlayerManagerFight.m_positionArrayFight = XY;
        }
        else if (m_action == Action.Spell)
        {
            m_playerManager.GetPlayerFight().TryToActivateSpell(XY);
        }
    }
Esempio n. 2
0
    public void TryToActivateSpell(Vector2 XY)
    {
        if (m_spellUsedID == "" || !m_playerManager.IsItsTurn())
        {
            return;
        }

        int dist = (int)MathsUtils.CircleDistance(XY, m_playerManager.m_positionArrayFight);

        if (dist <= (int)m_getSpellTree().GetSpell(m_spellUsedID).range)
        {
            //Use spell
            Debug.Log("Can use spell");
            m_playerManager.m_networkBattle.SendSpellHitMessage(XY, m_getSpellTree().GetSpell(m_spellUsedID)._id);
        }
        else
        {
            //Don't use spell
            Debug.Log("Can't use spell");
        }
        m_getGridFight().DeactivateTileInRange((int)m_getSpellTree().GetSpell(m_spellUsedID).range);
        m_getGridFight().SetCurrentAction(GridFight.Action.Movement);
        m_spellUsedID = "";
    }