void AIControl() { if (AITarget == null) { return; } agent.SetDestination(AITarget.position); transform.LookAt(AITarget); transform.Rotate(0, 180, 0); if (robotTarget == null) { return; } if (robotTarget.robotLaborerControl.isFighter) { //if distance is shorter then ram is distance - ram if (TargetDistance() < AIData.GetRamDistance()) { robotManager.robotAttack.InitiateRam(); } } }
void AIControl() { if (canMove) { if (AITarget == null) { //Debug.Log("null"); return; } if (!robotTarget.robotMovement.inBase) { agent.SetDestination(AITarget.position); } Transform currentForward = transform; transform.LookAt(AITarget); transform.Rotate(0, 180, 0); if (robotTarget == null) { return; } //if (robotTarget.robotLaborerControl.isFighter) {//if enemy Fighter if (robotManager.isRed != robotTarget.isRed && robotTarget.robotLaborerControl.isFighter) { //if distance is shorter then ram is distance - ram if (TargetDistance() < AIData.GetRamDistance()) { robotManager.robotAttack.InitiateRam(); } } } }