public void OnDisabled(NetworkAsset network) { if (autoRecalculate) { RecalculateNetwork(network); } }
public WaypointAsset(string name, Vector3 position, float radius, NetworkAsset network, CollectionAsset collection) : base(network, collection) { this.Name = name; this.Position = position; this.radius = radius; disableRuntime = true; }
public NetworkNodeAsset( NetworkAsset network, CollectionAsset collection ) : base( collection ) { x = y = z = 0.0f; connections = new ConnectionAsset[ 0 ]; enabled = true; this.network = network; }
public bool Remove(NetworkAsset network) { NetworkAsset[] newNetworks; bool found; newNetworks = new NetworkAsset[networks.Length - 1]; found = false; for (int i = 0; i < newNetworks.Length; i++) { if (networks[i] == network) { found = true; } newNetworks[i] = networks[i + ((found) ? 1 : 0)]; } found = (networks[newNetworks.Length] == network) ? true : found; if (!found) { return(false); } networks = newNetworks; return(true); }
public WaypointAsset( string name, Vector3 position, float radius, NetworkAsset network, CollectionAsset collection ) : base( network, collection ) { this.Name = name; this.Position = position; this.radius = radius; disableRuntime = true; }
public NetworkNodeAsset(NetworkAsset network, CollectionAsset collection) : base(collection) { x = y = z = 0.0f; connections = new ConnectionAsset[0]; enabled = true; this.network = network; }
public GridNodeAsset( GridNodeAsset original, NetworkAsset network ) : base( network, original.Collection ) { this.Name = original.Name; target = original.Target; this.Tags = new int[ original.Tags.Length ]; for( int i = 0; i < original.Tags.Length; i++ ) // Copy the tag indexes { this.Tags[ i ] = original.Tags[ i ]; } }
public GridNodeAsset(GridNodeAsset original, NetworkAsset network) : base(network, original.Collection) { this.Name = original.Name; target = original.Target; this.Tags = new int[original.Tags.Length]; for (int i = 0; i < original.Tags.Length; i++) // Copy the tag indexes { this.Tags[i] = original.Tags[i]; } }
public WaypointAsset( WaypointAsset original, NetworkAsset network ) : base( network, original.Collection ) { this.Name = original.Name; this.Position = original.Position; this.radius = original.Radius; this.disableRuntime = original.DisableRuntime; this.Tags = new int[ original.Tags.Length ]; for( int i = 0; i < original.Tags.Length; i++ ) // Copy the tag indexes { this.Tags[ i ] = original.Tags[ i ]; } }
public WaypointAsset(WaypointAsset original, NetworkAsset network) : base(network, original.Collection) { this.Name = original.Name; this.Position = original.Position; this.radius = original.Radius; this.disableRuntime = original.DisableRuntime; this.Tags = new int[original.Tags.Length]; for (int i = 0; i < original.Tags.Length; i++) // Copy the tag indexes { this.Tags[i] = original.Tags[i]; } }
public NetworkAsset Add(NetworkAsset network) { NetworkAsset[] newNetworks; newNetworks = new NetworkAsset[networks.Length + 1]; for (int i = 0; i < networks.Length; i++) { newNetworks[i] = networks[i]; } newNetworks[networks.Length] = network; networks = newNetworks; return(network); }
public bool DoesUse(NetworkAsset network) { if (end.Network == network) { return(true); } foreach (ConnectionAsset connection in Solution) { if (connection.From.Network == network) { return(true); } } return(false); }
public CellAsset(CellAsset original, NetworkAsset network) : base(network, original.Collection) { this.Name = original.Name; this.Position = original.Position; this.triangles = new TriangleAsset[original.Triangles.Length]; for (int i = 0; i < original.Triangles.Length; i++) { this.triangles[i] = new TriangleAsset(original.Triangles[i], this); } this.Tags = new int[original.Tags.Length]; for (int i = 0; i < original.Tags.Length; i++) { this.Tags[i] = original.Tags[i]; } }
//private Edge[] border; public CellAsset( string name, Vector3 position, TriangleAsset[] triangles, NetworkAsset network, CollectionAsset collection ) : base( network, collection ) { this.Name = name; this.Position = position; foreach( TriangleAsset triangle in triangles ) { triangle.Cell = this; } this.triangles = triangles; // TODO: Calculate border and position from triangles /*ArrayList edges, uses; Edge edge, existingEdge; edges = new ArrayList(); uses = new ArrayList(); foreach( TriangleAsset triangle in triangles ) { for( int i = 0; i < 3; i++ ) { edge = ( i == 0 ) ? new Edge( triangle.Points[ 0 ], triangles.Points[ 1 ] ) : ( i == 1 ) ? new Edge( triangle.Points[ 1 ], triangles.Points[ 2 ] ) : new Edge( triangle.Points[ 2 ], triangles.Points[ 0 ] ); for( int j = 0; j < edges.Count; j++ ) { existingEdge = edges[ j ]; if( edge.Equals( existingEdge ) ) { uses[ edges.IndexOf( existingEdge ) ]++; } } } }*/ }
//private Edge[] border; public CellAsset(string name, Vector3 position, TriangleAsset[] triangles, NetworkAsset network, CollectionAsset collection) : base(network, collection) { this.Name = name; this.Position = position; foreach (TriangleAsset triangle in triangles) { triangle.Cell = this; } this.triangles = triangles; // TODO: Calculate border and position from triangles /*ArrayList edges, uses; * Edge edge, existingEdge; * * edges = new ArrayList(); * uses = new ArrayList(); * * foreach( TriangleAsset triangle in triangles ) * { * for( int i = 0; i < 3; i++ ) * { * edge = ( i == 0 ) ? new Edge( triangle.Points[ 0 ], triangles.Points[ 1 ] ) : * ( i == 1 ) ? new Edge( triangle.Points[ 1 ], triangles.Points[ 2 ] ) : * new Edge( triangle.Points[ 2 ], triangles.Points[ 0 ] ); * * for( int j = 0; j < edges.Count; j++ ) * { * existingEdge = edges[ j ]; * * if( edge.Equals( existingEdge ) ) * { * uses[ edges.IndexOf( existingEdge ) ]++; * } * } * } * }*/ }
public void RecalculateNetwork(NetworkAsset network) { CachedSeeker cache; Seeker seeker; // TODO: Implement for active seekers as well (we need to get out of the seeker coroutine without doing OnCompleted/OnFailed) for (int i = 0; i < cachedSeekers.Count;) { cache = ( CachedSeeker )cachedSeekers[i]; if (cache.DoesUse(network)) { cachedSeekers.Remove(cache); } else { i++; } } for (int i = 0; i < usedSeekers.Count;) { seeker = ( Seeker )usedSeekers[i]; if (seeker.DoesUse(network)) { usedSeekers.Remove(seeker); seeker.Invalidate(); } else { i++; } } }
public NetworkAsset Add( NetworkAsset network ) { NetworkAsset[] newNetworks; newNetworks = new NetworkAsset[ networks.Length + 1 ]; for( int i = 0; i < networks.Length; i++ ) { newNetworks[ i ] = networks[ i ]; } newNetworks[ networks.Length ] = network; networks = newNetworks; return network; }
public bool Remove( NetworkAsset network ) { NetworkAsset[] newNetworks; bool found; newNetworks = new NetworkAsset[ networks.Length - 1 ]; found = false; for( int i = 0; i < newNetworks.Length; i++ ) { if( networks[ i ] == network ) { found = true; } newNetworks[ i ] = networks[ i + ( ( found ) ? 1 : 0 ) ]; } found = ( networks[ newNetworks.Length ] == network ) ? true : found; if( !found ) { return false; } networks = newNetworks; return true; }
public CellAsset( CellAsset original, NetworkAsset network ) : base( network, original.Collection ) { this.Name = original.Name; this.Position = original.Position; this.triangles = new TriangleAsset[ original.Triangles.Length ]; for( int i = 0; i < original.Triangles.Length; i++ ) { this.triangles[ i ] = new TriangleAsset( original.Triangles[ i ], this ); } this.Tags = new int[ original.Tags.Length ]; for( int i = 0; i < original.Tags.Length; i++ ) { this.Tags[ i ] = original.Tags[ i ]; } }
public void RecalculateNetwork( NetworkAsset network ) { CachedSeeker cache; Seeker seeker; // TODO: Implement for active seekers as well (we need to get out of the seeker coroutine without doing OnCompleted/OnFailed) for( int i = 0; i < cachedSeekers.Count; ) { cache = ( CachedSeeker )cachedSeekers[ i ]; if( cache.DoesUse( network ) ) { cachedSeekers.Remove( cache ); } else { i++; } } for( int i = 0; i < usedSeekers.Count; ) { seeker = ( Seeker )usedSeekers[ i ]; if( seeker.DoesUse( network ) ) { usedSeekers.Remove( seeker ); seeker.Invalidate(); } else { i++; } } }
public void OnDisabled( NetworkAsset network ) { if( autoRecalculate ) { RecalculateNetwork( network ); } }
public bool DoesUse( NetworkAsset network ) { if( end.Network == network ) { return true; } foreach( ConnectionAsset connection in Solution ) { if( connection.From.Network == network ) { return true; } } return false; }
public bool Remove( NetworkAsset network ) { bool found = false; int index = System.Array.IndexOf(networks, network); if (index != -1) { NetworkAsset[] newNetworks = new NetworkAsset[ networks.Length - 1 ]; if (newNetworks.Length > 0) { System.Array.ConstrainedCopy(networks, 0, newNetworks, 0, index); int length = networks.Length-index-1; if (length > 0) System.Array.ConstrainedCopy(networks, index+1, newNetworks, index, length); } networks = newNetworks; found = true; } return found; }