public void Interact(Player player) { if (Destroyed) { return; } World.GetInstance().Destroy(this); Defused(player); }
public void Collide(Object3D player) { if (Destroyed) { return; } World.GetInstance().Destroy(this); Triggered(player as Player); }
private void mousedonw(InputManager.MouseKey k, Vector2 position) { if (!Destroyed && Alive && !Attacking && k == InputManager.MouseKey.LeftKey) { Attacking = true; Rotation = new Vector3(0, World.GetInstance().ActiveCam.Rotation.Y + (float)Math.PI, 0); Model = FireModel; StartAnimation(DefaultClip, false); dgthrown = false; } }
public override void Interact(Player player) { if (Manager.UserData.GameState.Health >= Player.MaxHealth) { SoundManager.PlaySound(DataHandler.Sounds[SoundType.Beep], SoundCategory.SFX); } else { player.Heal(healamout); World.GetInstance().Destroy(this); } }
private void ThrowDagger() { SoundManager.PlaySound(DataHandler.Sounds[SoundType.Throw], SoundCategory.SFX); float dist = 20; var daggerpos = Position + new Vector3((float)Math.Sin(Rotation.Y), 0, (float)Math.Cos(Rotation.Y)) * dist; var dir = (daggerpos - Position); dir.Normalize(); var dagger = new Dagger(daggerpos, dir); World.GetInstance().Add(dagger); dgthrown = true; }
public override void OnFinishedPlayingAnimation() { if (Dying) { NPCCoordinator.GetInstance().UnRegister(this); World.GetInstance().Destroy(this); return; } base.OnFinishedPlayingAnimation(); if (IsIdle) { Model = IdleModel; } else { Model = WalkingModel; } Rotation = lrot; StartAnimation(DefaultClip); attacking = false; }
public void BuildMaze() { World world = World.GetInstance(); int cellspr = walls.GetLength(1) - 1; int cellspc = walls.GetLength(2) - 1; WallFactory wallfactory = (WallFactory)SuperFactory.GetFactory <Wall>(); for (short x = 0; x < Walls.GetLength(1); x++) { for (short z = 0; z < walls.GetLength(2); z++) { if (x < cellspr && walls[0, x, z] < 0xFF) { world.Add(wallfactory.CreateNew(walls[0, x, z], new Vector3(x * Celld - Wall.WallLowAnchor.Z, 0, z * Celld - Wall.WallLowAnchor.X), 1)); } if (z < cellspc && walls[1, x, z] < 0xFF) { world.Add(wallfactory.CreateNew(walls[1, x, z], new Vector3(x * Celld - Wall.WallLowAnchor.X, 0, z * Celld - Wall.WallLowAnchor.Z), 0)); } } } }
public override void Interact(Player player) { Manager.IncrementScore(scoreincrement); World.GetInstance().Destroy(this); }
private StageCont() { //TODO: init world = World.GetInstance(); instance = this; }
public virtual void Collide(Object3D obj) { World.GetInstance().Destroy(this); }
public override void Update(GameTime time) { Vector3 newpos = Position; Vector3 newrot = Rotation; if (!Attacking && Alive) { // Vector3 is passed on assignment as a clone not a reference if (InputManager.IsKeyDown(Keys.W)) { if (InputManager.IsKeyDown(Keys.A)) { newrot.Y += 0.05f; adjusted = true; } else if (InputManager.IsKeyDown(Keys.D)) { newrot.Y -= 0.05f; adjusted = true; } else if (!ismoving || !adjusted) { newrot = new Vector3(0, World.GetInstance().ActiveCam.Rotation.Y + (float)Math.PI, 0); } newpos.X += speed * (float)Math.Sin(newrot.Y); newpos.Z += speed * (float)Math.Cos(newrot.Y); ismoving = true; } else { ismoving = adjusted = false; } var test = new TimeSpan(0, 0, 1); if (ismoving) { StarWalking(); } else { StandStill(); } } int prog = (int)(AnimationProgress * 100); if (Alive && ismoving && prog % 50 == 0) { SoundManager.PlaySound(StepSounds[ran.Next(StepSounds.Length)], SoundCategory.SFX); } if (Attacking) { if (prog > 50) { OnFinishedPlayingAnimation(); } else if (prog > 20) { if (!dgthrown) { ThrowDagger(); } } } Position = newpos; Rotation = newrot; World.GetInstance().ActiveCam.Position = Position + camoffset; base.Update(time); }