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()); } } } }
/// <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 Attack() { while (target != null) { if (!_statsGeneral.CheckCooldown()) { _inCombat = true; StatsGeneral tempstats = abilityBasicControllerPrefab.GetComponent <StatsGeneral>(); //Rotate to target Quaternion targetRotation = Quaternion.LookRotation(target.transform.position - transform.position); targetRotation.x = 0; targetRotation.z = 0; thisTransform.rotation = targetRotation; // Cast ability GameObject clone = (GameObject)Instantiate(abilityBasicControllerPrefab, thisTransform.position, thisTransform.rotation); cachedAbilityBasicController = clone.GetComponent <AbilityController>(); // Set target and stats cachedAbilityBasicController.SetTargetObject(target); cachedAbilityBasicController.GenerateCombatStatistics(_statsGeneral, _statsOffense, _statsDefense); // Start global cooldown _statsGeneral.StartGlobalCooldown(_statsOffense._combatAttackSpeed); } yield return(null); } _inCombat = false; }
//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()); } } } }
public virtual 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()); } else if (Vector3.Distance(thisTransform.position, targetObject.transform.position) > _statsOffense._combatRange) { thisTransform.position = Vector3.MoveTowards(thisTransform.position, targetObject.transform.position, _statsGeneral._combatSpeed * Time.deltaTime); } } } }