trying to find an object with a tag that is also a grater distance then (100) to assign
EXT_FighterAI.cs(41,43): error CS0019: Operator &&' cannot be applied to operands of type
UnityEngine.GameObject’ and `bool’
trying to do “find this tag” that is also > “this distance”
using UnityEngine;
using System.Collections;
public class EXT_FighterAI : MonoBehaviour {
public GameObject nextWaypoint;
public Transform selectedTarget;
public Transform selectedWaypoint;
public float waypointDistance;
public float maxSpeed;
public float currentSpeed;
public float turnSpeed;
public float shipHealh = 100;
public float AIstance = 1;
//-----------------------------------------------------------------------------------------------------------
// Use this for initialization
void Start () {
}
//-----------------------------------------------------------------------------------------------------------
// Update is called once per frame
void FixedUpdate () {
// set patrolling AI:
if (AIstance == 1) {
patrolingAI ();
}
}
//-----------------------------------------------------------------------------------------------------------
void patrolingAI () {
//Find and assign a waypoint find a game object with tag that is also its distance is > X.
nextWaypoint = GameObject.FindGameObjectsWithTag("EXT_AI_Waypoint") && (waypointDistance > 100);
//Look at Assigned Waypoint and get its distance:
Quaternion WantedRotation = Quaternion.LookRotation (nextWaypoint.transform.position - nextWaypoint.transform.position, nextWaypoint.transform.up);
waypointDistance = Vector3.Distance(nextWaypoint.transform.position, transform.position);
//when arive at waypoint, assign new waypoint that is greater distance then 100, so cannot assign the same waypoint.
if(waypointDistance < 10){
nextWaypoint = GameObject.FindGameObjectsWithTag("EXT_AI_Waypoint") && (waypointDistance > 100); //only choose if distance is > then 100.
}
}
//-----------------------------------------------------------------------------------------------------------
}