Beispiel #1
0
        public string _SelectAbility(int ID, int pointerID = -1)
        {
            Ability ability = abilityList[ID];

            Debug.Log(ability.name + "   " + ability.requireTargetSelection);

            string exception = ability.IsAvailable();

            if (exception != "")
            {
                return(exception);
            }

            if (!ability.requireTargetSelection)
            {
                ActivateAbility(ability);                                                       //no target selection required, fire it away
            }
            else
            {
                if (Input.touchCount == 0)
                {
                    StartCoroutine(SelectAbilityTargetRoutine(ability, -1));
                }
                else
                {
                    StartCoroutine(SelectAbilityTargetRoutine(ability, 0));
                }
            }

            return("");
        }
        public string _SelectAbility(int ID)
        {
            Ability ab = abilityList[ID];

            Debug.Log(ab.name);

            string exception = ab.IsAvailable();

            if (exception != "")
            {
                return(exception);
            }

            if (!ab.requireTargetSelection)
            {
                ActivateAbility(ab);                                                    //no target selection required, fire it away
            }
            else
            {
                if (onTargetSelectModeE != null)
                {
                    onTargetSelectModeE(true);                                                  //enter target selection phase
                }
                inTargetSelectMode = true;
                validTarget        = false;

                selectedAbilityID = ID;

                if (ab.indicator != null)
                {
                    currentIndicator = ab.indicator;
                }
                else
                {
                    currentIndicator = defaultIndicator;
                    if (ab.autoScaleIndicator)
                    {
                        if (ab.singleUnitTargeting)
                        {
                            float gridSize = BuildManager.GetGridSize();
                            currentIndicator.localScale = new Vector3(gridSize, 1, gridSize);
                        }
                        else
                        {
                            currentIndicator.localScale = new Vector3(ab.GetAOERadius() * 2, 1, ab.GetAOERadius() * 2);
                        }
                    }
                }

                currentIndicator.gameObject.SetActive(true);
            }

            return("");
        }