コード例 #1
0
        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)}");
        }
コード例 #2
0
ファイル: HudSlider.cs プロジェクト: vlab22/Team23_GXPEngine
        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);
        }
コード例 #3
0
        public HUD()
        {
            //Font
            PFC = new PrivateFontCollection();
            PFC.AddFontFile(@"kenyan_coffee_rg.ttf");
            _ownFontClock = new Font(PFC.Families[0], 32);
            _ownFontText  = new Font(PFC.Families[0], 32);

            //Proximity information
            _rectProximityInfo       = new EasyDraw(1920, 1080, addCollider: false);
            _rectProximityInfo.alpha = 0.9f;
            _rectProximityInfo.color = 0x262626;
            AddChild(_rectProximityInfo);

            _proximityInfo       = new EasyDraw(1920, 1080, addCollider: false);
            _proximityInfo.color = 0x56b25d;
            _proximityInfo.TextFont(_ownFontText);

            _textOnceAdded = false;

            //Clock Background
            _clockBackground = new Sprite("timeBackground.png");
            _clockBackground.SetXY(5, 15);
            AddChild(_clockBackground);

            //Clock
            _clock       = new EasyDraw(1920, 1080, addCollider: false);
            _clock.color = 0x56b25d;
            _clock.TextFont(_ownFontClock);
            AddChild(_clock);

            //Shopping list
            _shoppingList       = new Sprite("List.png");
            _shoppingList.scale = 0.65f;
            _shoppingList.SetXY(_shoppingList.width / 2.5f, 300);
            _shoppingList.SetOrigin(_shoppingList.width / 2, _shoppingList.height / 2);
            AddChild(_shoppingList);

            //Settings button
            _settingsButton = new Sprite("settingsButton.png");
            _settingsButton.SetXY(225, 13);
            AddChild(_settingsButton);

            //Chatbox
            _chatBox = new Sprite("chatBox.png");
            _chatBox.SetOrigin(_chatBox.width / 2, _chatBox.height / 2);
            _chatBox.SetXY(game.width / 2, game.height - 50);
            AddChild(_chatBox);

            //Sound
            _backgroundMusic     = new Sound("backgroundSounds.mp3", true, true);
            _backgroundSC        = _backgroundMusic.Play();
            _backgroundSC.Volume = 0.35f;

            //Tutorial
            tutorial = new Sprite("Tutorial.png");
            tutorial.SetOrigin(tutorial.width / 2, tutorial.height / 2);
            tutorial.SetXY(game.width / 2, game.height / 2);
            AddChild(tutorial);
        }
コード例 #4
0
ファイル: UICanvas.cs プロジェクト: Matioma/Pitfall-1982
 UICanvas()
 {
     healthBarSpriteSheet = new AnimationSprite("HealthSpriteSheet.png", 1, 3);
     healthBarSpriteSheet.SetXY(game.width - 250, 50);
     AddChild(healthBarSpriteSheet);
     uiEasyDraw = new EasyDraw(150, 60);
     AddChild(uiEasyDraw);
 }
コード例 #5
0
        public HudTextBoard(string pText, float px, float py, int width, int height, int textSize,
                            CenterMode hor = CenterMode.Min,
                            CenterMode ver = CenterMode.Min)
        {
            this.x     = px;
            this.y     = py;
            this._text = pText;

            _easyDraw = new EasyDraw(width, height, false);
            _easyDraw.TextFont("data/Gaiatype.ttf", 12);

            if (!string.IsNullOrEmpty(pText))
            {
                _easyDraw.TextSize(textSize);
                _easyDraw.TextDimensions(_text, out var w, out var h);
                var wr = Mathf.Round(w);
                var hr = Mathf.Round(h);

                if (wr <= 0)
                {
                    wr = 10;
                }

                if (hr <= 0)
                {
                    hr = 10;
                }

                _easyDraw = new EasyDraw(wr, hr, false);
            }
            _easyDraw.TextFont("data/Gaiatype.ttf", 12);
            _easyDraw.TextSize(textSize);
            _easyDraw.TextAlign(hor, ver);

            AddChild(_easyDraw);

            if (hor == CenterMode.Center)
            {
                _textX = _easyDraw.width * 0.5f;
            }
            else if (hor == CenterMode.Max)
            {
                _textX = _easyDraw.width;
            }

            if (ver == CenterMode.Center)
            {
                _textY = _easyDraw.height * 0.5f;
            }
            else if (ver == CenterMode.Max)
            {
                _textY = _easyDraw.height;
            }


            SetText(_text);
        }
