Example #1
0
 public static Vector2 GetCollisionCenter(Node node)
 {
     Bounds2 bounds = new Bounds2 ();
     node.GetlContentLocalBounds (ref bounds);
     Vector2 center = node.LocalToWorld (bounds.Center);
     return center;
 }
        //        protected Label inside;
        public ScorePopup(Node pParent, int pPoints)
            : base(pPoints.ToString(), map)
        {
            parent = pParent;
            if (pPoints < 10) {
                offset = DoubleDigitOffset;
            } else {
                offset = SingleDigitOffset;
            }
            //			velocity = Vector2.Zero;
            Position = parent.LocalToWorld(parent.Position) + offset;
            //			this.RegisterPalette(0);
            Color = Support.ExtractColor("333330");
            Pivot = new Vector2(0.5f, 0.5f);
            //			HeightScale = 1.0f;

            //			inside = new Label() {
            //				Text = pPoints.ToString(),
            //				FontMap = map,
            //				Pivot = Vector2.One/2.0f,
            ////				Position = Vector2.One
            ////				Scale = new Vector2(0.9f, 0.9f)
            //			};
            //			inside.Color = LevelManager.Instance.BackgroundColor;
            //			this.AddChild(inside);

            Sequence sequence = new Sequence();
            sequence.Add( new DelayTime( 0.1f ) );
            GameScene.Layers[2].AddChild(this);
            sequence.Add( new CallFunc( () => {
                Scheduler.Instance.ScheduleUpdateForTarget(this,0,false);
            } ) );
            this.RunAction(sequence);

            #if DEBUG
            Console.WriteLine (GetType().ToString() + " created" );
            #endif
        }