コード例 #1
0
        public static Base CreateBase(SceneMgr mgr, Player plr)
        {
            Base baze = new Base(mgr, IdMgr.GetNewId(mgr.GetCurrentPlayer().GetId()));

            baze.Owner        = plr;
            baze.BasePosition = plr.Data.PlayerPosition;
            baze.Color        = plr.Data.PlayerColor;
            baze.Position     = new Vector(plr.GetBaseLocation().X, plr.GetBaseLocation().Y);
            baze.Size         = new Size(plr.GetBaseLocation().Width, plr.GetBaseLocation().Height);

            SphereCollisionShape cs = new SphereCollisionShape();

            cs.Center           = new Vector(baze.Center.X, baze.Position.Y + 2.5 * baze.Size.Height);
            cs.Radius           = (int)(baze.Size.Width / 1.6);
            baze.CollisionShape = cs;

            BaseHealthControl hc = new BaseHealthControl();

            baze.AddControl(hc);

            baze.AddControl(new BaseCollisionControl());

            baze.LoadImages();
            baze.SetGeometry(baze.Image100);

            return(baze);
        }
コード例 #2
0
        private void CreateMovingParticleEmmitor(Vector position, Vector direction, float speed, float time)
        {
            ParticleEmmitor e = new ParticleEmmitor(null, IdMgr.GetNewId(0));

            e.Direction         = direction;
            e.EmmitingDirection = direction.Rotate(180);
            e.MinAngle          = (float)(-Math.PI);
            e.MaxAngle          = (float)(Math.PI);
            e.MinForce          = 1;
            e.MaxForce          = 2;
            e.MinLife           = 2f;
            e.MaxLife           = 2.5f;
            e.Position          = position;
            e.MinSize           = 0.2f;
            e.MaxSize           = 1;
            e.Amount            = 250;
            e.SizeMultiplier    = 0;
            e.Infinite          = true;
            e.Enabled           = false;

            ParticleSphereFactory f = new ParticleSphereFactory();

            f.Color   = Color.FromArgb(125, 255, 20, 0);
            e.Factory = f;

            LinearMovementControl c = new LinearMovementControl();

            c.Speed = speed;
            e.AddControl(c);

            GameLevelManager.SendNewObject(mgr, e);
        }
コード例 #3
0
        private void CreateSmallBullet(double rotation)
        {
            SingularityBullet smallBullet = new SingularityBullet(SceneMgr, IdMgr.GetNewId(SceneMgr.GetCurrentPlayer().GetId()));

            smallBullet.Owner = Owner;
            Vector dir = Direction;

            dir.Normalize();
            smallBullet.Direction = dir.Rotate(rotation);
            smallBullet.Position  = Center;
            smallBullet.Radius    = 2;
            smallBullet.Damage    = Damage / 2;

            PointCollisionShape cs = new PointCollisionShape();

            cs.Center = smallBullet.Center;
            smallBullet.CollisionShape = cs;

            smallBullet.Color = Color;

            smallBullet.SetGeometry(SceneGeometryFactory.CreateConstantColorEllipseGeometry(smallBullet));

            LinearMovementControl nmc = new LinearMovementControl();

            nmc.Speed = GetControlOfType <LinearMovementControl>().Speed;
            smallBullet.AddControl(nmc);

            SingularityBulletCollisionReactionControl cc = new SingularityBulletCollisionReactionControl();

            cc.StatReported = true;
            smallBullet.AddControl(cc);
            smallBullet.AddControl(new StickyPointCollisionShapeControl());

            SceneMgr.DelayedAttachToScene(smallBullet);
        }
