示例#1
0
        public PostEffectChromaticAberrationSimple()
            : base(Utils.Path.ChromaticAberrationSimple + ".hlsl",
                   Utils.Path.ChromaticAberrationSimple + ".glsl")
        {
            var zero2 = new asd.Vector2DF(0.0f, 0.0f);

            OffsetRed   = zero2;
            OffsetGreen = zero2;
            OffsetBlue  = zero2;
            var ws = WindowSize;

            Src   = new asd.RectF(0.0f, 0.0f, ws.X, ws.Y);
            Alpha = 1.0f;
        }
示例#2
0
        public ItemGetEffect(asd.Vector2DF pos)
            : base()
        {
            Position = pos;

            CenterPosition = new asd.Vector2DF(TextureSize / 2, TextureSize / 2);

            Texture = asd.Engine.Graphics.CreateTexture2D("Resources/effect.png");

            Src = new asd.RectF(0, 0, TextureSize, TextureSize);

            AlphaBlend = asd.AlphaBlendMode.Add;

            DrawingPriority = -20;
        }
示例#3
0
        /// <summary>
        /// ワールドを初期化
        /// </summary>
        /// <param name="worldRect">適用範囲</param>
        /// <param name="gravity">重力</param>
        public PhysicalWorld(asd.RectF worldRect, asd.Vector2DF gravity)
        {
            physicalShapes      = new List <PhysicalShape>();
            collisionController = new CollisionController(this);
            AABB aabb = new AABB();

            aabb.LowerBound = PhysicalConvert.Tob2Vector(worldRect.Position);
            aabb.UpperBound = PhysicalConvert.Tob2Vector(worldRect.Vertexes[2]);
            b2World         = new World(aabb, PhysicalConvert.Tob2Vector(gravity), true);
            b2World.SetContactListener(collisionController);
            b2World.SetContactFilter(new ContactFilter());
            TimeStep           = 1.0f / 60.0f;
            VelocityItetions   = 8;
            PositionIterations = 1;
        }
示例#4
0
        protected override void OnUpdate()
        {
            // 表示するアニメーションの位置を計算する。
            int x = count % TextureXCount;
            int y = count / TextureXCount;

            // 設定された画像で実際に表示する範囲を設定する。
            Src = new asd.RectF(x * TextureSize, y * TextureSize, TextureSize, TextureSize);

            // アニメーションが再生し終わったら削除する。
            if (count == TextureXCount * TextureYCount)
            {
                Dispose();
            }

            ++count;
        }
示例#5
0
        // コンストラクタ(初期位置を引数として受け取る。)
        public BreakObjectEffect(asd.Vector2DF pos)
            : base()
        {
            // インスタンスの位置を設定する。
            Position = pos;

            // 画像の中心位置を設定する。
            CenterPosition = new asd.Vector2DF(TextureSize / 2, TextureSize / 2);

            // 画像を読み込み、敵のインスタンスに画像を設定する。
            Texture = asd.Engine.Graphics.CreateTexture2D("BreakObject.png");

            // 設定された画像で実際に表示する範囲を設定する。
            Src = new asd.RectF(0, 0, TextureSize, TextureSize);

            // アルファブレンドの方法を加算に変更する。
            AlphaBlend = asd.AlphaBlendMode.Add;
        }
示例#6
0
        /// <summary>
        /// 座標が矩形領域に含まれているか
        /// </summary>
        /// <param name="rect">領域</param>
        /// <param name="vector">座標</param>
        /// <returns>真偽</returns>
        public static bool Contains(this asd.RectF rect, asd.Vector2DF vector)
        {
            float cross = 0;

            for (int i = 0; i < 4; i++)
            {
                var temp = asd.Vector2DF.Cross(rect.Vertexes[i] - rect.Vertexes[i == 0 ? 3 : i - 1], vector - rect.Vertexes[i == 0 ? 3 : i - 1]);
                if (temp == 0)
                {
                    return(true);
                }
                if (Math.Sign(cross) == Math.Sign(temp) || cross == 0)
                {
                    cross = temp;
                }
                else
                {
                    return(false);
                }
            }
            return(true);
        }
示例#7
0
        public override void OnCollide(CollidableObject obj)  //それぞれのオブジェクトから呼び出してもらう形にしました。
        {
            if (obj == null)
            {
                Dispose();
            }

            if (obj is Obstacle_Fever)
            {
                feverState = false;
                Src        = new asd.RectF(cPos.X * 2, 0, cPos.X, cPos.Y);
            }
            if (obj is FeverWarp)
            {
                feverState = true;
                Src        = new asd.RectF(cPos.X * 2, cPos.Y, cPos.X, cPos.Y);
            }
            if (obj is Medal)
            {
                var scene = (GameScene)Layer.Scene;
                scene.score += 200;
            }
        }
 protected override void OnUpdate()
 {
     if (Count == 0)
     {
         Src = new asd.RectF(0, 0, 32, 32);
     }
     else if (Count == 5)
     {
         Src = new asd.RectF(32, 0, 32, 32);
     }
     else if (Count == 10)
     {
         Src = new asd.RectF(64, 0, 32, 32);
     }
     else if (Count == 15)
     {
         Src = new asd.RectF(96, 0, 32, 32);
     }
     else if (Count == 20)
     {
         Dispose();
     }
     Count++;
 }
        public ItemGetEffect_PenetrateTriShot(asd.Vector2DF pos) : base(pos)
        {
            Texture = asd.Engine.Graphics.CreateTexture2D("Resources/effect7.png");

            Src = new asd.RectF(0, 0, TextureSize, TextureSize);
        }
