public void AIActionMoveTo(Vector3 n_point) { KnockBackHelper comp_kb = GetComponent <KnockBackHelper>(); if (comp_kb != null) { SpeedUnit n_speedUnit = new SpeedUnit(); n_speedUnit.setTarget(getMaxMoveSpeed(), attack_radius / 2, getSpeedUpDuration()); comp_kb.doMoveToPositionWithUpdate(n_speedUnit, n_point); Debug.Log("Do move to " + n_point); } }
void doNormalAttack(KnockBackHelper target_knockBackHelper, UnitProperty coll_Unit) { //set explosion if (target_knockBackHelper != null) { power = getCurrentPower(); Debug.Log("(" + gameObject.name + ") hit Unit (" + coll_Unit.gameObject.name + ") knockBack with power " + power); //knock back target_knockBackHelper.doExplodionKnockBackWithTween(gameObject, power); //lost health point coll_Unit.addHealthPoint(-getCurrentPower()); //set Attack isReadyToAttack = false; } else { Debug.Log("knockback not found"); } }
/// <summary> /// Players the action move to. /// </summary> /// <param name="n_point">N point.</param> public void PlayerActionMoveTo(Vector3 n_point) { //tend to target position AngleProvidor comp_tend = GetComponent <AngleProvidor>(); float lookAtPos_distance = comp_tend.LookAtWithTargetPosition(n_point, false); //do transform the n_point with maximu move distance if (lookAtPos_distance > attack_radius / 2) { Debug.Log("lookat Position " + n_point + " is too far. "); n_point = comp_tend.GetTendPositionWithOutNewTarget(attack_radius / 2); } KnockBackHelper comp_kb = GetComponent <KnockBackHelper>(); if (comp_kb != null) { SpeedUnit n_speedUnit = new SpeedUnit(); n_speedUnit.setTarget(getMaxMoveSpeed(), attack_radius / 2, getSpeedUpDuration()); comp_kb.doMoveToPositionWithUpdate(n_speedUnit, n_point); Debug.Log("Do move to " + n_point); } }