Esempio n. 1
0
    /// <summary>
    /// Checks for the trigger to being fired and fires the spell
    /// otherwise we show the aim
    /// </summary>
    /// <param name="deltaTime"></param>
    internal void Update(float deltaTime)
    {
        if (currentSpellDefinition == null)
        {
            return;
        }

        if (deviceInput.MouseButtonHeldDown())
        {
            currentSpellDefinition.SetOnCooldown();
            UISpellButtonWrapper.instance.SendMessage(currentSpellDefinition, InGameWrapper.instance.playersWrapper.GetOnlyLocalPlayer().GetGmj().transform.position);
            currentSpellDefinition = null;
            aimGmj.SetActive(false);
        }
        else
        {
            if (EventSystemReference.instance.EventSystem.IsPointerOverGameObject())
            {
                return;
            }
            if (deviceInput.PositionUpdated())
            {
                RaycastHit hit      = new RaycastHit();
                Ray        mouseRay = InGameWrapper.instance.camera.ScreenPointToRay(deviceInput.GetMousePosition());
                if (Physics.Raycast(mouseRay, out hit, 100f, aimData.groundMask))
                {
                    aimGmj.transform.position = hit.point;
                    var player = InGameWrapper.instance.playersWrapper.GetOnlyLocalPlayer().GetGmj().transform;
                    aimGmj.transform.LookAt(player.transform);
                    aimGmj.transform.rotation = Quaternion.Euler(0, aimGmj.transform.eulerAngles.y, 0);
                }
            }
        }
    }
Esempio n. 2
0
    /// <summary>
    /// Spell button pressed in UI
    /// Either cast the spell if no aim is requires
    /// Or show the aim for the player to press and fire spell
    /// </summary>
    /// <param name="spellDefinition"></param>
    public void UIMethod_CastSpell(UISpellButtonDefinition spellDefinition)
    {
        if (!CanCastSpell() || spellDefinition.IsOnCooldown())
        {
            return;
        }

        if (spellDefinition.spellDefinition.aimType != AimType.None)
        {
            InGameWrapper.instance.aimWrapper.StartAimSpell(spellDefinition);
        }
        else
        {
            spellDefinition.SetOnCooldown();
            SendMessage(spellDefinition, InGameWrapper.instance.playersWrapper.GetOnlyLocalPlayer().GetGmj().transform.position);
        }
    }
Esempio n. 3
0
    /// <summary>
    /// Shows the aim for the selected spell
    /// </summary>
    /// <param name="spellDefinition"></param>
    internal void StartAimSpell(UISpellButtonDefinition spellDefinition)
    {
        currentSpellDefinition = spellDefinition;
        if (spellDefinition.spellDefinition.aimType == AimType.Direction)
        {
            aimGmj = aimData.aimGmjDirection;
        }
        else if (spellDefinition.spellDefinition.aimType == AimType.Position)
        {
            aimGmj = aimData.aimGmjPosition;
        }
        else
        {
            throw new Exception("AimType not supported, value " + spellDefinition.spellDefinition.aimType);
        }

        aimGmj.SetActive(true);
    }
Esempio n. 4
0
    public void SendMessage(UISpellButtonDefinition item, Vector3 spawnPos)
    {
        var msg = spellMessageFactory.BuildMessage(item.spellDefinition, spawnPos);

        Match_DotNetAdapter.instance.Send(msg);
    }