Example #1
0
        public virtual void Initialize()
        {
            ChildObjects = new List <GameObject>();

            // If an outerhitbox does not yet exist, set it equal to the "true" hitbox.
            if (UsesInnerHitbox && InnerHitbox == null)
            {
                InnerHitbox = Hitbox;
            }

            if (thisScene != null)
            {
                thisScene.AddGameObject(this);
            }

            if (Texture != null && Origin == null)
            {
                Origin = new Vector2(Texture.Width / 2, Texture.Height / 2);
            }

            if (DeletionBoundary == null)
            {
                DeletionBoundary = new Vector2(Hitbox.Radius, Hitbox.Radius);
            }

            if (Color == null)
            {
                Color = Color.White;
            }

            ObjectCount++;
            DrawLayer -= ObjectCount * .0000001f;
        }