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));
        }
Esempio n. 2
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);
        }