public override bool AimModeTick(ref Vector2 aimPosition, string axis, GameObject target = null)
    {
        // Turn mouse cursor to desired sprite
        // True when we decide on a location
        if (InputUtility.GetAxisDown(axis, true))
        {
            aimPosition = Input.mousePosition;
            return(true);
        }

        // false if we haven't decided on a location yet
        return(false);
    }
Exemplo n.º 2
0
    private void CheckUseAbility()
    {
        // Toggle aiming mode if we press button and if we are current active hero
        if ((AutomaticUsage || (BasicStats.isHero && InputUtility.GetAxisDown(InputAxis, true) && BasicStats.HeroControl.currentHero == BasicStats)) && CanUseAbility())
        {
            _aiming = !_aiming;
        }

        if (_aiming)
        {
            if (AimMode != null && AimMode.AimModeTick(ref _aimPosition, InputAxis, target))
            {
                _aiming = false; // Turn off aiming mode
                UseActiveAbility(_aimPosition);
            }
        }
    }
    void SwapHero()
    {
        if (InputUtility.GetAxisDown("HeroSwitch", true))
        {
            // Pop off front hero and insert them at back
            BasicStatManager front = Heroes[0];
            front.isResting = true;
            Heroes.RemoveAt(0);
            Heroes.Add(front);

            Heroes[0].isResting = false;

            EventManager.TriggerEvent("OnHeroSwitch", Heroes[0].gameObject);
        }
        if (InputUtility.GetAxisDown("HeroSwitch", false))
        {
            Heroes[0].isResting = true;
            BasicStatManager back = Heroes[Heroes.Count - 1];
            Heroes.RemoveAt(Heroes.Count - 1);
            Heroes.Insert(0, back);

            back.isResting = false;

            EventManager.TriggerEvent("OnHeroSwitch", Heroes[0].gameObject);
        }

        currentHero = Heroes[0];

        // Lerp all heroes to destination position (hero slot positions)
        for (int i = 0; i < Heroes.Count; ++i)
        {
            BasicStatManager hero = Heroes[i];
            //Debug.Log(hero.name + "SWITCHING HERO POSITION ");
            hero.gameObject.transform.position = Vector3.Lerp(hero.gameObject.transform.position, _heroPositionSlots[i].position, Time.deltaTime * SwapTime);
        }
    }