Exemplo n.º 1
0
    void CalculateNeighborhood()
    {
        if (flockManager)
        {
            neighborhood.Clear();
            for (int i = 0; i < flockManager.flock.Count; i++)
            {
                SteeringVehicle vehicle = flockManager.flock[i];

                if (vehicle == this)
                {
                    continue;
                }

                if (!inView(vehicle))
                {
                    continue;
                }

                if (Vector3.Distance(transform.position, vehicle.transform.position) < neighborhoodRadius)
                {
                    neighborhood.Add(flockManager.flock[i]);
                }
            }
        }
    }
    void Start()
    {
        steeringVehicle = GetComponent <SteeringVehicle>();
        wayPointManager = GetComponent <WayPointManager>();

        waypointAction += SetWaypointTarget;
        steeringVehicle.SetTarget(wayPointManager.GetFirstWayPoint().position);
    }
Exemplo n.º 3
0
    bool inView(SteeringVehicle v)
    {
        float angle = Quaternion.Angle(transform.rotation, v.transform.rotation);

        if (angle < fieldOfView)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemplo n.º 4
0
 //protected SteeringVehicle steering; // changed this from Steering to SteeringVehicle
 protected void Start()
 {
     // don't do base start
     steeringCalculate = new SteeringCalculateWeightedSum(); // create one or the other
     steering = new SteeringVehicle(this, steeringCalculate);
 }
Exemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     vehicle = GetComponent <SteeringVehicle>();
 }
Exemplo n.º 6
0
 public Separation(SteeringVehicle v, float weight) : base(v, weight)
 {
 }
Exemplo n.º 7
0
 public Arrival(SteeringVehicle v, float weight, Transform t, float s) : base(v, weight)
 {
     target           = t;
     slowing_distance = s;
 }
Exemplo n.º 8
0
 public WallAvoid(SteeringVehicle v, float weight) : base(v, weight)
 {
 }
Exemplo n.º 9
0
 public Alignment(SteeringVehicle v, float weight) : base(v, weight)
 {
 }
Exemplo n.º 10
0
 public Cohesion(SteeringVehicle v, float weight) : base(v, weight)
 {
 }
Exemplo n.º 11
0
 public SteeringBehavior(SteeringVehicle v, float w)
 {
     vehicle   = v;
     transform = vehicle.transform;
     weight    = w;
 }
Exemplo n.º 12
0
    //protected SteeringVehicle steering; // changed this from Steering to SteeringVehicle

    protected void Start()
    {
        // don't do base start
        steeringCalculate = new SteeringCalculateWeightedSum();         // create one or the other
        steering          = new SteeringVehicle(this, steeringCalculate);
    }
Exemplo n.º 13
0
 public void AddVehicle(SteeringVehicle v)
 {
     flock.Add(v);
 }
 // Use this for initialization
 void Start()
 {
     steeringVehicle = GetComponent <SteeringVehicle>();
     targetIcon      = GameObject.FindWithTag("target");
 }