コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        bool BlueActive = Input.GetMouseButton(0);
        bool RedActive  = Input.GetMouseButton(1);


        if (BlueActive)
        {
            BlueForceField.SetActive(true);
            RedForceField.SetActive(false);
            OnCast?.Invoke();
            return;
        }


        if (RedActive)
        {
            BlueForceField.SetActive(false);
            RedForceField.SetActive(true);
            OnCast?.Invoke();
            return;
        }


        OnStopCast?.Invoke();
        BlueForceField.SetActive(false);
        RedForceField.SetActive(false);
    }
コード例 #2
0
    void ActivateAbility(int index)
    {
        if (available[index] && !gcd && player.GetCurrentMana() > abilities[index].GetCost())
        {
            lastIndex = index;
            StartCoroutine(GlobalCooldown());

            if (abilities[index].CastTime > 0f) // do not begin cast bar for instant cast abilities
            {
                casting = true;
                onCast?.Invoke(abilities[index].abilityName, abilities[index].CastTime, castingComplete);
                player.GetComponent <PlayerController>().MovementPaused(true);
            }
            else
            {
                CastingFinished();
            }
        }
    }