コード例 #1
0
ファイル: Dagger.cs プロジェクト: HeshamMeneisi/Lone-Wolf
 public override void Collide(Object3D obj)
 {
     if (obj is INPC)
     {
         ((INPC)obj).Kill();
     }
     if (!(obj is Player))
         base.Collide(obj);
 }
コード例 #2
0
ファイル: Player.cs プロジェクト: HeshamMeneisi/Lone-Wolf
 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);
 }
コード例 #3
0
ファイル: Player.cs プロジェクト: HeshamMeneisi/Lone-Wolf
 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);
     }
 }
コード例 #4
0
ファイル: Terrain.cs プロジェクト: HeshamMeneisi/Lone-Wolf
        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);
                }
            }
        }
コード例 #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;
 }
コード例 #6
0
 public void Collide(Object3D player)
 {
 }
コード例 #7
0
ファイル: Drone.cs プロジェクト: HeshamMeneisi/Lone-Wolf
 public void Collide(Object3D player)
 {
 }
コード例 #8
0
 public void Collide(Object3D player)
 {
     Manager.PlayerWon();
 }
コード例 #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));
     }
 }
コード例 #10
0
ファイル: Object3D.cs プロジェクト: HeshamMeneisi/Lone-Wolf
 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;
 }
コード例 #11
0
ファイル: Projectile.cs プロジェクト: HeshamMeneisi/Lone-Wolf
 public virtual void Collide(Object3D obj)
 {
     World.GetInstance().Destroy(this);
 }
コード例 #12
0
ファイル: Projectile.cs プロジェクト: HeshamMeneisi/Lone-Wolf
 public virtual void Collide(Object3D obj)
 {
     World.GetInstance().Destroy(this);
 }
コード例 #13
0
 public void Release(Object3D model)
 {
     taken.Remove(model);
     if (taken.Count + available.Count < maxcapacity)
         available.Push(model);
 }
コード例 #14
0
ファイル: LandMine.cs プロジェクト: HeshamMeneisi/Lone-Wolf
 public void Collide(Object3D player)
 {
     if (Destroyed) return;
     World.GetInstance().Destroy(this);
     Triggered(player as Player);
 }
コード例 #15
0
 public void Collide(Object3D player)
 {
     Manager.PlayerWon();
 }