コード例 #4
0
        private void ClientConnectionConnected(NetIncomingMessage msg)
        {
            currentPlayer.Data.Id = msg.SenderConnection.RemoteHailMessage.ReadInt32();
            // pokud uz takove jmeno na serveru existuje, tak obdrzime nove
            currentPlayer.Data.Name = msg.SenderConnection.RemoteHailMessage.ReadString();
            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                App.Instance.PlayerName = currentPlayer.Data.Name;
            }));

            gameRunning = msg.SenderConnection.RemoteHailMessage.ReadBoolean();
            if (GameType == Gametype.TOURNAMENT_GAME)
            {
                if (!gameRunning && !currentPlayer.Data.LobbyLeader)
                {
                    Application.Current.Dispatcher.Invoke(new Action(() =>
                    {
                        App.Instance.CreateLobbyGui(currentPlayer.Data != null && currentPlayer.Data.LobbyLeader, true);
                    }));
                    SendTournamentSettingsRequest();
                    SendChatMessage(String.Format(Strings.Culture, Strings.lobby_joined, GetCurrentPlayer().Data.Name), true);
                }
            }

            while (pendingMessages.Count != 0)
            {
                SendMessage(pendingMessages.Dequeue());
            }

            Logger.Debug("LOGIN confirmed (id: " + IdMgr.GetHighId(GetCurrentPlayer().Data.Id) + ")");

            SendPlayerDataRequestMessage();
        }
コード例 #5
0
        public static Player CreateBot(BotType type, List <Player> players)
        {
            Player bot = new Player(null);

            bot.Data    = new PlayerData();
            bot.Data.Id = IdMgr.GetNewPlayerId();
            String name = BotNameAccessor.GetBotName(type);

            if (players.Exists(p => p.Data.Name.Equals(name)))
            {
                Random rand = new Random(Environment.TickCount);
                bot.Data.PlayerColor = Color.FromRgb((byte)rand.Next(255), (byte)rand.Next(255), (byte)rand.Next(255));
                bot.Data.Name        = name + " " + bot.GetId();
            }
            else
            {
                Color botColor = players[0].Data.PlayerColor;
                bot.Data.PlayerColor = Color.FromRgb((byte)(0xFF - botColor.R), (byte)(0xFF - botColor.G), (byte)(0xFF - botColor.B));
                bot.Data.Name        = name;
            }
            bot.Data.HashId = bot.Data.Name;

            bot.Data.PlayerType = PlayerType.BOT;
            bot.Data.BotType    = type;
            bot.Data.StartReady = true;

            return(bot);
        }
コード例 #6
0
        public static SingularityExplodingBullet CreateSingularityExploadingBullet(SceneMgr mgr, Vector point, Vector position, Player plr)
        {
            Vector direction = point - position;

            direction.Normalize();

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

            InitSingularityBullet(bullet, mgr, point, position, plr);

            PointCollisionShape cs = new PointCollisionShape();

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

            ExplodingSingularityBulletControl c = new ExplodingSingularityBulletControl();

            c.Speed    = SharedDef.BULLET_EXPLOSION_SPEED;
            c.Strength = SharedDef.BULLET_EXPLOSION_STRENGTH;
            bullet.AddControl(c);

            bullet.AddControl(new StickyPointCollisionShapeControl());

            return(bullet);
        }
コード例 #7
0
        public static Asteroid CreateCustomAsteroid(ServerMgr mgr, int rad, Vector pos, Vector dir, AsteroidType type)
        {
            Random randomGenerator = mgr.GetRandomGenerator();

            Asteroid s;

            s = new Asteroid(null, IdMgr.GetNewId(0));
            s.AsteroidType = type;
            if (type == AsteroidType.NORMAL)
            {
                s.TextureId = randomGenerator.Next(1, 18);
            }
            else
            {
                s.TextureId = randomGenerator.Next(1, 6);
            }
            s.Radius = rad;

            s.Direction = dir;
            s.Position  = pos;
            s.Rotation  = mgr.GetRandomGenerator().Next(360);

            SphereCollisionShape cs = new SphereCollisionShape();

            cs.Center        = s.Center;
            cs.Radius        = s.Radius;
            s.CollisionShape = cs;

            CreateAsteroidControls(mgr, s);

            return(s);
        }
