コード例 #1
0
        public StationOnBuilding(Texture2D first, Texture2D second, Texture2D third, Texture2D fourth, Vector2 position, Vector2 scale, ProgressBar progress, int hp)
        {
            FirstStageTexture = first;
            SecondStageTexture = second;
            ThirdStageTexture = third;
            FourthStageTexture = fourth;
            CurrentTexture = FirstStageTexture;
            Position = position;
            Scale = scale;
            FinalWidth = Position.X + CurrentTexture.Width * Scale.X;
            FinalHeight = Position.Y + CurrentTexture.Height * Scale.Y;
            IsVisible = true;

            MaxHP = HP = hp;

            this.progress = progress;

            Query = new ProductQuery();
            Query.IsVisible = true;
            Query.Add(new GameTimer(Progress, 0.1f, () =>
                {
                    Progress.PWidth = 0;
                    if (OnBuildingComplete != null)
                    {
                        OnBuildingComplete(this);
                    }
                }, null));
        }
コード例 #2
0
 public Planet(Texture2D texture, Vector2 scale, int radius, float interval, float degrees, Star centerStar, int terraform, Texture2D alphaTexture)
 {
     position = new Vector2();
     Counter = degrees * 10;
     position.X = (float)((centerStar.CenterX) + radius * Math.Cos(Counter / 10 * Math.PI / 180) - ((texture.Width * scale.X) / 2));
     position.Y = (float)((centerStar.CenterY) + radius * Math.Sin(Counter / 10 * Math.PI / 180) - ((texture.Height * scale.Y) / 2));
     Scale = scale;
     FinalWidth = position.X + texture.Width * scale.X;
     FinalHeight = position.Y + texture.Height * scale.Y;
     Radius = radius;
     Interval = interval;
     CenterStar = centerStar;
     this.terraform = terraform;
     Owner = "Unknown";
     Race = "No race";
     Texture = texture;
     Origin = new Vector2(texture.Width / 2, texture.Height / 2);
     Query = new ProductQuery();
     PositionFromCenter = Vector2.Zero;
     IsPressed = false;
     Rotation = 0;
     ShipsOnOrbit = new List<Ship>();
     IsVisible = true;
     IsTerraforming = false;
 }