public virtual void Rotate(Vector2 v) { v.Normalize(); VecUtil.Rotate((double)VecUtil.GetAngle(ref v), ref faceDir); VecUtil.Rotate((double)VecUtil.GetAngle(ref v), ref moveDir); UpdateRotation(); }
//############################################################################################ //############################################################################################ public static Bullet CreateBullet(BulletType type, Vector2 position, Vector2 direction) { Bullet b; switch (type) { case BulletType.PeaShot: b = new Bullet(Textures.TextureName.bulletBasic); b.LoadContent(); b.MoveTo(position); b.speed = 0.3; b.SetRotation(VecUtil.GetAngle(ref direction)); b.Damage = 1; return(b); case BulletType.Round: b = new Bullet(Textures.TextureName.bulletBasic2); b.LoadContent(); b.MoveTo(position); b.speed = 0.3f; b.SetRotation(VecUtil.GetAngle(ref direction)); b.moveMethod = new MMSnakeFast(MathHelper.ToRadians(180f) / 1000f, 400); b.Damage = 1; return(b); case BulletType.BRoundRedFast: b = new Bullet(Textures.TextureName.bulletRedRound); b.LoadContent(); b.MoveTo(position); b.speed = 0.3f; b.SetRotation(VecUtil.GetAngle(ref direction)); b.Damage = 1; return(b); case BulletType.BRoundRedSlow: b = new Bullet(Textures.TextureName.bulletRedRound); b.LoadContent(); b.MoveTo(position); b.speed = 0.3f; b.SetRotation(VecUtil.GetAngle(ref direction)); b.Damage = 1; return(b); case BulletType.Fatty: b = new Bullet(Textures.TextureName.bulletFatty); b.LoadContent(); b.MoveTo(position); b.speed = 0.3; b.SetRotation(VecUtil.GetAngle(ref direction)); b.Damage = 1; return(b); } return(null); }
private void UpdateRotation() { this.rotation = VecUtil.GetAngle(ref faceDir); }