示例#1
0
    private void PredatorBoidMovement(BoidBehaviour boid)
    {
        Vector3 component1, component2, component3;

        //component1 = Rule1.FindPointTowardsLocalMassCentre(boidList, boid, perciveDistance * 5);
        component3 = Rule3.MatchVelocityOfPercivedBoids(boidList, boid, perciveDistance * 5);

        boid.CurrentVelocity    = boid.CurrentVelocity + component3;
        boid.transform.position = boid.transform.position + boid.CurrentVelocity;
    }
示例#2
0
    private void StandardBoidMovement(BoidBehaviour boid)
    {
        Vector3 defaultMovement, component1, component2, component3, component4;

        component1 = Rule1.FindPointTowardsGlobalMassCentre(boidList, boid);
        component2 = TargetPoint.TowardsPoint(boid, targetPoint);
        component3 = Rule2.MoveAwayFromNearbyObjects(boidList, boid);
        component4 = Rule3.MatchVelocityOfPercivedBoids(boidList, boid, perciveDistance);

        /*
         * component1 = Rule1.FindPointTowardsLocalMassCentre(boidList, boid, perciveDistance);
         * component2 = Rule2.MoveAwayFromNearbyObjects(boidList, boid);
         * component3 = Rule3.MatchVelocityOfPercivedBoids(boidList, boid, perciveDistance);
         * componentHunted = RuleHunted.MoveAwayFromPredators(predatorList, boid);
         */

        boid.CurrentVelocity    = boid.CurrentVelocity + component1 + component2 + component3 + component4;
        boid.transform.position = boid.transform.position + boid.CurrentVelocity;
        //Debug.Log(boid.transform.position);
    }