コード例 #6
0
        private void CreateBlankScreen()
        {
            var blankScreen = new EasyDraw(Game.main.width, Game.main.height);

            blankScreen.NoStroke();
            blankScreen.Fill(Color.Black);
            blankScreen.ShapeAlign(CenterMode.Min, CenterMode.Min);
            blankScreen.Rect(0, 0, blankScreen.width, blankScreen.height);
            AddChild(blankScreen);
        }
コード例 #7
0
        public Menu(string type, Color bgColor)
        {
            bg = new EasyDraw(game.width, game.height, false);
            bg.ShapeAlign(CenterMode.Min, CenterMode.Min);
            bg.Fill(bgColor);
            bg.Rect(0, 0, bg.width, bg.height);
            AddChild(bg);

            this.type = type;
            SetType(type);
        }
コード例 #8
0
 void InititalizeText(string text) //For text to overlay over the HUD
 {
     if (text == null)
     {
         return;
     }
     textContainer = new EasyDraw(ElementTexture.width, ElementTexture.height, false);
     textContainer.TextAlign(CenterMode.Center, CenterMode.Center);
     UpdateString(text);
     AddChild(textContainer);
 }
コード例 #9
0
ファイル: HudScore.cs プロジェクト: vlab22/Team23_GXPEngine
        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
        }
コード例 #10
0
ファイル: HudSlider.cs プロジェクト: vlab22/Team23_GXPEngine
        private IEnumerator Anim(EasyDraw fore)
        {
            int time = 0;

            while (true)
            {
                float scaleX = Easing.Ease(Easing.Equation.CubicEaseOut, time % 800, 0.01f, 1f, 800);

                fore.SetScaleXY(scaleX, 1);

                time += Time.deltaTime;

                yield return(null);
            }
        }
コード例 #11
0
        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();
            }
        }
コード例 #12
0
        public HudPointsPopUp() : base("+100", 0, 0, 50, 50, 18, CenterMode.Center, CenterMode.Center)
        {
            EasyDraw.TextFont("data/Chantal W00 Medium.ttf", 18);

            _shadowText = new HudTextBoard("+100", -1, -1, 50, 50, 18, CenterMode.Center, CenterMode.Center);
            _shadowText.EasyDraw.TextFont("data/Chantal W00 Medium.ttf", 18);
            _shadowText.SetClearColor(Color.FromArgb(0, 1, 1, 1));
            ((IHasColor)_shadowText).MainColor = GlobalVars.Skim;

            AddChild(_shadowText);

            _clearColor = Color.FromArgb(0, 1, 1, 1);
            ((IHasColor)this).MainColor = Color.DimGray;

            visible = false;
        }
コード例 #13
0
        public MeatStand(float givenX, float givenY, float givenRotation) : base(givenX, givenY, "MeatStand.png", givenRotation)
        {
            _buyMenu    = new Sprite("buyScreen.png");
            _buyMenu2   = new Sprite("buyScreen2.png");
            _exitButton = new Sprite("exitCross.png");
            _buyMenu.SetOrigin(_buyMenu.width / 2, _buyMenu.height / 2);
            _buyMenu.SetXY(game.width - _buyMenu.width + 150, game.height - _buyMenu.height + 150);
            _buyMenu2.SetOrigin(_buyMenu.width / 2, _buyMenu.height / 2);
            _buyMenu2.SetXY(game.width - _buyMenu.width + 150, game.height - _buyMenu.height + 150);
            _exitButton.SetXY(_buyMenu.x + 500, _buyMenu.y - 325);
            _menuShown = false;
            scale      = 0.85f;

            _boughtItem = new EasyDraw(1920, 1080);
            _boughtItem.TextSize(16);
            _boughtItem.SetColor(0, 0, 0);
        }
コード例 #14
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);
        }
コード例 #15
0
        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);
        }