Here are the examples of the csharp api System.Collections.Generic.IEnumerable.Contains(Track) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
19
Source : ParentObject.cs
with MIT License
from Aeroluna
with MIT License
from Aeroluna
internal static void replacedignTrack(IEnumerable<Track> tracks, Track parentTrack, Vector3? startPos, Quaternion? startRot, Quaternion? startLocalRot, Vector3? startScale)
{
if (tracks.Contains(parentTrack))
{
throw new System.InvalidOperationException("How could a track contain itself?");
}
if (Controller == null)
{
GameObject gameObject = new GameObject("ParentController");
Controller = gameObject.AddComponent<ParentController>();
}
GameObject parentGameObject = new GameObject("ParentObject");
ParentObject instance = parentGameObject.AddComponent<ParentObject>();
instance._origin = parentGameObject.transform;
instance._track = parentTrack;
Transform transform = instance.transform;
if (startPos.HasValue)
{
instance._startPos = startPos.Value;
transform.localPosition = instance._startPos * NoteLinesDistance;
}
if (startRot.HasValue)
{
instance._startRot = startRot.Value;
instance._startLocalRot = instance._startRot;
transform.localPosition = instance._startRot * transform.localPosition;
transform.localRotation = instance._startRot;
}
if (startLocalRot.HasValue)
{
instance._startLocalRot = instance._startRot * startLocalRot.Value;
transform.localRotation *= instance._startLocalRot;
}
if (startScale.HasValue)
{
instance._startScale = startScale.Value;
transform.localScale = instance._startScale;
}
parentTrack.AddGameObject(parentGameObject);
foreach (Track track in tracks)
{
foreach (ParentObject parentObject in Controller.ParentObjects)
{
track.OnGameObjectAdded -= parentObject.OnTrackGameObjectAdded;
track.OnGameObjectRemoved -= parentObject.OnTrackGameObjectRemoved;
parentObject.ChildrenTracks.Remove(track);
}
foreach (GameObject gameObject in track.GameObjects)
{
instance.ParentToObject(gameObject.transform);
}
instance.ChildrenTracks.Add(track);
track.OnGameObjectAdded += instance.OnTrackGameObjectAdded;
track.OnGameObjectRemoved += instance.OnTrackGameObjectRemoved;
}
Controller.ParentObjects.Add(instance);
}