public virtual void CastAbilityE(RaycastHit targetinfo) { // Global cooldown check if (!_statsGeneral.CheckCooldown()) { // Target check if (targetinfo.collider.gameObject.tag == "Enemy") { // Set target targetObject = targetinfo.collider.gameObject; //targetPoint = targetpoint; // Range Check StatsGeneral tempstats = abilityEPrefab.GetComponent <StatsGeneral>(); // Ability Cooldown Check and start if (!tempstats.CheckCooldown()) { StopAllCoroutines(); StartCoroutine(CastAbilityECoroutine()); } } } }
public void InitializeCharacter() { // Cache components _attributes = GetComponent <Attributes>(); _statsOffense = GetComponent <StatsOffense>(); _statsDefense = GetComponent <StatsDefense>(); _statsGeneral = GetComponent <StatsGeneral>(); characterController = GetComponent <CharacterController>(); LoadCharacterData(); characterData.specialization.SetTotalSpecPoints(characterData.level); // Initialize Attributes _attributes.GenerateAugmentedCharacterAttributes(characterData.specialization, characterData.inventory); // Initialize statistics _statsOffense.GenerateAugmentedCharacterStatistics(); _statsDefense.GenerateAugmentedCharacterStatistics(); _statsGeneral.GenerateAugmentedCharacterStatistics(); // Initialize Abilities // Set Abilities characterController.SetAbilities(basicAbilityPrefab, abilityQPrefab, abilityWPrefab, abilityEPrefab, abilityRPrefab); }
/// <summary> /// Target Heal Ability /// /// This is just a sample method for casting an ability /// </summary> /// <param name="targetinfo"></param> public virtual void CastAbilityW(RaycastHit targetinfo) { // Global cooldown check if (!_statsGeneral.CheckCooldown()) { // Target check if (targetinfo.collider.gameObject.tag == "Friendly") { // Set target targetObject = targetinfo.collider.gameObject; // Range Check if (targetDistance <= abilityWController.GetRange()) { StatsGeneral tempstats = abilityWPrefab.GetComponent <StatsGeneral>(); // Ability Cooldown Check and start if (!tempstats.CheckCooldown()) { StopAllCoroutines(); StartCoroutine(CastAbilityWCoroutine()); } } } } }
public virtual IEnumerator CastAbilityBasicCoroutine() { while (targetObject != null) { if (!_statsGeneral.CheckCooldown()) { StatsGeneral tempstats = basicAbilityPrefab.GetComponent <StatsGeneral>(); //Rotate to target Quaternion targetRotation = Quaternion.LookRotation(targetObject.transform.position - transform.position); targetRotation.x = 0; targetRotation.z = 0; thisTransform.rotation = targetRotation; Debug.Log("PEW"); // Cast ability GameObject clone = (GameObject)Instantiate(basicAbilityPrefab, thisTransform.position, thisTransform.rotation); cachedAbilityBasicController = clone.GetComponent <AbilityController>(); // Set target and stats cachedAbilityBasicController.SetTargetObject(targetObject); cachedAbilityBasicController.GenerateCombatStatistics(_statsGeneral, _statsOffense, _statsDefense); // Start global cooldown _statsGeneral.StartGlobalCooldown(_statsOffense._combatAttackSpeed); } yield return(null); } }
void Awake() { thisTransform = transform; _statsOffense = GetComponent <StatsOffense>(); _statsDefense = GetComponent <StatsDefense>(); _statsGeneral = GetComponent <StatsGeneral>(); }
public virtual void SetTargetObject(GameObject targetobject) { targetObject = targetobject; _statsGeneralTarget = targetObject.GetComponent <StatsGeneral>(); _statsOffenseTarget = targetObject.GetComponent <StatsOffense>(); _statsDefenseTarget = targetObject.GetComponent <StatsDefense>(); }
public virtual void Awake() { Debug.Log("Ability Controller awake"); thisTransform = transform; _statsOffense = GetComponent <StatsOffense>(); _statsDefense = GetComponent <StatsDefense>(); _statsGeneral = GetComponent <StatsGeneral>(); }
public virtual void Awake() { thisTransform = transform; targetPoint = thisTransform.position; _attributes = GetComponent <Attributes>(); _statsOffense = GetComponent <StatsOffense>(); _statsDefense = GetComponent <StatsDefense>(); _statsGeneral = GetComponent <StatsGeneral>(); }
void Awake() { thisTransform = transform; _attributes = GetComponent <Attributes>(); _statsOffense = GetComponent <StatsOffense>(); _statsDefense = GetComponent <StatsDefense>(); _statsGeneral = GetComponent <StatsGeneral>(); _inCombat = false; }
/// <summary> /// Generates an Ability's temporary statistics /// </summary> /// <param name="statsGeneral"></param> public void GenerateCombatAbilityStatistics(StatsGeneral statsGeneral) { // Set the combat stats to the base combat stats of the ability _combatSpeed = _augmentedSpeed; _combatCoolDownReduction = _augmentedCoolDownReduction; _combatCooldownDuration = _augmentedCoolDownDuration; // Factor in the temporary statistics of the caster //_tempSpeed += statsGeneral._tempSpeed; _combatCoolDownReduction += statsGeneral._combatCoolDownReduction; //_combatCooldownDuration = _combatCooldownDuration * _combatCoolDownReduction; }
void Awake() { thisTransform = transform; level = 1; _attributes = GetComponent <Attributes>(); _statsOffense = GetComponent <StatsOffense>(); _statsDefense = GetComponent <StatsDefense>(); _statsGeneral = GetComponent <StatsGeneral>(); _attributes.InitializeEnemyAttributes(1); _statsOffense.GenerateAugmentedCharacterStatistics(); _statsDefense.GenerateAugmentedCharacterStatistics(); _statsGeneral.GenerateAugmentedCharacterStatistics(); }
//public override void CastBasicAbility(GameObject targetobject) //{ // // Global cooldown check // if (!_statsGeneral.CheckCooldown()) // { // // Target Check // if (targetobject.tag == "Enemy") // { // // Set target // targetObject = targetobject; // // Range Check // if (Vector3.Distance(thisTransform.position, targetObject.transform.position) <= _statsOffense._combatRange) // { // StopAllCoroutines(); // StartCoroutine(CastAbilityBasicCoroutine()); // } // } // } //} //public override IEnumerator CastAbilityBasicCoroutine() //{ // while (targetObject != null) // { // if (!_statsGeneral.CheckCooldown()) // { // StatsGeneral tempstats = basicAbilityPrefab.GetComponent<StatsGeneral>(); // //Rotate to target // Quaternion targetRotation = Quaternion.LookRotation(targetObject.transform.position - transform.position); // targetRotation.x = 0; // targetRotation.z = 0; // thisTransform.rotation = targetRotation; // Debug.Log("PEW"); // // Cast ability // GameObject clone = (GameObject)Instantiate(basicAbilityPrefab, thisTransform.position, thisTransform.rotation); // cachedAbilityBasicController = clone.GetComponent<AbilityController>(); // // Set target and stats // cachedAbilityBasicController.SetTargetObject(targetObject); // cachedAbilityBasicController.GenerateCombatStatistics(_statsGeneral, _statsOffense, _statsDefense); // // Start global cooldown // _statsGeneral.StartGlobalCooldown(_statsOffense._combatAttackSpeed); // } // yield return null; // } //} //public override void CastAbilityQ(RaycastHit targetinfo) //{ // // Global cooldown check // if (!_statsGeneral.CheckCooldown()) // { // // Set target // targetPoint = targetinfo.point; // StatsGeneral tempstats = abilityQPrefab.GetComponent<StatsGeneral>(); // // Ability Cooldown Check and start // if (!tempstats.CheckCooldown()) // { // StopAllCoroutines(); // StartCoroutine(CastAbilityQCoroutine(targetinfo)); // } // } //} //public override IEnumerator CastAbilityQCoroutine(RaycastHit targetinfo) //{ // // Rotate // Quaternion targetRotation = Quaternion.LookRotation(targetPoint - transform.position); // targetRotation.x = 0; // targetRotation.z = 0; // thisTransform.rotation = targetRotation; // // Cast ability // GameObject clone = (GameObject)Instantiate(abilityQPrefab, thisTransform.position, thisTransform.rotation); // cachedAbilityQController = clone.GetComponent<AbilityController>(); // // Set target and stats // cachedAbilityQController.GenerateCombatStatistics(_statsGeneral, _statsOffense, _statsDefense); // // Start global cooldown // _statsGeneral.StartCooldown(); // yield return null; //} /// <summary> /// Target Heal Ability /// /// This is just a sample method for casting an ability /// </summary> /// <param name="targetinfo"></param> public override void CastAbilityW(RaycastHit targetinfo) { // Global cooldown check if (!_statsGeneral.CheckCooldown()) { StatsGeneral tempstats = abilityWPrefab.GetComponent <StatsGeneral>(); // Ability Cooldown Check and start if (!tempstats.CheckCooldown()) { StopAllCoroutines(); StartCoroutine(CastAbilityWCoroutine()); } } }
public virtual void CastAbilityQ(RaycastHit targetinfo) { // Global cooldown check if (!_statsGeneral.CheckCooldown()) { // Set target targetPoint = targetinfo.point; StatsGeneral tempstats = abilityQPrefab.GetComponent <StatsGeneral>(); // Ability Cooldown Check and start if (!tempstats.CheckCooldown()) { StopAllCoroutines(); StartCoroutine(CastAbilityQCoroutine(targetinfo)); } } }
public virtual void CastAbilityR(RaycastHit targetinfo) { // Global cooldown check if (!_statsGeneral.CheckCooldown()) { // Range Check if (Vector3.Distance(thisTransform.position, targetinfo.point) <= abilityRController.GetRange()) { targetPoint = targetinfo.point; StatsGeneral tempstats = abilityRPrefab.GetComponent <StatsGeneral>(); // Ability Cooldown Check and start if (!tempstats.CheckCooldown()) { StopAllCoroutines(); StartCoroutine(CastAbilityRCoroutine()); } } } }
public override void CastAbilityE(RaycastHit targetinfo) { // Global cooldown check if (!_statsGeneral.CheckCooldown()) { // Set target targetPoint = targetinfo.point; targetPoint.y = 1; // Range Check if (targetDistance <= abilityEController.GetRange()) { StatsGeneral tempstats = abilityEPrefab.GetComponent <StatsGeneral>(); // Ability Cooldown Check and start if (!tempstats.CheckCooldown()) { StopAllCoroutines(); StartCoroutine(CastAbilityECoroutine()); } } } }
/// <summary> /// Receives an ability hit, affecting statistics /// </summary> /// <param name="statsGeneral"></param> public void ReceiveHit(StatsGeneral statsGeneral) { // Debuffing //_tempSpeed -= statsGeneral._tempSpeed; }
/// <summary> /// Generates the combat statistics for the ability /// </summary> /// <param name="statsGeneral"></param> /// <param name="statsOffense"></param> /// <param name="statsDefense"></param> public override void GenerateCombatStatistics(StatsGeneral statsGeneral, StatsOffense statsOffense, StatsDefense statsDefense) { _statsGeneral.GenerateCombatAbilityStatistics(statsGeneral); _statsOffense.GenerateCombatAbilityStatistics(statsOffense); _statsDefense.GenerateCombatAbilityStatistics(statsDefense); }