Exemple #1
0
 public Object()
 {
     this.OwnerID   = 0;
     this._position = new Vector3(0, 0, 0);
     this.Rotation  = new Vector3(0, 0, 0);
     this.scale     = new Vector3(1, 1, 1);
     this.Direction = new Vector3(0, 0, 0);
     this.ObjectID  = ObjectIDCounter++;
     this.Collider  = new CollisionBox2D(this, Position, new Vector2(0.5f, 0.5f));
 }
Exemple #2
0
        //public bool IsTouching(CollisionCircle2D other)
        //{
        //    //(x2 - x1) ^ 2 + (y1 - y2) ^ 2 <= (r1 + r2) ^ 2

        //    return Math.Pow(other.Position.x - Position.x, 2) +
        //           Math.Pow(Position.z - other.Position.z, 2) <=
        //           Math.Pow(other.Radius + Radius, 2);
        //    return false;
        //}

        public override bool IsTouching(BaseCollider other)
        {
            if (other.collisionShape == CollisionShape.Box)
            {
                return(CheckCircleToBoxCollision(this, (CollisionBox2D)other));
            }
            else if (other.collisionShape == CollisionShape.Circle)
            {
                return(CheckCircleToCircleCollision(this, (CollisionCircle2D)other));
            }
            return(false);
        }
Exemple #3
0
 public void RemoveOldCollisions(BaseCollider other)
 {
     this.OldCollisions.Remove(other.ColliderObjectID);
 }
Exemple #4
0
 public bool IsCurrentlyCollidingWith(BaseCollider other)
 {
     return(this.CurrentlyCollidingWith.ContainsKey(other.ColliderObjectID));
 }
Exemple #5
0
 public void AddOldCollision(BaseCollider other)
 {
     this.OldCollisions.Add(other.ColliderObjectID, other);
 }
Exemple #6
0
 public void RemoveCurrentlyCollidingWith(BaseCollider other)
 {
     this.CurrentlyCollidingWith.Remove(other.ColliderObjectID);
 }
Exemple #7
0
 public void AddCurrentlyColliding(BaseCollider other)
 {
     this.CurrentlyCollidingWith.Add(other.ColliderObjectID, other);
 }
Exemple #8
0
 public void RemoveNewCollision(BaseCollider other)
 {
     this.NewCollisions.Remove(other.ColliderObjectID);
 }
Exemple #9
0
 public virtual bool IsTouching(BaseCollider otherBox)
 {
     return(false);
 }