public override void Collide(Object3D obj) { if (obj is INPC) { ((INPC)obj).Kill(); } if (!(obj is Player)) base.Collide(obj); }
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); }
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); } }
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); } } }
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; }
public void Collide(Object3D player) { }
public void Collide(Object3D player) { Manager.PlayerWon(); }
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)); } }
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; }
public virtual void Collide(Object3D obj) { World.GetInstance().Destroy(this); }
public void Release(Object3D model) { taken.Remove(model); if (taken.Count + available.Count < maxcapacity) available.Push(model); }
public void Collide(Object3D player) { if (Destroyed) return; World.GetInstance().Destroy(this); Triggered(player as Player); }