示例#10
0
 /// <summary>
 /// 点<paramref name="pos"/>が長方形<paramref name="rect"/>の内部にあるかどうかを返します
 /// </summary>
 public static bool IsInner(this asd.Vector2DF pos, asd.RectF rect)
 {
     return
         (rect.X < pos.X && pos.X < rect.X + rect.Width &&
          rect.Y < pos.Y && pos.Y < rect.Y + rect.Height);
 }
示例#11
0
        protected override void OnUpdate()
        {
            //-------------動くよ--------------------------------------------------------------------------------------------------------------------
            if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Up) == asd.KeyState.Hold)
            {
                Position += new asd.Vector2DF(0, -vel);
            }
            if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Down) == asd.KeyState.Hold)
            {
                Position += new asd.Vector2DF(0, vel);
            }
            if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Left) == asd.KeyState.Hold)
            {
                Position += new asd.Vector2DF(-vel, 0);
            }
            if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Right) == asd.KeyState.Hold)
            {
                Position += new asd.Vector2DF(vel, 0);
            }
            if (feverState)
            {
                vel = 15;
            }
            else
            {
                vel = 10;
            }


            //------------機体も動くよ----------------------------------------------------------------------------------------------------------------

            if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Left) == asd.KeyState.Push)
            {
                if (feverState)
                {
                    Src = new asd.RectF(cPos.X, cPos.Y, cPos.X, cPos.Y);
                    Src = new asd.RectF(0, cPos.Y, cPos.X, cPos.Y);
                }
                else
                {
                    Src = new asd.RectF(cPos.X, 0, cPos.X, cPos.Y);
                    Src = new asd.RectF(0, 0, cPos.X, cPos.Y);
                }
            }
            if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Right) == asd.KeyState.Push)
            {
                if (feverState)
                {
                    Src = new asd.RectF(cPos.X * 3, cPos.Y, cPos.X, cPos.Y);
                    Src = new asd.RectF(cPos.X * 4, cPos.Y, cPos.X, cPos.Y);
                }
                else
                {
                    Src = new asd.RectF(cPos.X * 3, 0, cPos.X, cPos.Y);
                    Src = new asd.RectF(cPos.X * 4, 0, cPos.X, cPos.Y);
                }
            }
            if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Left) == asd.KeyState.Release)
            {
                if (feverState)
                {
                    Src = new asd.RectF(cPos.X, cPos.Y, cPos.X, cPos.Y);
                    Src = new asd.RectF(cPos.X * 2, cPos.Y, cPos.X, cPos.Y);
                }
                else
                {
                    Src = new asd.RectF(cPos.X, 0, cPos.X, cPos.Y);
                    Src = new asd.RectF(cPos.X * 2, 0, cPos.X, cPos.Y);
                }
            }
            if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Right) == asd.KeyState.Release)
            {
                if (feverState)
                {
                    Src = new asd.RectF(cPos.X * 3, cPos.Y, cPos.X, cPos.Y);
                    Src = new asd.RectF(cPos.X * 2, cPos.Y, cPos.X, cPos.Y);
                }
                else
                {
                    Src = new asd.RectF(cPos.X * 3, 0, cPos.X, cPos.Y);
                    Src = new asd.RectF(cPos.X * 2, 0, cPos.X, cPos.Y);
                }
            }


            //-----------playerの動く範囲制限---------------------------------------------------------------------------------------------------------

            asd.Vector2DF position = Position;

            position.X = asd.MathHelper.Clamp(position.X, asd.Engine.WindowSize.X * 2 / 3 - cPos.X / 2.0f, cPos.X / 2.0f);
            position.Y = asd.MathHelper.Clamp(position.Y, asd.Engine.WindowSize.Y - cPos.Y / 2.0f, cPos.Y / 2.0f);

            Position = position;

            //----------------------------------------------------------------------------------------------------------------------------------------

/*
 *          if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Z) == asd.KeyState.Push)
 *          {
 *              PlayerBullet bullet = new PlayerBullet(new asd.Vector2DF(Position.X, Position.Y + 20.0f));
 *
 *              asd.Engine.AddObject2D(bullet);
 *          }
 */
        }