コード例 #1
0
        // find all neighbors within the given sphere (as center and radius)
        public override void FindNeighbors(Vector3 center, float radius, ref List <ProximityDatabaseItem> results)
        {
            // loop over all tokens
            float r2 = radius * radius;

            for (int i = 0; i < bfpd.group.Count; i++)
            {
                TokenType2 tToken = (TokenType2)bfpd.group[i];

                Vector3 offset = center - tToken.position;
                float   d2     = offset.sqrMagnitude;

                // push onto result vector when within given radius
                if (d2 < r2)
                {
                    results.Add(tToken.tParentObject);
                }
            }
            ;
        }
コード例 #2
0
        // allocate a token to represent a given client object in this database
        public TokenType2 AllocateToken(AbstractVehicle parentObject)
        {
            TokenType2 tToken = new TokenType2(parentObject, this);

            return(tToken);
        }