private void TryAbility(GroupAbilityFactory groupAbilityFactory) { if (!_abilitiesLock.CanDoAction()) { return; } if (GroupsInRangeDetector.MostRepresentedGroupInRange == GroupManager.Group.None || GroupsInRangeDetector.MostRepresentedGroupInRange == GroupManager.Group.All) { return; } GroupAbility ability = groupAbilityFactory.GetAbility(); if (!_impMana.CheckSegments(ability.GetData().ManaSegmentsCost)) { return; } //Debug.Log("Segments OK"); if (!GroupsManager.Instance.Groups[GroupsInRangeDetector.MostRepresentedGroupInRange] .GetComponent <ImpGroupAi>().TryAbility(ability)) { return; } //Debug.Log("Ability OK"); _impMana.SpendSegments(ability.GetData().ManaSegmentsCost); OnAggroActionDone?.Invoke(useAbilityAggro); }
private void TryCallToArms() { if (!_impMana.CheckSegments(manaSegmentsCost)) { return; } if (_callToArmsCr != null) { return; } if (_currentArena == null) { return; } _callToArmsCr = StartCoroutine(CallToArms()); OnCallToArmsStart?.Invoke(); OnBlockEvent?.Invoke(actionBlocks); OnAggroActionDone?.Invoke(onActionAggro); }