コード例 #8
0
        public static MinorAsteroid CreateSmallAsteroid(SceneMgr mgr, Vector direction, Vector center, int rot, int textureId, int radius, float speed, double rotation)
        {
            MinorAsteroid asteroid = new MinorAsteroid(mgr, IdMgr.GetNewId(mgr.GetCurrentPlayer().GetId()));

            asteroid.AsteroidType = AsteroidType.SPAWNED;
            asteroid.Rotation     = rot;
            asteroid.Direction    = direction.Rotate(rotation);
            asteroid.Radius       = radius;
            asteroid.Position     = center;
            asteroid.Gold         = radius * 2;
            asteroid.TextureId    = textureId;
            asteroid.Enabled      = true;
            asteroid.SetGeometry(SceneGeometryFactory.CreateAsteroidImage(asteroid));

            SphereCollisionShape cs = new SphereCollisionShape();

            cs.Center = asteroid.Center;
            cs.Radius = asteroid.Radius;
            asteroid.CollisionShape = cs;

            NewtonianMovementControl nmc = new NewtonianMovementControl();

            nmc.Speed = speed;
            asteroid.AddControl(nmc);

            LinearRotationControl lrc = new LinearRotationControl();

            lrc.RotationSpeed = mgr.GetRandomGenerator().Next(SharedDef.MIN_ASTEROID_ROTATION_SPEED, SharedDef.MAX_ASTEROID_ROTATION_SPEED) / 10.0f;
            asteroid.AddControl(lrc);

            asteroid.AddControl(new MinorAsteroidCollisionReactionControl());
            asteroid.AddControl(new StickySphereCollisionShapeControl());

            return(asteroid);
        }
コード例 #9
0
        public static SingularityMine CreatePowerlessMine(SceneMgr mgr, Vector pos, Vector dir, Player plr)
        {
            SingularityMine mine = new SingularityMine(mgr, IdMgr.GetNewId(mgr.GetCurrentPlayer().GetId()));

            mine.Position  = pos;
            mine.Owner     = plr;
            mine.Radius    = 2;
            mine.Direction = dir;
            mine.Color     = Colors.BlueViolet;
            mine.SetGeometry(SceneGeometryFactory.CreateMineImage(mine));

            SphereCollisionShape cs = new SphereCollisionShape();

            cs.Center           = mine.Center;
            cs.Radius           = mine.Radius;
            mine.CollisionShape = cs;

            PowerlessSingularityControl sc = new PowerlessSingularityControl();

            sc.Speed         = plr.Data.MineGrowthSpeed;
            sc.Strength      = plr.Data.MineStrength;
            sc.StatsReported = true;
            mine.AddControl(sc);

            mine.AddControl(new StickySphereCollisionShapeControl());
            return(mine);
        }
コード例 #10
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);
        }
コード例 #11
0
        private void CreateExplodingParticleEmmitor(Vector position)
        {
            ParticleEmmitor e = new ParticleEmmitor(null, IdMgr.GetNewId(0));

            e.EmitingTime       = 1f;
            e.EmmitingDirection = new Vector(1, 0);
            e.MinAngle          = (float)-Math.PI;
            e.MaxAngle          = (float)Math.PI;
            e.MinForce          = 10;
            e.MaxForce          = 15;
            e.MinLife           = 3f;
            e.MaxLife           = 3.5f;
            e.Position          = position;
            e.MinSize           = 0.2f;
            e.MaxSize           = 0.8f;
            e.Amount            = 100;
            e.SizeMultiplier    = 0;
            e.Infinite          = false;
            e.FireAll           = true;
            e.Enabled           = true;

            byte r = (byte)rand.Next(0, 255);
            byte g = (byte)rand.Next(0, 255);
            byte b = (byte)rand.Next(0, 255);

            ParticleSphereFactory f = new ParticleSphereFactory();

            f.Color   = colors[rand.Next(colors.Count())];
            e.Factory = f;

            GameLevelManager.SendNewObject(mgr, e);
        }
コード例 #12
0
        public static ParticleEmmitor CreateBasicSmoke(SceneMgr mgr, Color c)
        {
            ParticleEmmitor e = new ParticleEmmitor(mgr, IdMgr.GetNewId(0));

            e.Factory = new ParticleSmokeFactory(c);

            return(e);
        }
