コード例 #1
0
        public static SingularityBullet CreateSingularityBullet(SceneMgr mgr, Point point, Player plr)
        {
            Vector position  = new Vector(plr.GetBaseLocation().X + plr.GetBaseLocation().Width / 2, plr.GetBaseLocation().Y);
            Vector direction = point.ToVector() - position;

            direction.Normalize();

            SingularityBullet bullet = new SingularityBullet(mgr, IdMgr.GetNewId(mgr.GetCurrentPlayer().GetId()));

            bullet.Position  = position;
            bullet.Owner     = plr;
            bullet.Radius    = 2;
            bullet.Damage    = plr.Data.BulletDamage;
            bullet.Direction = direction;
            bullet.Color     = plr.Data.PlayerColor;

            PointCollisionShape cs = new PointCollisionShape();

            cs.Center             = bullet.Center;
            bullet.CollisionShape = cs;

            LinearMovementControl lmc = new LinearMovementControl();

            lmc.Speed = plr.Data.BulletSpeed;
            bullet.AddControl(lmc);

            bullet.AddControl(new SingularityBulletCollisionReactionControl());
            bullet.AddControl(new StickyPointCollisionShapeControl());

            bullet.SetGeometry(SceneGeometryFactory.CreateConstantColorEllipseGeometry(bullet));

            return(bullet);
        }
コード例 #2
0
        private void ReceivedNewSingularityBulletMsg(NetIncomingMessage msg)
        {
            SingularityBullet s = new SingularityBullet(this, -1);

            s.ReadObject(msg);
            s.Owner = GetOpponentPlayer();
            s.SetGeometry(SceneGeometryFactory.CreateConstantColorEllipseGeometry(s));
            DelayedAttachToScene(s);
            SyncReceivedObject(s, msg);

            //SoundManager.Instance.StartPlayingOnce(SharedDef.MUSIC_SHOOT);
        }
コード例 #3
0
        public static void InitSingularityBullet(SingularityBullet bullet, SceneMgr mgr, Vector point, Vector position, Player plr)
        {
            Vector direction = point - position;

            direction.Normalize();

            bullet.Position  = position;
            bullet.Owner     = plr;
            bullet.Radius    = 2;
            bullet.Damage    = plr.Data.BulletDamage;
            bullet.Direction = direction;
            bullet.Direction.Normalize();
            bullet.Color = plr.Data.PlayerColor;

            LinearMovementControl lmc = new LinearMovementControl();

            lmc.Speed = plr.Data.BulletSpeed;
            bullet.AddControl(lmc);

            bullet.SetGeometry(SceneGeometryFactory.CreateConstantColorEllipseGeometry(bullet));
        }