예제 #1
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);
    }