Initialise() публичный Метод

public Initialise ( ) : void
Результат void
Пример #1
0
        public virtual void Move()
        {
            if (!Collide())
            {
                hypotenuse = Vector2.Distance(this.Position, core.Position);
                x = core.Position.X - this.Position.X;
                y = core.Position.Y - this.Position.Y;

                Position = new Vector2(2 * (x / hypotenuse) + Position.X, 2 * (y / hypotenuse) + Position.Y);
                //move with gravity
            }
            else
            {
                FixedBall f = new FixedBall(core, colour);
                f.Initialise(size, Position);
                f.LoadGraphicsContent(spriteBatch, texture);
                core.addBall(f);
                live = false;
            }
        }
Пример #2
0
        /*
         * Move towards the core
         */
        public virtual void Move()
        {
            if (colourTexture == null)
            {
                colourTexture = texture;
            }
            SwitchBlack();
            if (toFollow == null)
            {
                if (!Collide())
                {
                    oldPosition = Position;
                    hypotenuse = Vector2.Distance(this.Position, core.Position);
                    x = core.Position.X - this.Position.X;
                    y = core.Position.Y - this.Position.Y;

                    Position = new Vector2(2 * (x / hypotenuse) + Position.X, 2 * (y / hypotenuse) + Position.Y);
                    //move with gravity
                }
                else
                {
                    FixedBall f = new FixedBall(core, colour);
                    f.Initialise(size, Position, game);
                    if (collisionBall == null)
                    {
                        f.SetAgainstCore();
                        f.DoAngles();
                    }
                    else
                    {
                        f.CorrectPostion(collisionBall);
                        f.DoAngles();
                        f.AddSupport(collisionBall);
                        f.SetCollisionBall(collisionBall);
                    }
                    f.UpdateContactBalls();
                    f.LoadGraphicsContent(spriteBatch, colourTexture);
                    core.AddBall(f);
                    live = false;
                }
            }
            else
            {
                if (!Collide())
                {
                    Position += (toFollow.Position - toFollow.oldPosition);
                }
                else
                {
                    FixedBall f = new FixedBall(core, colour);
                    f.Initialise(size, Position, game);
                    if (collisionBall == null)
                    {
                        f.SetAgainstCore();
                        f.DoAngles();
                    }
                    else
                    {
                        f.CorrectPostion(collisionBall);
                        f.DoAngles();
                        f.AddSupport(collisionBall);
                        f.SetCollisionBall(collisionBall);
                    }
                    f.UpdateContactBalls();
                    f.LoadGraphicsContent(spriteBatch, colourTexture);
                    core.AddBall(f);
                    live = false;
                }
            }
        }