コード例 #13
0
 public ServerMgr()
 {
     statsMgr      = new StatsMgr(null);
     isInitialized = false;
     shouldQuit    = false;
     Time          = 0;
     Id            = IdMgr.GetNewServerId();
 }
コード例 #14
0
        public static ParticleNode CreateAsteroidEffects(SceneMgr mgr, Asteroid asteroid)
        {
            ParticleNode effects = new ParticleNode(mgr, IdMgr.GetNewId(mgr.GetCurrentPlayer().GetId()));

            effects.AddControl(new CenterCloneControl(asteroid));
            effects.AddControl(new DirectionCloneControl(asteroid));
            effects.AddControl(new DirectionDrivenRotationControl());
            effects.AddControl(new AsteroidBurningControl(asteroid));
            return(effects);
        }
コード例 #15
0
        public static OrbitEllipse CreateOrbitEllipse(SceneMgr mgr, Vector position, float radiusX, float radiusY, Color color)
        {
            OrbitEllipse ellipse = new OrbitEllipse(mgr, IdMgr.GetNewId(mgr.GetCurrentPlayer().GetId()), radiusX, radiusY);

            ellipse.Position = position;
            ellipse.Color    = color;
            ellipse.SetGeometry(SceneGeometryFactory.CreateConstantColorEllipseGeometry(ellipse));

            return(ellipse);
        }
コード例 #16
0
        public static IceShard CreateIceShard(SceneMgr mgr, Vector position, Size size, int texture)
        {
            IceShard s = new IceShard(mgr, IdMgr.GetNewId(mgr.GetCurrentPlayer().GetId()));

            s.Size      = size;
            s.Position  = position;
            s.TextureId = texture;
            s.SetGeometry(SceneGeometryFactory.CreateIceShard(s));

            return(s);
        }
コード例 #17
0
        public static ParticleEmmitor CreateBasicSphere(SceneMgr mgr, Color color)
        {
            ParticleEmmitor e = new ParticleEmmitor(mgr, IdMgr.GetNewId(0));

            ParticleSphereFactory f = new ParticleSphereFactory();

            f.Color   = color;
            e.Factory = f;

            return(e);
        }
コード例 #18
0
        public static IceSquare CreateIceSquare(SceneMgr mgr, Vector position, Size size)
        {
            IceSquare s = new IceSquare(mgr, IdMgr.GetNewId(mgr.GetCurrentPlayer().GetId()));

            s.Size     = size;
            s.Position = position;
            s.Category = DrawingCategory.BACKGROUND;
            s.SetGeometry(SceneGeometryFactory.CreateIceCube(s));

            return(s);
        }
コード例 #19
0
        public static ParticleEmmitor CreateBasicShockwave(SceneMgr mgr, Color color)
        {
            ParticleEmmitor e = new ParticleEmmitor(mgr, IdMgr.GetNewId(0));

            ParticleImageFactory f = new ParticleImageFactory();

            f.Color      = color;
            f.RenderSize = 100;
            f.Source     = new Uri("pack://application:,,,/resources/images/particles/explosion-particle.png");
            e.Factory    = f;

            return(e);
        }
