Ejemplo n.º 1
0
    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());
                }
            }
        }
    }
Ejemplo n.º 2
0
    /// <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());
                    }
                }
            }
        }
    }
Ejemplo n.º 3
0
    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;
    }
Ejemplo n.º 4
0
    //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());
            }
        }
    }
Ejemplo n.º 5
0
    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));
            }
        }
    }
Ejemplo n.º 6
0
    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());
                }
            }
        }
    }
Ejemplo n.º 7
0
    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());
                }
            }
        }
    }
Ejemplo n.º 8
0
    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);
                }
            }
        }
    }