Пример #1
0
 /// <summary>
 /// Full constructor for GameObject.
 /// </summary>
 /// <param name="name">Name of the object.</param>
 /// <param name="position">Local position of the object.</param>
 /// <param name="rotation">Local rotation of the object.</param>
 /// <param name="scale">Local scale of the object.</param>
 /// <param name="parent">Scene parent of the object (optional).</param>
 public GameObject(string name, Vector3 position, Quaternion rotation, Vector3 scale, Scene scene, GameObject parent = null, BoundingBox?bound = null, bool isVisible = true)
 {
     this.name  = name;
     this.scene = scene;
     if (bound.HasValue)
     {
         this.bound = bound.Value;
     }
     components         = new List <Component>();
     localToWorldMatrix = Matrix.Identity;
     children           = new SortedList <string, GameObject>();
     this.Parent        = parent;
     localPosition      = position;
     localRotation      = rotation;
     localScale         = scale;
     if (scene != null)
     {
         if (name != null && name.StartsWith("Room"))
         {
             scene.AddRoom(this);
         }
         else
         {
             scene.AddObject(this);
         }
     }
     this.isVisible = isVisible;
 }