コード例 #20
0
        public static Asteroid CreateNewRandomAsteroid(ServerMgr mgr, bool headingRight)
        {
            Random randomGenerator = mgr.GetRandomGenerator();

            Asteroid s;
            int      chance = randomGenerator.Next(100);

            if (chance <= SharedDef.ASTEROID_GOLD_CHANCE)
            {
                s = new Asteroid(null, IdMgr.GetNewId(0));
                s.AsteroidType = AsteroidType.GOLDEN;
                s.TextureId    = randomGenerator.Next(1, 6);
                s.Radius       = randomGenerator.Next(SharedDef.MIN_ASTEROID_RADIUS, SharedDef.MAX_ASTEROID_RADIUS);
                s.Gold         = (s.Radius / 2) * SharedDef.GOLD_ASTEROID_BONUS_MULTIPLY;
            }
            else if (chance <= SharedDef.ASTEROID_UNSTABLE_CHANCE)
            {
                s = new UnstableAsteroid(null, IdMgr.GetNewId(0));
                s.AsteroidType = AsteroidType.UNSTABLE;
                s.TextureId    = randomGenerator.Next(1, 6);
                s.Radius       = randomGenerator.Next(SharedDef.MIN_ASTEROID_RADIUS, SharedDef.MAX_ASTEROID_RADIUS);
                s.Gold         = s.Radius / 2;
            }
            else
            {
                s = new Asteroid(null, IdMgr.GetNewId(0));
                s.AsteroidType = AsteroidType.NORMAL;
                s.TextureId    = randomGenerator.Next(1, 18);
                s.Radius       = randomGenerator.Next(SharedDef.MIN_ASTEROID_RADIUS, SharedDef.MAX_ASTEROID_RADIUS);
                s.Gold         = s.Radius / 2;
            }

            s.IsHeadingRight = headingRight;
            s.Direction      = headingRight ? new Vector(1, 0) : new Vector(-1, 0);

            s.Position = GetRandomPositionInOrbitArea(randomGenerator, s.Radius);
            s.Color    = Color.FromRgb((byte)randomGenerator.Next(40, 255), (byte)randomGenerator.Next(40, 255), (byte)randomGenerator.Next(40, 255));
            s.Rotation = mgr.GetRandomGenerator().Next(360);

            SphereCollisionShape cs = new SphereCollisionShape();

            cs.Center        = s.Center;
            cs.Radius        = s.Radius;
            s.CollisionShape = cs;

            CreateAsteroidControls(mgr, s);

            return(s);
        }
コード例 #21
0
        private void InitNewLink(IContainsGold obj)
        {
            StretchingLineControl stretchingControl = new StretchingLineControl();

            stretchingControl.FirstObj  = me;
            stretchingControl.SecondObj = obj;

            Line line = new Line(sceneMgr, IdMgr.GetNewId(sceneMgr.GetCurrentPlayer().GetId()), me.Position, obj.Position, Colors.Black, 1);

            line.AddControl(stretchingControl);
            line.AddControl(new MiningLineControl());

            sceneMgr.DelayedAttachToScene(line);
            CurrentlyMining.Add(new MiningObject(obj, line));
        }
コード例 #22
0
        public void ShowForceFieldEffect()
        {
            ForcePullField f = new ForcePullField(me.SceneMgr, IdMgr.GetNewId(hook.Owner.GetId()));

            f.Radius              = (int)hook.Owner.Data.HookActivePullReachDistance;
            f.Position            = new Vector(me.Center.X - f.Radius, me.Center.Y - f.Radius);
            f.HeavyWeightGeometry = HeavyweightGeometryFactory.CreateForceField(f);

            f.AddControl(new CenterCloneControl(me));
            float life = 0.3f; // seconds

            f.AddControl(new LimitedLifeControl(life));
            f.AddControl(new ShrinkingControl(0, life));

            me.SceneMgr.DelayedAttachToScene(f);
        }
コード例 #23
0
        public static SphereField CreateSphereField(SceneMgr mgr, Vector position, int radius, Color color)
        {
            SphereField f = new SphereField(mgr, IdMgr.GetNewId(mgr.GetCurrentPlayer().GetId()));

            f.Radius              = radius;
            f.Color               = color;
            f.Position            = position;
            f.HeavyWeightGeometry = HeavyweightGeometryFactory.CreateConstantColorEllipseGeometry(f);

            SphereCollisionShape shape = new SphereCollisionShape();

            shape.Radius     = radius;
            shape.Center     = f.Center;
            f.CollisionShape = shape;

            return(f);
        }
