public HudSlider(int width, int height, float startValue = 1.0f, bool addCollider = true) : base(width, height, addCollider) { Clear(Color.DarkGray); _fore = new EasyDraw(width - 4, height - 4, false); _fore.SetOrigin(0, -_fore.height / 2f); _fore.Clear(Color.LightGray); AddChild(_fore); _fore.x = 2; _fore.y = -_fore.height * 0.5f + 2; _thumb = new EasyDraw(10, height, false); _thumb.Clear(Color.Aqua); _thumb.Fill(Color.White); _thumb.Stroke(Color.Black); _thumb.ShapeAlign(CenterMode.Min, CenterMode.Min); _thumb.Rect(0, 0, _thumb.width - 1, height - 1); AddChild(_thumb); _thumb.x = 0; _thumb.y = 0; _thumb.SetOrigin(_thumb.width * 0.5f, 0); }
public HunterGameObject(float pX, float pY, float pWidth, float pHeight, float pSightSpeed = 200) : base("data/Hunter.png", 1, 1, -1, false, false) { _scanEnemyRange = pWidth; _sightSpeed = pSightSpeed; _hunterBehaviorListeners = new IHunterBehaviorListener[0]; SetOrigin(0, height); x = pX + pWidth * 0.5f; y = pY - pHeight * 0.5f; SetOrigin(width * 0.5f, height * 0.5f); _crossHair = new HunterCrossHairGameObject(this); AddChild(_crossHair); _crossHair.SetXY(0, 0); _crossHair.alpha = 0; _hunterFollowRangeCone = new HunterFollowRangeCone(this); _hunterFollowRangeCone.SetColor(0.9f, 0.9f, 0); _hunterFollowRangeCone.alpha = 0; AddChild(_hunterFollowRangeCone); _easyDrawDebug = new EasyDraw(200, 80, false); _easyDrawDebug.SetOrigin(0, _easyDrawDebug.height * 0.5f); //_easyDrawDebug.Clear(Color.Black); AddChild(_easyDrawDebug); _easyDrawDebug.TextFont("data/Gaiatype.ttf", 8); _easyDrawDebug.x = 0; _easyDrawDebug.y = -40; CoroutineManager.StartCoroutine(WaitForEnemySet(), this); }
public DroneGameObject(float pX, float pY, float pWidth, float pHeight, float pSpeed = 200, float pRotation = 0) : base( "data/Drone spritesheet small.png", 2, 2, 4, false, true) { _id = ++IdCounter; name = $"{this}_{_id}"; _customColliderBounds = new Rectangle(-27, -24, 53, 50); _maxSpeed = pSpeed; float originalWidth = width; float originalHeight = height; SetOrigin(0, height); float lScaleX = pWidth / width; float lScaleY = pHeight / height; SetScaleXY(lScaleX, lScaleY); x = pX; // + width / 2; y = pY; // - height + height / 2f; SetOrigin(originalWidth / 2f, originalHeight / 2f); Turn(pRotation); x = pX + Mathf.Cos(rotation.DegToRad()) * width * 0.5f; y = pY + Mathf.Sin(rotation.DegToRad()) * width * 0.5f; var pos = new Vector2(x - pX, y - pY); var perp = new Vector2(pos.y, -pos.x).Normalized; pos = perp * height * 0.5f; SetScaleXY(1, 1); x += pos.x; y += pos.y; _startPosition = new Vector2(x, y); _ledSprite = new AnimationSprite("data/Drone White Led.png", 1, 1, -1, false, false); _ledSprite.SetOrigin(width * 0.5f, height * 0.5f); _ledOffSprite = new AnimationSprite("data/Drone Gray Led.png", 1, 1, -1, false, false); _ledOffSprite.SetOrigin(width * 0.5f, height * 0.5f); _ledSprite.SetColor(0, 1f, 0); AddChild(_ledOffSprite); AddChild(_ledSprite); _droneFollowRangeCone = new DroneFollowRangeCone(this); _droneFollowRangeCone.SetColor(0.9f, 0.9f, 0); _droneFollowRangeCone.alpha = 0; AddChild(_droneFollowRangeCone); _easyDrawDebug = new EasyDraw(200, 80, false); _easyDrawDebug.SetOrigin(0, _easyDrawDebug.height * 0.5f); _easyDrawDebug.Clear(Color.Black); AddChild(_easyDrawDebug); _easyDrawDebug.TextFont("data/Gaiatype.ttf", 8); _easyDrawDebug.x = 0; _easyDrawDebug.y = -40; CoroutineManager.StartCoroutine(WaitForEnemyLoad(), this); }