Beispiel #1
0
 public Explosion(Vector2 position, int energy, IGameObject originator) : base(position)
 {
     this.Energy           = energy;
     this._animationPlayer = new LinearAnimation(this, "Sprites/Props/LongBang", 8);
     this._isExtant        = true;
     this.Originator       = originator;
     this.Properties.Set(GameObjectProperties.DrawOrder, (int)SpriteDrawOrder.Bang);
 }
Beispiel #2
0
        private void LoopTimer(Animator anim, LinearAnimation animation)
        {
            Vector2 v = animation.EndPos - animation.StartPos;

            v = new Vector2(-v.Y, v.X);
            animation.EndPos = animation.StartPos + v;
            anim.TriggerEvent(AnimationTrigger.None);
        }
Beispiel #3
0
        public void StartMove(BoardIdx dstBoardIdx)
        {
            this.dstBoardIdx = dstBoardIdx;

            RectangleF dstRect = boardView.GetTableCellRectByBoardIdx(dstBoardIdx);

            rect.Width  = dstRect.Width;
            rect.Height = dstRect.Height;
            IsMoving    = true;

            moveAnim.Stop();
            linearPosX = new LinearAnimation(rect.X, dstRect.X, moveAnim);
            linearPosY = new LinearAnimation(rect.Y, dstRect.Y, moveAnim);
            moveAnim.Start();
        }
Beispiel #4
0
        public Bang(Vector2 position, BangType bangType) : base(position)
        {
            switch (bangType)
            {
            case BangType.Short:
                this._animationPlayer = new LinearAnimation(this, "Sprites/Props/ShortBang", 3);
                break;

            case BangType.Long:
                this._animationPlayer = new LinearAnimation(this, "Sprites/Props/LongBang", 12);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(bangType));
            }

            this._isExtant = true;
            this.Properties.Set(GameObjectProperties.DrawOrder, (int)SpriteDrawOrder.Bang);
        }
Beispiel #5
0
        public MenuScene()
        {
            leafParticleEffectTree1 = new LeafParticleEffect(this);
            leafParticleEffectTree2 = new LeafParticleEffect(this);

            buttonCampaign          = new MenuButtonWidget(this, "Campaign", new Vector2(150, 100), new Vector2(300, 80));
            buttonCampaign.OnClick += ButtonStart_OnClick;

            buttonFreePlay          = new MenuButtonWidget(this, "Free Play", new Vector2(150, 200), new Vector2(300, 80));
            buttonFreePlay.OnClick += ButtonStart_OnClick;

            buttonSettings          = new MenuButtonWidget(this, "Settings", new Vector2(150, 300), new Vector2(300, 80));
            buttonSettings.OnClick += ButtonStart_OnClick;

            clickEffect = new ConfettiParticleEffect(this);
            clickEffect.Stop();
            this.OnDisplay += MenuScene_OnDisplay;

            buttonsEnterScreenAnimation = new LinearAnimation(TimeSpan.FromMilliseconds(500));

            nextCampaignSelectorScene = new WorldMapScene();
        }
Beispiel #6
0
        private List <Animation> CreateButtonAnimation(Vector2 endPos, float delay)
        {
            LinearAnimation loadAnim = new LinearAnimation();

            loadAnim.Interpolator     = new SmoothInterpolator();
            loadAnim.StartPos         = new Vector2(endPos.X - 1, endPos.Y);
            loadAnim.EndPos           = endPos;
            loadAnim.MaxAnimationTime = 1;
            loadAnim.Trigger          = AnimationTrigger.OnLoad;
            loadAnim.AnimationDelay   = delay;

            LinearAnimation clickAnim = new LinearAnimation();

            clickAnim.Interpolator     = new Arc2Interpolator();
            clickAnim.StartPos         = endPos;
            clickAnim.EndPos           = endPos + Vector2.UnitY * 0.1f;
            clickAnim.MaxAnimationTime = 0.5f;
            clickAnim.Trigger          = AnimationTrigger.OnEnter;
            return(new List <Animation> {
                loadAnim, clickAnim
            });
        }
Beispiel #7
0
 public CookingState(Mine mine) : base(mine)
 {
     this._animationPlayer = new LinearAnimation(mine, "Sprites/Shot/MineUnarmed", 48);
 }
Beispiel #8
0
        public void LoadLoadingScreen(Texture background = null)
        {
            LoadingSymbol = TextureLoader.FileToTexture("assets/textures/LoadingSymbol.jpg");
            bg            = new GameObject("Background");
            if (background == null)
            {
                BlackBG = HoBMenuScene.menubg;
            }
            else
            {
                BlackBG = background;
            }

            UiImageRendererComponent bgImage =
                new UiImageRendererComponent(BlackBG, false, 1, DefaultFilepaths.DefaultUiImageShader);

            bgImage.RenderQueue = -1;
            bg.AddComponent(bgImage);
            bg.AddComponent(new BackgroundMover());
            Add(bg);

            GameObject text            = new GameObject("text");
            GameFont   f               = FontLibrary.LoadFontDirect("assets/fonts/default_font.ttf", 64);
            UiTextRendererComponent tr = new UiTextRendererComponent(f, false, 1, DefaultFilepaths.DefaultUiTextShader);

            text.AddComponent(tr);
            bg.Add(text);
            tr.Text        = "Loading...";
            tr.SystemColor = Color.Black;
            tr.Scale       = Vector2.One * 3;
            tr.RenderQueue = -1;
            tr.Position    = new Vector2(-0.7f, -0.7f);
            loading        = new GameObject("Loading");
            UiImageRendererComponent loadingImage =
                new UiImageRendererComponent(LoadingSymbol, false, 1, DefaultFilepaths.DefaultUiImageShader);

            loadingImage.RenderQueue = -1;
            loading.AddComponent(loadingImage);
            Add(loading);
            float size = 0.05f;

            loadingImage.Position = new Vector2(0.7f, -0.7f);
            loadingImage.Scale    = new Vector2(size, GameEngine.Instance.AspectRatio * size);
            LinearAnimation loadAnim = new LinearAnimation();
            Interpolator    intP     = new Arc2Interpolator();

            loadAnim.Interpolator     = intP;
            loadAnim.StartPos         = loadingImage.Position;
            loadAnim.EndPos           = loadingImage.Position + Vector2.UnitY * 0.1f;
            loadAnim.MaxAnimationTime = 0.5f;
            loadAnim.Trigger          = AnimationTrigger.None;
            loadAnim.AnimationDelay   = 0f;
            Animator anim = new Animator(new List <Animation> {
                loadAnim
            }, loadingImage);

            loading.AddComponent(anim);
            LoopTimer(anim, loadAnim);
            GameObject   obj   = new GameObject("Timer");
            GeneralTimer timer = new GeneralTimer(0.5f, () => LoopTimer(anim, loadAnim), true);

            obj.AddComponent(timer);
            Add(obj);
        }
 public SimulationOverlayScene()
 {
     openTabAnimation = new LinearAnimation(TimeSpan.FromMilliseconds(250));
     openTabAnimation.Reverse();
 }