コード例 #24
0
        private void StartAnimation(Asteroid target, float time, Color color, bool towardsMe)
        {
            this.time = time;

            if (target == null)
            {
                return;
            }

            Line            line   = new Line(action.action.Owner.SceneMgr, IdMgr.GetNewId(action.action.Owner.GetId()), action.action.Owner.Device.Position, target.Position, color, 1);
            HeavyweightLine strong = new HeavyweightLine(action.action.SceneMgr, IdMgr.GetNewId(action.action.Owner.GetId()), action.action.Owner.Device.Position, target.Position, color, 2);

            //OrbitEllipse s = SceneObjectFactory.CreateOrbitEllipse(Owner.SceneMgr, Owner.Device.Position, 3, 3, color);

            StretchingLineControl c  = new StretchingLineControl();
            TimeStretchingControl tc = new TimeStretchingControl();

            tc.Time = time;
            if (towardsMe)
            {
                c.SecondObj  = target;
                c.FirstObj   = action.action.Owner.Device;
                tc.FirstObj  = target;
                tc.SecondObj = action.action.Owner.Device;
            }
            else
            {
                c.FirstObj   = target;
                c.SecondObj  = action.action.Owner.Device;
                tc.SecondObj = target;
                tc.FirstObj  = action.action.Owner.Device;
            }

            //LineTravelingControl tc = new LineTravelingControl();
            //tc.TravellingTime = time;
            //tc.LineToFollow = line;

            line.AddControl(c);
            line.AddControl(new LimitedLifeControl(time));
            strong.AddControl(tc);
            strong.AddControl(new LimitedLifeControl(time));

            action.action.Owner.SceneMgr.DelayedAttachToScene(line);
            action.action.Owner.SceneMgr.DelayedAttachToScene(strong);
        }
コード例 #25
0
        public void SpawnAsteroid()
        {
            if (AsteroidSpawned)
            {
                return;
            }

            AsteroidSpawned = true;
            me.RemoveControlsOfType <HighlightingControl>();

            Asteroid ast = new Asteroid(me.SceneMgr, IdMgr.GetNewId(me.SceneMgr.GetCurrentPlayer().GetId()));

            ast.Gold      = 0;
            ast.Radius    = 20;
            ast.Position  = new Vector(me.Position.X - ast.Radius, me.Position.Y - ast.Radius);
            ast.Direction = (me as IMovable).Direction;

            ast.AsteroidType = AsteroidType.NORMAL;
            ast.TextureId    = me.SceneMgr.GetRandomGenerator().Next(1, 18);

            SphereCollisionShape cs = new SphereCollisionShape();

            cs.Center          = ast.Center;
            cs.Radius          = ast.Radius;
            ast.CollisionShape = cs;

            ast.SetGeometry(SceneGeometryFactory.CreateAsteroidImage(ast));

            me.SceneMgr.DelayedAttachToScene(ast);

            collided.Add(ast.Id);

            ast.AddControl(new StickySphereCollisionShapeControl());

            NewtonianMovementControl nmc = new NewtonianMovementControl();

            nmc.Speed = me.SceneMgr.GetCurrentPlayer().Data.MineFallingSpeed;
            ast.AddControl(nmc);

            NetOutgoingMessage msg = me.SceneMgr.CreateNetMessage();

            ast.WriteObject(msg);

            me.SceneMgr.SendMessage(msg);
        }
コード例 #26
0
        public static BaseIntegrityBar CreateBaseIntegrityBar(SceneMgr mgr, Player owner)
        {
            BaseIntegrityBar arc = new BaseIntegrityBar(mgr, IdMgr.GetNewId(mgr.GetCurrentPlayer().GetId()));
            Color            c   = owner.GetPlayerColor();

            c.A           = 0x55;
            arc.Color     = c;
            arc.FullAngle = (float)Math.PI;
            arc.Width     = (float)owner.Baze.Size.Width / 2 + 2;
            arc.Height    = (float)owner.Baze.Size.Height + 3; //hack kvuli neeliptickym rozmerum baze

            arc.Position   = owner.Baze.Position + (new Vector(owner.Baze.Size.Width / 2, owner.Baze.Size.Height));
            arc.StartPoint = new Point(0, owner.Baze.Size.Height + 3);

            arc.SetGeometry(SceneGeometryFactory.CreateArcSegments(arc));

            return(arc);
        }
