예제 #1
0
        /// <summary>
        /// Constructor that take in a velocity of type Vector
        /// </summary>
        /// <param name="name"></param>
        /// <param name="mass"></param>
        /// <param name="vel"></param>
        /// <param name="position"></param>
        /// <param name="col"></param>
        public CelestialObject(string name, double mass, Vector2 velocity, Vector2 position, Collider2D col, ObjectVisuals visuals)
        {
            this.name = name;
            this.mass = mass;

            this.velocity = velocity;
            this.position = position;
            collider      = col;

            screenPosition = new Vector2();

            if (collider != null)
            {
                if (collider.colliderType == ColliderType.Circle)
                {
                    CircleCollider cc = (CircleCollider)collider;
                    cc.centre.Set(position);
                }
            }

            if (visuals != null)
            {
                this.visuals = visuals;
            }
            else
            {
                this.visuals = new ObjectVisuals();
            }

            ObjectManager.AddObject(this);
        }
예제 #2
0
 public Star(string name, double mass, Vector2 velocity, Vector2 position, Collider2D col, ObjectVisuals visuals) : base(name, mass, velocity, position, col, visuals)
 {
 }