void TriggerAbility(ABS_Abilities _ability, string _key) { //takes the selected ability and the input key if (_ability.canCharge) { //if it is chargable StartCoroutine(Charging(_ability, _key)); //start the charging coroutine } else { MoveAbility(_ability, 0f); //else, just use the ability and send zero for the charge time } }
IEnumerator Impact(ABS_Abilities _ability) { //canMove = false; while (cc.isGrounded != true) { print("I believe I can fly!"); cc.Move(move); yield return(null); } /*if(_ability.impactForce.End){ * _ability.SetImpactLoc (cc.transform.position); * //play smash animation * }*/ canMove = true; }
IEnumerator Charging(ABS_Abilities _ability, string _key) { //Takes the ability and the string of the button used to activate it float charge = 0f; //creates a float to track how long the buttons has been held while (charge < _ability.maxChargeTime) { //while the current charge is less than the max charge time of the ability if (Input.GetButtonUp(_key)) { break; } //break out of the loop if the player releases the button, break out of the while loop charge += Time.deltaTime; //Add to the charge time yield return(null); //wait for a frame } MoveAbility(_ability, charge); //Activate MoveEnemy }
void MoveAbility(ABS_Abilities _ability, float _charge) { if (_ability.movingAbility) { StartCoroutine(AbilityMove(_ability.UseAbility("default", weaponAnims, _charge, CameraPos, this.transform))); } else { if (_ability.hasImpact) { //adds force to the character move = _ability.UseAbility("default", weaponAnims, _charge, CameraPos); StartCoroutine(Impact(_ability)); } else { _ability.UseAbility("defult", weaponAnims, _charge, _ability.damageGO, this.transform); //** not tested** //use ability } } }