Exemple #1
0
        private void SendActionStart(ISpectatorAction action)
        {
            NetOutgoingMessage msg = action.Owner.SceneMgr.CreateNetMessage();

            msg.Write((int)PacketType.SPECTATOR_ACTION_START);

            msg.Write(action.Owner.GetId());
            msg.Write(action.Name);

            action.Owner.SceneMgr.SendMessage(msg);
        }
 public SpectatorActionController(SceneMgr mgr, ISpecialAction action)
     : base(mgr, action)
 {
     if (action is ISpectatorAction)
     {
         this.spectatorAction = action as ISpectatorAction;
     }
     else
     {
         throw new Exception("Spectator action controller must be initated with Spectator action");
     }
 }
Exemple #3
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);
        }
Exemple #4
0
        public static void CreateSpectatorActionReadinessIndicators(Player p)
        {
            List <ISpecialAction> actions = p.GetActions <ISpectatorAction>();

            for (int i = 0; i < actions.Count; ++i)
            {
                ISpectatorAction a        = (ISpectatorAction)actions[i];
                double           rotation = ((2 * Math.PI / actions.Count) * i) + Math.PI / (actions.Count * 2) + Math.PI;

                SpectatorActionIndicatorControl saic = new SpectatorActionIndicatorControl();
                saic.Action    = a;
                saic.Indicator = SceneObjectFactory.SpectatorActionReadinessIndicator(a, p.Device, rotation, Colors.Transparent, a.CastingColor, Colors.Transparent);
                Color strokeColor = a.CastingColor;
                strokeColor.A       = 0x60;
                saic.ExactIndicator = SceneObjectFactory.SpectatorActionReadinessIndicator(a, p.Device, rotation, Colors.Transparent, Colors.Transparent, strokeColor);

                p.SceneMgr.DelayedAttachToScene(saic.Indicator);
                p.SceneMgr.DelayedAttachToScene(saic.ExactIndicator);

                p.Device.AddControl(saic);
            }
        }