Exemplo n.º 1
0
 public override void Collide(Object3D obj)
 {
     if (obj is INPC)
     {
         ((INPC)obj).Kill();
     }
     if (!(obj is Player))
         base.Collide(obj);
 }
Exemplo n.º 2
0
 public override void SeparateFrom(Object3D stc)
 {
     if (!Alive) return;
     base.SeparateFrom(stc);
     if (stc is IInteractiveObject && InputManager.IsKeyDown(Keys.E))
         ((IInteractiveObject)stc).Interact(this);
     if (stc is IObstacle)
         ((IObstacle)stc).Collide(this);
 }
Exemplo n.º 3
0
 public override void SeparateFrom(Object3D stc)
 {
     if (!Alive)
     {
         return;
     }
     base.SeparateFrom(stc);
     if (stc is IInteractiveObject && InputManager.IsKeyDown(Keys.E))
     {
         ((IInteractiveObject)stc).Interact(this);
     }
     if (stc is IObstacle)
     {
         ((IObstacle)stc).Collide(this);
     }
 }
Exemplo n.º 4
0
        public void Draw(Camera cam)
        {
            int ctd  = (int)Math.Ceiling(cam.FarClip / celld);
            int ccx  = (int)(cam.Position.X / celld);
            int ccz  = (int)(cam.Position.Z / celld);
            var pool = Model3DPool.GetInstance();

            for (int x = Math.Max(0, ccx - ctd); x < Math.Min(floorWidth, ccx + ctd); x++)
            {
                for (int z = Math.Max(0, ccz - ctd); z < Math.Min(floorHeight, ccz + ctd); z++)
                {
                    Object3D model = pool.Acquire();
                    model.Model = plate; model.Position = new Vector3(x * celld, 0, z * celld);
                    model.Draw(cam);
                    pool.Release(model);
                }
            }
        }
Exemplo n.º 5
0
 public virtual void SeparateFrom(Object3D stc)
 {
     Vector3 ta1 = stc.AbsoluteLowAnchor;
     Vector3 ta2 = stc.AbsoluteHighAnchor;
     Vector3 a1 = AbsoluteLowAnchor;
     Vector3 a2 = AbsoluteHighAnchor;
     RectangleF xzinter =  new RectangleF(ta1.X, ta1.Z, ta2.X, ta2.Z, true).Intersection(new RectangleF(a1.X, a1.Z, a2.X, a2.Z, true));
     RectangleF zyinter = new RectangleF(ta1.Z, ta1.Y, ta2.Z, ta2.Y, true).Intersection(new RectangleF(a1.Z, a1.Y, a2.Z, a2.Y, true));
     Vector3 lv = Position - stc.Position;
     float xdif = xzinter.Width;
     float zdif = xzinter.Height;
     float ydif = zyinter.Height;
     Vector3 position = Position;
     if (xdif < zdif && xdif < ydif)
         position.X += xdif * lv.X > 0 ? 1 : -1;
     else if (zdif < ydif)
         position.Z += zdif * lv.Z > 0 ? 1 : -1;
     else
         position.Y += ydif;/*Should not go underground*/
     Position = position;
 }
Exemplo n.º 6
0
 public void Collide(Object3D player)
 {
 }
Exemplo n.º 7
0
 public void Collide(Object3D player)
 {
 }
Exemplo n.º 8
0
 public void Collide(Object3D player)
 {
     Manager.PlayerWon();
 }
Exemplo n.º 9
0
 public void Collide(Object3D player)
 {
     if (!Dying && !Attacking && player is Player)
     {
         lrot = Rotation;
         Rotation = player.Rotation + new Vector3(0, MathHelper.Pi, 0);
         attacking = true;
         Model = AttackModel;
         StartAnimation(DefaultClip, false);
         DamagePlayer(((Player)player));
     }
 }
Exemplo n.º 10
0
 public bool Intersects(Object3D target)
 {
     Vector3 ta1 = target.AbsoluteLowAnchor;
     Vector3 ta2 = target.AbsoluteHighAnchor;
     Vector3 a1 = AbsoluteLowAnchor;
     Vector3 a2 = AbsoluteHighAnchor;
     bool xzinter = new RectangleF(ta1.X, ta1.Z, ta2.X, ta2.Z, true).Intersects(new RectangleF(a1.X, a1.Z, a2.X, a2.Z, true));
     bool xyinter = new RectangleF(ta1.X, ta1.Y, ta2.X, ta2.Y, true).Intersects(new RectangleF(a1.X, a1.Y, a2.X, a2.Y, true));
     bool zyinter = new RectangleF(ta1.Z, ta1.Y, ta2.Z, ta2.Y, true).Intersects(new RectangleF(a1.Z, a1.Y, a2.Z, a2.Y, true));
     return xzinter && xyinter && zyinter;
 }
Exemplo n.º 11
0
 public virtual void Collide(Object3D obj)
 {
     World.GetInstance().Destroy(this);
 }
Exemplo n.º 12
0
 public virtual void Collide(Object3D obj)
 {
     World.GetInstance().Destroy(this);
 }
Exemplo n.º 13
0
 public void Release(Object3D model)
 {
     taken.Remove(model);
     if (taken.Count + available.Count < maxcapacity)
         available.Push(model);
 }
Exemplo n.º 14
0
 public void Collide(Object3D player)
 {
     if (Destroyed) return;
     World.GetInstance().Destroy(this);
     Triggered(player as Player);
 }
Exemplo n.º 15
0
 public void Collide(Object3D player)
 {
     Manager.PlayerWon();
 }