protected override void LoadAndExecuteAllyTactics() { //base function loads tactics from stat and data handlers base.LoadAndExecuteAllyTactics(); if (AllyTacticsList.Count > 0) { if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { AllyBehaviorTree.SetVariableValue(BBName_bEnableTactics, true); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { uNodeAllyTreeSpawner.SetVariable(BBName_bEnableTactics, true); } } else { if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { AllyBehaviorTree.SetVariableValue(BBName_bEnableTactics, false); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { uNodeAllyTreeSpawner.SetVariable(BBName_bEnableTactics, false); } } }
public override bool IsTargettingEnemy(out Transform _currentTarget) { _currentTarget = null; bool _isTargetting = false; if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { _isTargetting = (bool)AllyBehaviorTree.GetVariable(BBName_bTargetEnemy).GetValue(); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { _isTargetting = uNodeAllyTreeSpawner.GetVariable <bool>(BBName_bTargetEnemy); } if (_isTargetting) { if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { _currentTarget = (Transform)AllyBehaviorTree.GetVariable(BBName_CurrentTargettedEnemy).GetValue(); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { _currentTarget = uNodeAllyTreeSpawner.GetVariable <Transform>(BBName_CurrentTargettedEnemy); } } return(_isTargetting); }
protected override void HandleCommandAttackEnemy(AllyMember enemy) { base.HandleCommandAttackEnemy(enemy); if (bUsingBehaviorTrees) { bool _isFreeMoving = false; if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { _isFreeMoving = (bool)AllyBehaviorTree.GetVariable(BBName_bIsFreeMoving).GetValue(); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { //uNodeAllyTreeSpawner.SetVariable _isFreeMoving = uNodeAllyTreeSpawner.GetVariable <bool>(BBName_bIsFreeMoving); } bool _isPerformingAbility = IsPerformingSpecialAbility(); //Shouldn't Be FreeMoving or Performing Special Ability if (_isFreeMoving == false && _isPerformingAbility == false) { SetEnemyTarget(enemy); if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { AllyBehaviorTree.SetVariableValue(BBName_bHasSetCommandMove, false); AllyBehaviorTree.SetVariableValue(BBName_bTryUseAbility, false); AllyBehaviorTree.SetVariableValue(BBName_AbilityToUse, null); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { uNodeAllyTreeSpawner.SetVariable(BBName_bHasSetCommandMove, false); uNodeAllyTreeSpawner.SetVariable(BBName_bTryUseAbility, false); uNodeAllyTreeSpawner.SetVariable(BBName_AbilityToUse, null); } } } }
protected override void HandleAllySwitch(PartyManager _party, AllyMember _toSet, AllyMember _current) { base.HandleAllySwitch(_party, _toSet, _current); if (bUsingBehaviorTrees && _party == allyMember.partyManager) { bool _isCurrentPlayer = _toSet == allyMember && _toSet.bIsInGeneralCommanderParty; if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { AllyBehaviorTree.SetVariableValue(BBName_bIsAllyInCommand, _toSet == allyMember); AllyBehaviorTree.SetVariableValue(BBName_bIsCurrentPlayer, _isCurrentPlayer); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { uNodeAllyTreeSpawner.SetVariable(BBName_bIsAllyInCommand, _toSet == allyMember); uNodeAllyTreeSpawner.SetVariable(BBName_bIsCurrentPlayer, _isCurrentPlayer); } //Don't Enable Tactics If Current Player //Otherwise, Load and Execute Tactics ToggleTactics(_isCurrentPlayer == false); if (_toSet.bIsInGeneralCommanderParty) { //NOT Command Moving If AllySwitch For All Members of Current Player's Party if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { AllyBehaviorTree.SetVariableValue(BBName_bHasSetCommandMove, false); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { uNodeAllyTreeSpawner.SetVariable(BBName_bHasSetCommandMove, false); } } } }
IEnumerator StartDefaultBehaviourTreeAfterDelay() { yield return(new WaitForSeconds(0.2f)); if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { AllyBehaviorTree.EnableBehavior(); } }
public override bool IsPerformingSpecialAbility() { if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { return((bool)AllyBehaviorTree.GetVariable(BBName_bIsPerformingAbility).GetValue()); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { return(uNodeAllyTreeSpawner.GetVariable <bool>(BBName_bIsPerformingAbility)); } return(false); }
public override void ResetTargetting() { if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { AllyBehaviorTree.SetVariableValue(BBName_bTargetEnemy, false); AllyBehaviorTree.SetVariableValue(BBName_CurrentTargettedEnemy, null); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { uNodeAllyTreeSpawner.SetVariable(BBName_bTargetEnemy, false); uNodeAllyTreeSpawner.SetVariable(BBName_CurrentTargettedEnemy, null); } }
public override void SetEnemyTarget(AllyMember _target) { if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { AllyBehaviorTree.SetVariableValue(BBName_CurrentTargettedEnemy, _target.transform); AllyBehaviorTree.SetVariableValue(BBName_bTargetEnemy, true); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { uNodeAllyTreeSpawner.SetVariable(BBName_CurrentTargettedEnemy, _target.transform); uNodeAllyTreeSpawner.SetVariable(BBName_bTargetEnemy, true); } }
protected override void UnLoadAndCancelTactics() { //Cancel Tactics From Running if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { AllyBehaviorTree.SetVariableValue(BBName_bEnableTactics, false); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { uNodeAllyTreeSpawner.SetVariable(BBName_bEnableTactics, false); } //Important For Clearing TacticsList base.UnLoadAndCancelTactics(); }
//protected override void HandleStopTargetting() //{ // base.HandleStopTargetting(); // if (bUsingBehaviorTrees) // { // AllyBehaviorTree.SetVariableValue(BBName_bTargetEnemy, false); // AllyBehaviorTree.SetVariableValue(BBName_CurrentTargettedEnemy, null); // } //} protected override void OnAllyDeath(Vector3 position, Vector3 force, GameObject attacker) { if (bUsingBehaviorTrees) { if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { AllyBehaviorTree.DisableBehavior(); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { uNodeAllyTreeSpawner.enabled = false; } } StopAllCoroutines(); CancelInvoke(); this.enabled = false; }
public override void ResetSpecialAbilities() { if (IsPerformingSpecialAbility() == false) { if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { AllyBehaviorTree.SetVariableValue(BBName_bTryUseAbility, false); AllyBehaviorTree.SetVariableValue(BBName_bIsPerformingAbility, false); AllyBehaviorTree.SetVariableValue(BBName_AbilityToUse, null); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { uNodeAllyTreeSpawner.SetVariable(BBName_bTryUseAbility, false); uNodeAllyTreeSpawner.SetVariable(BBName_bIsPerformingAbility, false); uNodeAllyTreeSpawner.SetVariable(BBName_AbilityToUse, null); } } }
public override void TryStartSpecialAbility(System.Type _abilityType) { AbilityConfig _config; if (IsPerformingSpecialAbility() == false && allyMember.CanUseAbility(_abilityType, out _config)) { if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { AllyBehaviorTree.SetVariableValue(BBName_bTryUseAbility, true); AllyBehaviorTree.SetVariableValue(BBName_AbilityToUse, _config); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { uNodeAllyTreeSpawner.SetVariable(BBName_bTryUseAbility, true); uNodeAllyTreeSpawner.SetVariable(BBName_AbilityToUse, _config); } } }
/// <summary> /// Finish Moving Helper For Tactics /// </summary> public override void FinishMoving() { //Override To Update BT if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { AllyBehaviorTree.SetVariableValue(BBName_bHasSetDestination, false); AllyBehaviorTree.SetVariableValue(BBName_bHasSetCommandMove, false); AllyBehaviorTree.SetVariableValue(BBName_MyNavDestination, Vector3.zero); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { uNodeAllyTreeSpawner.SetVariable(BBName_bHasSetDestination, false); uNodeAllyTreeSpawner.SetVariable(BBName_bHasSetCommandMove, false); uNodeAllyTreeSpawner.SetVariable(BBName_MyNavDestination, Vector3.zero); } if (IsNavMeshAgentEnabled()) { myNavAgent.SetDestination(transform.position); myNavAgent.velocity = Vector3.zero; } }
protected void OnKeyPress(int _key) { int _index = _key - 1; if (allyMember == null || allyMember.IsAlive == false || allyMember.bIsCurrentPlayer == false || _index < 0 || _index > allyMember.GetNumberOfAbilities() - 1) { return; } var _config = allyMember.GetAbilityConfig(_index); if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { AllyBehaviorTree.SetVariableValue(BBName_bTryUseAbility, true); AllyBehaviorTree.SetVariableValue(BBName_AbilityToUse, _config); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { uNodeAllyTreeSpawner.SetVariable(BBName_bTryUseAbility, true); uNodeAllyTreeSpawner.SetVariable(BBName_AbilityToUse, _config); } }
protected override void HandleOnMoveAlly(Vector3 _point, bool _isCommandMove) { //base.HandleOnMoveAlly(_point); if (bUsingBehaviorTrees) { if (MyBehaviourChoice == BehaviourFrameworkChoice.BehaviorDesigner) { AllyBehaviorTree.SetVariableValue(BBName_MyNavDestination, _point); AllyBehaviorTree.SetVariableValue(BBName_bHasSetDestination, true); AllyBehaviorTree.SetVariableValue(BBName_bHasSetCommandMove, _isCommandMove); } else if (MyBehaviourChoice == BehaviourFrameworkChoice.UNode) { uNodeAllyTreeSpawner.SetVariable(BBName_MyNavDestination, _point); uNodeAllyTreeSpawner.SetVariable(BBName_bHasSetDestination, true); uNodeAllyTreeSpawner.SetVariable(BBName_bHasSetCommandMove, _isCommandMove); } if (_isCommandMove) { ResetTargetting(); } } }