コード例 #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());
                }
            }
        }
    }
コード例 #2
0
    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);
    }
コード例 #3
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());
                    }
                }
            }
        }
    }
コード例 #4
0
    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);
        }
    }
コード例 #5
0
    void Awake()
    {
        thisTransform = transform;

        _statsOffense = GetComponent <StatsOffense>();
        _statsDefense = GetComponent <StatsDefense>();
        _statsGeneral = GetComponent <StatsGeneral>();
    }
コード例 #6
0
    public virtual void SetTargetObject(GameObject targetobject)
    {
        targetObject = targetobject;

        _statsGeneralTarget = targetObject.GetComponent <StatsGeneral>();
        _statsOffenseTarget = targetObject.GetComponent <StatsOffense>();
        _statsDefenseTarget = targetObject.GetComponent <StatsDefense>();
    }
コード例 #7
0
    public virtual void Awake()
    {
        Debug.Log("Ability Controller awake");
        thisTransform = transform;

        _statsOffense = GetComponent <StatsOffense>();
        _statsDefense = GetComponent <StatsDefense>();
        _statsGeneral = GetComponent <StatsGeneral>();
    }
コード例 #8
0
    public virtual void Awake()
    {
        thisTransform = transform;
        targetPoint   = thisTransform.position;

        _attributes   = GetComponent <Attributes>();
        _statsOffense = GetComponent <StatsOffense>();
        _statsDefense = GetComponent <StatsDefense>();
        _statsGeneral = GetComponent <StatsGeneral>();
    }
コード例 #9
0
    void Awake()
    {
        thisTransform = transform;
        _attributes   = GetComponent <Attributes>();
        _statsOffense = GetComponent <StatsOffense>();
        _statsDefense = GetComponent <StatsDefense>();
        _statsGeneral = GetComponent <StatsGeneral>();

        _inCombat = false;
    }
コード例 #10
0
    /// <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;
    }
コード例 #11
0
    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();
    }
コード例 #12
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());
            }
        }
    }
コード例 #13
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));
            }
        }
    }
コード例 #14
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());
                }
            }
        }
    }
コード例 #15
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());
                }
            }
        }
    }
コード例 #16
0
 /// <summary>
 /// Receives an ability hit, affecting statistics
 /// </summary>
 /// <param name="statsGeneral"></param>
 public void ReceiveHit(StatsGeneral statsGeneral)
 {
     // Debuffing
     //_tempSpeed -= statsGeneral._tempSpeed;
 }
コード例 #17
0
 /// <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);
 }