示例#1
0
        public Object3D(string objectName, Vector3 position, Vector3 size, Vector3 rotation, Component3D[] components = null, Object3D parent = null)
        {
            WorldMatrix = Matrix.Identity;

            Size     = size;
            Position = position;
            Rotation = rotation;

            ObjectName = objectName;

            Parent = parent;
            if (Parent != null)
            {
                Parent.AddChild(this);
            }

            // Goes through all the possible errors
            if (ObjectName == "")
            {
                Debug.LogError("Object name can't be blank!", true, 3);
            }
            else if (Level.Objects2D.ContainsKey(ObjectName))
            {
                Debug.LogError("The 2DObject \"" + ObjectName + "\" already exists!", true, 3);
            }
            else
            {
                Level.Objects3D.Add(ObjectName, this);
            }

            // Adds and Starts the scripts
            if (components != null)
            {
                foreach (Component3D com in components)
                {
                    AddComponent(com);
                }

                // Starts all the components after they've all been added
                foreach (Component3D com in Components)
                {
                    com.Start();
                }
            }
        }
示例#2
0
 public void RemoveChild(Object3D object3D)
 {
     Children.Remove(object3D);
 }
示例#3
0
 public void AddChild(Object3D object3D)
 {
     Children.Add(object3D);
 }