示例#1
0
 protected override void onKeypress(KeypressEventArgs eventArgs)
 {
     if (!Inactive && (eventArgs.Keypress == Keys.E || eventArgs.Gamepad.IsButtonDown(Buttons.X)))
     {
         string text = "This is the evidence you can use to blackmail August! Now you just have to find him.";
         SubtitleBox.AddMessage(text);
         (eventArgs.Sender as Player).UpdateProgressionData("hasblackmail", "true");
         Inactive = true;
     }
 }
示例#2
0
 protected override void onKeypress(KeypressEventArgs eventArgs)
 {
     if (!Inactive && canTalk && (eventArgs.Keypress == Keys.E || eventArgs.Gamepad.IsButtonDown(Buttons.X)) && eventArgs.Distance < talkDistance && text != null)
     {
         if (IsPolice && (eventArgs.Sender as Player).Morality < evilThreshold)
         {
             SubtitleBox.AddMessage(policeText, Name);
         }
         else if (IsGang && (eventArgs.Sender as Player).Morality > evilThreshold)
         {
             SubtitleBox.AddMessage(gangText, Name);
         }
         else
         {
             SubtitleBox.AddMessage(text, Name);
         }
         canTalk = false;
     }
 }
示例#3
0
 protected override void onKeypress(KeypressEventArgs eventArgs)
 {
     if (!talked)
     {
         if ((eventArgs.Sender as Player).HasProgressionData("hasblackmail"))
         {
             text   = hasEvidence;
             talked = true;
             SubtitleBox.AddMessage(text, Name, delegate { fading = true; });
             return;
         }
         else if (active)
         {
             text = attacking;
         }
         else
         {
             text = noEvidence;
         }
         base.onKeypress(eventArgs);
     }
 }
示例#4
0
        public override void Update(GameTime gameTime)
        {
            if (fading)
            {
                alpha += deltaA;
                if (alpha >= 255)
                {
                    alpha             = 255;
                    GameManager.State = GameState.GameOver;
                }
                return;
            }
            if (character.IsActive)
            {
                character.Update((float)gameTime.ElapsedGameTime.TotalSeconds);

                Vector3       startPosition = RenderingDevice.Camera.Position + RenderingDevice.Camera.World.Forward * 2;
                RayCastResult raycastResult;
                if (GameManager.Space.RayCast(new Ray(startPosition, RenderingDevice.Camera.World.Forward), 5, rayCastFilter, out raycastResult))
                {
                    Actor actorCollision;
                    if (raycastResult.HitObject is ConvexCollidable && (actorCollision = (raycastResult.HitObject as ConvexCollidable).Entity.Tag as Actor) != null)
                    {
                        KeypressEventArgs args = KeypressEventArgs.FromCurrentInput(Program.Game.Player, actorCollision);
                        if (args != null)
                        {
                            // I'm doing this all backwards.
                            actorCollision.DoEvent(args);
                        }
                    }
                }

                timing += (float)gameTime.ElapsedGameTime.TotalSeconds;
                if (!swinging && timing > 0.5f && (Input.MouseState.LeftButton == ButtonState.Pressed || Input.CurrentPad.IsButtonDown(Buttons.RightTrigger)))
                {
                    swinging  = true;
                    timing    = 0;
                    swingQuat = Quaternion.CreateFromYawPitchRoll(0, -MathHelper.PiOver2, 0);
                }
                if (swinging && timing > 0.5f)
                {
                    swinging     = false;
                    timing       = 0;
                    swingQuat    = Quaternion.Identity;
                    hitThisSwing = false;
                }

                //if(sword.Ent.Space == null)
                //{
                //    Matrix newWorld;
                //    newWorld = Matrix.CreateRotationX(-MathHelper.PiOver2);
                //    newWorld *= Matrix.CreateTranslation(new Vector3(0.7f, 1.5f, -0.3f));
                //    newWorld *= Matrix.CreateRotationZ((RenderingDevice.Camera as CharacterCamera).Yaw);
                //    newWorld *= Matrix.CreateTranslation(RenderingDevice.Camera.Position);
                //    sword.Transform = newWorld;
                //}
                if (Vector3.Distance(sword.Ent.Position, PhysicsObject.Position) > 6)
                {
                    sword.Ent.Position = swordgrabber.GoalPosition;
                }
                swordgrabber.GoalPosition    = RenderingDevice.Camera.Position + RenderingDevice.Camera.World.Forward * 2 - Vector3.UnitZ;
                swordgrabber.GoalOrientation = Quaternion.CreateFromAxisAngle(Vector3.UnitX, -MathHelper.PiOver2) *
                                               Quaternion.CreateFromYawPitchRoll(-(RenderingDevice.Camera as CharacterCamera).Yaw, 0, 0) *
                                               Quaternion.CreateFromYawPitchRoll(0, -((RenderingDevice.Camera as CharacterCamera).Pitch + MathHelper.PiOver2), 0) * swingQuat;

#if DEBUG
                if (Input.CheckKeyboardJustPressed(Keys.Q))
                {
                    GameManager.State = GameState.Ending;
                }
#endif
            }
        }
示例#5
0
文件: Actor.cs 项目: snoozbuster/ld28
 public void DoEvent(KeypressEventArgs args)
 {
     OnKeypress(args);
 }
示例#6
0
文件: Actor.cs 项目: snoozbuster/ld28
 protected virtual void onKeypress(KeypressEventArgs eventArgs)
 {
 }