Beispiel #1
0
        // ———————————————— Swapping targeting Controller Block ———————————————— //

        public override void SwapTargeting(int index)
        {
            if (index >= characterDataComponent.targetControllerTypes.Count)
            {
                Debug.Log("Index is out of targeting controllers array");
                return;
            }

            if (characterDataComponent.ap - AbilityUtils.GetAbilityCost(characterDataComponent.abilities[index])[0] >= 0 &&
                characterDataComponent.ep - AbilityUtils.GetAbilityCost(characterDataComponent.abilities[index])[1] >= 0)
            {
                currentTargetingController.EndTargeting();
                Destroy(currentTargetingController);

                currentTargetingController =
                    (TargetingController)gameObject.AddComponent(characterDataComponent.targetControllerTypes[index]);
                currentTargetingController.Construct(battleManager, map, this);
            }
            else
            {
                Debug.Log("No enough resources!");
            }
        }