private void UpdateAlpha() { //Console.WriteLine("_alpha: " + _alpha); _clearColor = Color.FromArgb(_alpha, _clearColor); _easyDraw.Clear(_clearColor); _easyDraw.Fill(_mainColor, _alpha); _easyDraw.Text(_text, _textX, _textY); }
void Update() { if (!this.Enabled) { return; } _aimDistance = TransformPoint(_crossHair.Pos.x, _crossHair.Pos.y) - _pos; _easyDrawDebug.SetActive(MyGame.Debug); if (MyGame.Debug) { _easyDrawDebug.Clear(Color.FromArgb(200, 1, 1, 1)); _easyDrawDebug.Fill(Color.White); _easyDrawDebug.Stroke(Color.Aquamarine); string str = $"state: {_state.ToString()}"; _easyDrawDebug.Text(str, 4, 30); CanvasDebugger2.Instance.DrawEllipse(x, y, _scanEnemyRange * 2, _scanEnemyRange * 2, Color.Brown); } }
public FogSystemManager(MCamera pCam, GameObject pTarget) : base(false) { _lightAlpha = new Bitmap("data/player_light_grid_map.png"); _lightSprite = new Sprite("data/player_light_grid_map.png", false, false); _brushes = new Brush[4]; SetBrushes(HatchStyle.Cross); _bg = new EasyDraw(game.width, game.height); pCam.AddChild(_bg); _bg.SetOriginToCenter(); _bg.Clear(Color.FromArgb(100, Color.Black)); _cam = pCam; _mainTarget = pTarget; string[] hatchesStrs = new string[51]; for (int i = 0; i < 51; i++) { var hatchStyle = (HatchStyle)i; hatchesStrs[i] = hatchStyle.ToString(); } hatchesStrs = hatchesStrs.OrderBy(h => h).ToArray(); _hatchStyles = new HatchStyle[51]; for (int i = 0; i < _hatchStyles.Length; i++) { var hatchStyle = Enum.Parse(typeof(HatchStyle), hatchesStrs[i]); _hatchStyles[i] = (HatchStyle)hatchStyle; } Console.WriteLine($"{this}: {string.Join("\r\n", _hatchStyles)}"); }
void Update() { //_bg.graphics.CompositingMode = CompositingMode.SourceOver; _bg.Clear(Color.FromArgb(255, Color.Black)); var localPos = _bg.InverseTransformPoint(_mainTarget.x, _mainTarget.y); float localX = localPos.x + MyGame.HALF_SCREEN_WIDTH; float localY = localPos.y + MyGame.HALF_SCREEN_HEIGHT; _bg.graphics.CompositingMode = CompositingMode.SourceCopy; _lightSprite.SetXY(localX, localY); _bg.DrawSprite(_lightSprite); DrawLight(Input.mouseX, Input.mouseY); //DrawLight(localX, localY); localPos = _bg.InverseTransformPoint(2792, 3995); DrawLight(localPos.x + MyGame.HALF_SCREEN_WIDTH, localPos.y + MyGame.HALF_SCREEN_HEIGHT); //_bg.graphics.DrawImage(_lightAlpha, Input.mouseX, Input.mouseY); if (Input.GetKeyDown(Key.V)) { hatchIndex = GeneralTools.GetCircularArrayIndex(hatchIndex - 1, _hatchStyles.Length); SetBrushes(_hatchStyles[hatchIndex]); Console.WriteLine(_hatchStyles[hatchIndex]); } else if (Input.GetKeyDown(Key.B)) { hatchIndex = GeneralTools.GetCircularArrayIndex(hatchIndex + 1, _hatchStyles.Length); SetBrushes(_hatchStyles[hatchIndex]); Console.WriteLine(_hatchStyles[hatchIndex]); } }
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 void UpdateString(string text) { if (text == null) { return; } textContainer.Clear(Color.Transparent); textContainer.Fill(0, 0, 0); textContainer.Text(text, textContainer.width / 2, textContainer.height / 2); }
protected void Update() { _rectProximityInfo.Clear(Color.Transparent); _proximityInfo.Clear(Color.Transparent); _clock.Clear(Color.Transparent); ShowProximityInfo(); drawClock(); //PlayMusic(); if (Input.GetMouseButtonDown(0)) { RemoveChild(tutorial); } }
void Update() { if (!this.Enabled) { return; } if (_frameTimer >= _FrameSpeed) { SetFrame(++_frameNumber % frameCount); _frameTimer = 0; } _frameTimer += Time.deltaTime; for (int i = 0; i < _onUpdateListeners.Length; i++) { _onUpdateListeners[i].OnUpdate(this, 1); } if (_state == DroneState.END_LEVEL) { _distanceToTarget = _enemy.Pos - _pos; } _easyDrawDebug.visible = MyGame.Debug; if (MyGame.Debug) { // if (_id == 1) // { // Console.WriteLine($"========================"); // Console.WriteLine($"========================"); // Console.WriteLine($"\t{string.Join(Environment.NewLine + "\t", _iesDebug)}"); // } _easyDrawDebug.Clear(Color.FromArgb(200, 1, 1, 1)); _easyDrawDebug.Fill(Color.White); _easyDrawDebug.Stroke(Color.Aquamarine); string str = $"state: {_state.ToString()}"; _easyDrawDebug.Text(str, 4, 30); CanvasDebugger2.Instance.DrawEllipse(x, y, _detectEnemyRange * 2, _detectEnemyRange * 2, Color.Brown); CanvasDebugger2.Instance.DrawEllipse(x, y, _stopChasingRange * 2, _stopChasingRange * 2, Color.DarkGreen); DrawBoundBox(); } }
public HudScore(string filename) : base(filename, false, false) { //Hud score text //"VAGRundschriftD" _scoreLabelEasyDraw = new EasyDraw(350, 40, false); AddChild(_scoreLabelEasyDraw); //78 115 _scoreLabelEasyDraw.SetXY(60, 70); _scoreLabelEasyDraw.Clear(Color.FromArgb(1, 1, 1, 1)); _scoreLabelEasyDraw.TextFont($"data/VAGRundschriftD.ttf", 32); _scoreLabelEasyDraw.Fill(Color.White); _scoreLabelEasyDraw.TextAlign(CenterMode.Min, CenterMode.Min); _scoreLabelEasyDraw.Text($"{_score:00000000000000}", 0, 0); //"00000000000000" 14 digits }
public void ToogleDebug() { _debugColl = game.GetChildren().FirstOrDefault(g => g.name == "Debug_Coll") as EasyDraw; if (_debugColl == null) { _debugColl = new EasyDraw(2, 2, false) { name = "Debug_Coll" }; _debugColl.CentralizeOrigin(); _debugColl.Clear(Color.GreenYellow); game.AddChild(_debugColl); } else { _debugColl?.Destroy(); } _debugPOI = game.GetChildren().FirstOrDefault(g => g.name == "Debug_POI") as EasyDraw; if (_debugPOI == null) { _debugPOI = new EasyDraw(9, 9, false) { name = "Debug_POI" }; _debugPOI.CentralizeOrigin(); _debugPOI.Clear(Color.FromArgb(50, Color.Red)); game.AddChild(_debugPOI); } else { _debugPOI?.Destroy(); } _debugNormalPOI = game.GetChildren().FirstOrDefault(g => g.name == "Debug_Normal_POI") as Arrow; if (_debugNormalPOI == null) { _debugNormalPOI = new Arrow(Vector2.zero, Vector2.one, 100, (uint)Color.HotPink.ToArgb()) { name = "Debug_Normal_POI" }; game.AddChild(_debugNormalPOI); } else { _debugNormalPOI?.Destroy(); } }
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); }
void Update() { uiEasyDraw.Clear(0); uiEasyDraw.Text(_scoreText + "\n" + _timerText, 50, 50); }