コード例 #27
0
        public static AsteroidOverlay CreateAsteroidOverlay(SceneMgr mgr, Asteroid parent)
        {
            AsteroidOverlay ao = new AsteroidOverlay(mgr, IdMgr.GetNewId(mgr.GetCurrentPlayer().GetId()));

            ao.Radius   = parent.Radius;
            ao.Position = parent.Position;
            ao.Rotation = parent.Rotation;

            ao.AddControl(new PositionCloneControl(parent, true));
            ao.AddControl(new RotationCloneControl(parent));
            ao.AddControl(new RadiusCloneControl(parent));

            ao.AddControl(new OverlayControl(parent));

            ao.SetGeometry(SceneGeometryFactory.CreateAsteroidImage(parent, true));

            return(ao);
        }
コード例 #28
0
        public static MiningModule CreateMiningModule(SceneMgr mgr, Vector position, Player owner)
        {
            MiningModule module = new MiningModule(mgr, IdMgr.GetNewId(mgr.GetCurrentPlayer().GetId()), owner);

            module.Position = position;
            module.Radius   = 10;
            module.Color    = Colors.Crimson;


            ModuleDamageControl mc = new ModuleDamageControl();

            mc.MaxHp = SharedDef.SPECTATOR_MAX_HP;
            module.AddControl(mc);

            SphereCollisionShape cs = new SphereCollisionShape();

            cs.Center             = module.Center;
            cs.Radius             = module.Radius;
            module.CollisionShape = cs;

            ControlableDeviceControl dc = new ControlableMiningModuleControl();

            module.AddControl(dc);

            LinearRotationControl rc = new LinearRotationControl();

            rc.RotationSpeed = SharedDef.SPECTATOR_MODULE_ROTATION_SPEED;
            module.AddControl(rc);

            HpRegenControl hc = new HpRegenControl();

            hc.MaxRegenTime = SharedDef.SPECTATOR_HP_REGEN_CD;
            hc.RegenTimer   = SharedDef.SPECTATOR_HP_REGEN_CD;
            hc.RegenSpeed   = SharedDef.SPECTATOR_REGEN_SPEED;
            module.AddControl(hc);

            module.AddControl(new RespawningObjectControl());
            module.AddControl(new StickySphereCollisionShapeControl());

            module.SetGeometry(SceneGeometryFactory.CrateMiningModule(module));

            return(module);
        }
コード例 #29
0
        public static MiningModuleIntegrityBar CreateMiningModuleIntegrityBar(SceneMgr mgr, MiningModule module, Player owner)
        {
            MiningModuleIntegrityBar arc = new MiningModuleIntegrityBar(mgr, IdMgr.GetNewId(mgr.GetCurrentPlayer().GetId()));

            arc.Color  = owner.Data.SpecialColor;
            arc.Radius = module.Radius + 5;

            CenterCloneControl pControl = new CenterCloneControl(module);

            arc.AddControl(pControl);

            HpBarControl hControl = new HpBarControl(arc);

            module.AddControl(hControl);

            arc.SetGeometry(SceneGeometryFactory.CreateArcSegments(arc));

            return(arc);
        }
コード例 #30
0
        public static ISceneObject SpectatorActionReadinessIndicator(ISpectatorAction a, MiningModule parent, double rotation, Color begin, Color end, Color stroke)
        {
            SimpleSphere s = new SimpleSphere(a.SceneMgr, IdMgr.GetNewId(a.SceneMgr.GetCurrentPlayer().GetId()));

            s.Color    = a.CastingColor;
            s.Radius   = 6;
            s.Category = DrawingCategory.PLAYER_OBJECTS;

            Vector offset = new Vector(parent.Radius + 15, 0).Rotate(rotation);

            s.SetGeometry(SceneGeometryFactory.CreateRadialGradientEllipseGeometry(a.SceneMgr, s.Radius, begin, end, stroke, parent.Center + offset, 1));

            CenterCloneControl ccc = new CenterCloneControl(parent);

            ccc.Offset = offset;
            s.AddControl(ccc);

            return(s);
        }