Example #1
0
        public Player(fk_Vector position) : base(CharacterSide.Player, LifeMax, position, 100)
        {
            Model = new fk_Model()
            {
                Shape    = new fk_Block(4, 4, 4),
                Material = new fk_Material()
                {
                    Ambient   = new fk_Color(0, 0, 0),
                    Alpha     = 0.7f,
                    Diffuse   = new fk_Color(0.8, 0.6, 0),
                    Emission  = new fk_Color(0, 0, 0),
                    Shininess = 0,
                    Specular  = new fk_Color(0, 0, 0)
                },
                BMode = fk_BoundaryMode.CAPSULE,
                //BDraw = true,
                BLineColor = fk_Material.Blue.Diffuse
            };
            Model.GlUpvec(new fk_Vector(1, 1, 0));
            Model.SetCapsule(new fk_Vector(0, 0, 0), new fk_Vector(0, 0, 0.01), 2);

            GameInfo.GetInstance().AddPlayerSide(this);
            GameInfo.GetInstance().ControllableCharacter = this;

            _shootLine = new fk_Model()
            {
                Shape    = new fk_Block(0.2, 0.2, ShootLineLength),
                Material = fk_Material.Pink,
            };
            _shootLine.Material.Alpha = 0.5f;

            _isImmotal = false;
        }
Example #2
0
        public void Entry(fk_AppWindow argWin, fk_Vector pos, int randSeed)
        {
            moveParticle = new MissileMoveParticle(argWin, randSeed);
            rand         = new Random(randSeed);

            mbody.Shape = bodyshape;
            mwing.Shape = wingshape;

            mbody.Material = fk_Material.White;
            mwing.Material = fk_Material.LavaRed;

            mbody.GlVec(0.0, 0.0, -1.0);
            mwing.GlAngle(3.0 * FK.PI / 2.0, FK.PI / 2.0, 0.0);
            mwing.GlMoveTo(0.0, -0.125, 0.5);

            mbody.BMode = fk_BoundaryMode.AABB;
            mbody.AdjustAABB();

            argWin.Entry(mbody);
            argWin.Entry(mwing);

            mmodel.EntryChild(mbody);
            mbody.EntryChild(mwing);


            argWin.Entry(mmodel);
            position = pos;
            mmodel.GlMoveTo(pos);
            if (moveMode == (int)MoveMode.RandCurve || moveMode == (int)MoveMode.RandLine)
            {
                randPos.x = rand.NextDouble() * 20.0 - 10.0;
                randPos.y = rand.NextDouble() * 20.0 - 10.0;
                randPos.z = rand.NextDouble() * 20.0 - 10.0;
            }
        }
Example #3
0
 private void GenerateNewChild(fk_Vector basePosition)
 {
     _childList[0] = new BossChild(basePosition, this, new fk_Vector(0, 5, 0));
     _childList[1] = new BossChild(basePosition, this, new fk_Vector(0, -5, 0));
     _childList[2] = new BossChild(basePosition, this, new fk_Vector(5, 0, 0));
     _childList[3] = new BossChild(basePosition, this, new fk_Vector(-5, 0, 0));
 }
Example #4
0
        public Enemy(Category _category, fk_Vector position, fk_AppWindow window)
        {
            category = _category;
            switch (category)
            {
            case Category.Dash:
                model.Shape    = new fk_Sphere(4, 12);
                model.Material = fk_Material.Red;
                model.GlMoveTo(position);
                model.SmoothMode = false;
                model.BMode      = fk_BoundaryMode.SPHERE;
                model.AdjustSphere();
                window.Entry(model);
                ability    = false;
                preAbility = ability;
                hp         = 2;
                break;

            case Category.Patroll:
                model.Shape    = new fk_Sphere(4, 18);
                model.Material = fk_Material.Red;
                model.GlMoveTo(position);
                model.SmoothMode = false;
                model.BMode      = fk_BoundaryMode.SPHERE;
                model.AdjustSphere();
                window.Entry(model);
                ability    = false;
                preAbility = ability;
                hp         = 3;
                break;
            }
        }
Example #5
0
 public void Entry(fk_AppWindow argWin)
 {
     emodel.Shape    = cone;
     emodel.Material = fk_Material.LightCyan;
     emodel.GlVec(0.0, -1.0, 0.0);
     Pos = new fk_Vector(0.0, 20.0, 0.0);
     argWin.Entry(emodel);
 }
Example #6
0
        public void Move(fk_Vector Diff, fk_AppWindow argWin)
        {
            if (liveflag == true)
            {
                switch (moveMode)
                {
                case (int)MoveMode.Line:
                    accel  = new fk_Vector();
                    accel += 2.0 * (Diff - velocity * period) / (period * period);

                    period -= deltatime;

                    velocity += accel * deltatime;
                    position += velocity * deltatime;
                    mmodel.GlMoveTo(position);
                    break;

                case (int)MoveMode.Curve:

                    accel  = new fk_Vector();
                    accel += 2.0 * (Diff - velocity * period) / (period * period);
                    accel += new fk_Vector(rand.NextDouble() * 20 - 10.0, rand.NextDouble() * 3.0, rand.NextDouble() * 100.0 - 50.1);

                    period -= deltatime;

                    velocity += accel * deltatime;
                    position += velocity * deltatime;
                    mmodel.GlMoveTo(position);
                    break;

                case (int)MoveMode.RandCurve:

                    accel  = new fk_Vector();
                    accel += 2.0 * (Diff - velocity * period) / (period * period);
                    accel += new fk_Vector(rand.NextDouble() * 80.0 - 40.5, 0.0, rand.NextDouble() * 50.0 - 25.1);

                    period -= deltatime;


                    velocity += accel * deltatime;
                    position += velocity * deltatime;
                    mmodel.GlMoveTo(position);
                    break;

                case (int)MoveMode.RandLine:
                    accel  = new fk_Vector();
                    accel += 2.0 * (Diff - velocity * period) / (period * period);

                    period -= deltatime;


                    velocity += accel * deltatime;
                    position += velocity * deltatime;
                    mmodel.GlMoveTo(position);
                    break;
                }
            }
        }
Example #7
0
 private void SetModelTransform(fk_Model model, fk_Vector position, fk_Vector direction, fk_Vector upVec = null)
 {
     model.GlVec(direction);
     if (upVec != null)
     {
         model.GlUpvec(upVec);
     }
     model.GlMoveTo(position);
 }
 protected void SetMainCamera(fk_Vector position, fk_Vector direction = null)
 {
     mainCamera = new fk_Model();
     mainCamera.GlMoveTo(position);
     if (direction != null)
     {
         mainCamera.GlVec(direction);
     }
     MainScene.Camera = mainCamera;
 }
Example #9
0
 public Explosion(fk_Vector position, fk_AppWindow appWindow)
 {
     model.Shape    = new fk_Sphere(4, 16);
     model.Material = fk_Material.DimYellow;
     model.GlMoveTo(position);
     model.SmoothMode = true;
     model.BMode      = fk_BoundaryMode.SPHERE;
     model.AdjustSphere();
     appWindow.Entry(model);
 }
Example #10
0
 public void Entry(fk_AppWindow argWin)
 {
     pmodel.Shape    = cone;
     pmodel.Material = fk_Material.Red;
     pmodel.GlVec(0.0, 1.0, 0.0);
     Pos          = new fk_Vector(0.0, -20.0, 0.0);
     pmodel.BMode = fk_BoundaryMode.AABB;
     pmodel.AdjustAABB();
     argWin.Entry(pmodel);
 }
Example #11
0
 protected void SetStateCamera(fk_Vector position, fk_Vector direction = null)
 {
     stateCamera = new fk_Model();
     stateCamera.GlMoveTo(position);
     if (direction != null)
     {
         stateCamera.GlVec(direction);
     }
     StateScene.Camera = stateCamera;
 }
Example #12
0
        static void Main(string[] args)
        {
            fk_Material.InitDefault();

            // ウィンドウ生成
            var window = new fk_AppWindow();

            window.Size    = new fk_Dimension(600, 600);
            window.BGColor = new fk_Color(1, 1, 1);
            window.Open();

            var posArray = new fk_Vector[100];
            var point    = new fk_Point();

            for (int i = 0; i < 100; i++)
            {
                posArray[i] = new fk_Vector(0, 0, 0);
                point.PushVertex(posArray[i]);
            }

            var pointModel = new fk_Model();

            pointModel.Shape      = point;
            pointModel.PointColor = new fk_Color(0.0, 0.0, 0.0);
            pointModel.PointSize  = 2.0;
            window.Entry(pointModel);

            var line      = new fk_Line();
            var lineModel = new fk_Model();

            lineModel.Shape     = line;
            lineModel.LineColor = new fk_Color(0.0, 0.0, 1.0);
            window.Entry(lineModel);

            posArray[1] = new fk_Vector(0, 10, 0);
            posArray[1].Normalize();
            line.PushLine(posArray[0], posArray[1]);

            var count = 0;

            for (int i = 0; i < 10; i++)
            {
                count += 1;
            }
            Console.WriteLine(count);

            while (window.Update())
            {
                if (window.GetMouseStatus(fk_MouseButton.M1, fk_Switch.DOWN, true))
                {
                    Console.WriteLine("ZeroOne");
                }
            }
        }
Example #13
0
 public void ChangePos(fk_AppWindow argWin)
 {
     if (argWin.GetMouseStatus(fk_MouseButton.MOUSE1, fk_SwitchStatus.PRESS, false) == true)
     {
         var plane = new fk_Plane();
         plane.SetPosNormal(new fk_Vector(0.0, 0.0, 0.0), new fk_Vector(0.0, 0.0, 1.0));
         var pos3D = new fk_Vector();
         var pos2D = argWin.MousePosition;
         argWin.GetProjectPosition(pos2D.x, pos2D.y, plane, pos3D);
         Pos = pos3D;
     }
 }
Example #14
0
 public Bullet(float size, fk_Vector position, fk_Vector _direction, fk_Material color, int _speed, int _damege, fk_AppWindow appWindow)
 {
     model.Shape    = new fk_Sphere(4, size);
     model.Material = color;
     model.GlMoveTo(position);
     model.SmoothMode = true;
     model.BMode      = fk_BoundaryMode.SPHERE;
     model.AdjustSphere();
     direction = _direction;
     speed     = _speed;
     damege    = _damege;
     appWindow.Entry(model);
 }
 public ClusterBullet(CharacterSide side, fk_Vector position, fk_Vector velocity) : base(side, LifeMax, position,
                                                                                         velocity)
 {
     Model = new fk_Model()
     {
         Shape    = new fk_Block(2, 2, 2),
         Material = fk_Material.Red,
         BMode    = fk_BoundaryMode.CAPSULE,
         //BDraw = true,
         BLineColor = fk_Material.Green.Diffuse
     };
     Model.SetCapsule(new fk_Vector(0, 0, 0), new fk_Vector(0, 0, 0.01), 1);
 }
        public EnemySphere(fk_Vector position) : base(CharacterSide.Enemy, LifeMax, position)
        {
            Model = new fk_Model()
            {
                Shape      = new fk_Sphere(4, 2.0),
                Material   = fk_Material.Cyan,
                BMode      = fk_BoundaryMode.CAPSULE,
                BDraw      = false,
                BLineColor = fk_Material.Red.Diffuse
            };
            Model.SetCapsule(new fk_Vector(0, 0, 0), new fk_Vector(0, 0, 0.01), 3.5);

            GameInfo.GetInstance().AddEnemySide(this);
        }
Example #17
0
 public PierceBullet(CharacterSide side, fk_Vector position, fk_Vector velocity) : base(side, LifeMax, position,
                                                                                        velocity)
 {
     Model = new fk_Model()
     {
         Shape    = new fk_Block(1, 1, 1),
         Material = fk_Material.DimYellow,
         BMode    = fk_BoundaryMode.CAPSULE,
         //BDraw = true,
         BLineColor = fk_Material.Green.Diffuse
     };
     Model.SetCapsule(new fk_Vector(0, 0, 0), new fk_Vector(0, 0, 0.01), 1);
     Model.GlRotate(Position, fk_Axis.Y, FK.PI / 4.0);
 }
Example #18
0
 public void LookVec(fk_Vector Target, fk_AppWindow argWin)
 {
     diff = Target - mmodel.Position + randPos;
     mmodel.GlVec(diff);
     moveParticle.PushPoints(mmodel.Position);
     Move(diff, argWin);
     if (period < 0.0)
     {
         argWin.Remove(mmodel);
         argWin.Remove(mwing);
         argWin.Remove(mbody);
         liveflag = false;
     }
 }
Example #19
0
 public NormalBullet(CharacterSide side, fk_Vector position, fk_Vector velocity, fk_Material material,
                     double scale = 1) : base(side, LifeMax, position,
                                              velocity)
 {
     Model = new fk_Model()
     {
         Shape    = new fk_Block(scale, scale, scale),
         Material = material,
         BMode    = fk_BoundaryMode.CAPSULE,
         //BDraw = true,
         BLineColor = fk_Material.Green.Diffuse
     };
     Model.SetCapsule(new fk_Vector(0, 0, 0), new fk_Vector(0, 0, 0.01), scale);
 }
Example #20
0
        public BossChild(fk_Vector position, Boss parent, fk_Vector relativePosition) : base(CharacterSide.Enemy,
                                                                                             LifeMax, position)
        {
            _parent           = parent;
            _relativePosition = relativePosition;

            Model = new fk_Model()
            {
                Shape      = new fk_Cone(4, 2.0, 4),
                Material   = fk_Material.BambooGreen,
                BMode      = fk_BoundaryMode.CAPSULE,
                BDraw      = false,
                BLineColor = fk_Material.Red.Diffuse
            };
            Model.SetCapsule(new fk_Vector(0, 0, 0), new fk_Vector(0, 0, 0.01), 3);

            GameInfo.GetInstance().AddEnemySide(this);
        }
Example #21
0
        protected void SetMainLight(fk_Material lightMaterial, fk_Vector direction = null)
        {
            if (MainScene == null)
            {
                return;
            }
            mainLight      = new fk_Light();
            mainLightModel = new fk_Model()
            {
                Shape    = mainLight,
                Material = lightMaterial
            };
            if (direction != null)
            {
                mainLightModel.GlVec(direction);
            }

            MainScene.EntryModel(mainLightModel);
        }
Example #22
0
        protected void SetStateLight(fk_Material lightMaterial, fk_Vector direction = null)
        {
            if (StateScene == null)
            {
                return;
            }
            stateLight      = new fk_Light();
            stateLightModel = new fk_Model()
            {
                Shape    = mainLight,
                Material = lightMaterial
            };
            if (direction != null)
            {
                stateLightModel.GlVec(direction);
            }

            StateScene.EntryModel(stateLightModel);
        }
Example #23
0
        public PlayerCharacter(fk_Vector _position, fk_AppWindow appWindow)
        {
            playerModel          = new fk_Model();
            playerModel.Shape    = new fk_Block(20.0, 40.0, 20.0);
            playerModel.Material = fk_Material.Blue;
            playerModel.GlMoveTo(_position);
            playerModel.SmoothMode = true;
            playerModel.BMode      = fk_BoundaryMode.AABB;
            playerModel.AdjustAABB();
            var playerHead = new fk_Model();

            playerHead.Shape    = new fk_Sphere(4, 10);
            playerHead.Material = fk_Material.Blue;
            playerHead.Parent   = playerModel;
            playerHead.GlMoveTo(new fk_Vector(0, 30, 0) + _position);
            var texture = new fk_RectTexture();

            if (texture.ReadPNG("Face.png") == false)
            {
                Console.WriteLine("File Read Error");
            }
            texture.TextureSize = new fk_TexCoord(20.0, 20.0);
            var textureModel = new fk_Model();

            textureModel.Shape    = texture;
            textureModel.Material = fk_Material.White;
            textureModel.Parent   = playerModel;
            textureModel.GlMoveTo(new fk_Vector(0, 70, 0) + _position);
            textureModel.GlAngle(Math.PI, -Math.PI / 2, 0);
            muzzules[0] = new fk_Model();
            muzzules[0].GlMoveTo(new fk_Vector(0, 10, 15) + _position);
            muzzules[0].Parent = playerModel;
            muzzules[1]        = new fk_Model();
            muzzules[1].GlMoveTo(new fk_Vector(-20, 10, 15) + _position);
            muzzules[1].Parent = playerModel;
            muzzules[2]        = new fk_Model();
            muzzules[2].GlMoveTo(new fk_Vector(20, 10, 15) + _position);
            muzzules[2].Parent = playerModel;
            appWindow.Entry(playerModel);
            appWindow.Entry(playerHead);
            appWindow.Entry(textureModel);
        }
Example #24
0
        public Item(Type _type, fk_Vector position, fk_AppWindow window)
        {
            type        = _type;
            model.Shape = new fk_Block(15, 15, 15);
            model.GlMoveTo(position);
            model.SmoothMode = true;
            model.BMode      = fk_BoundaryMode.AABB;
            model.AdjustAABB();
            switch (type)
            {
            case Type.diffusion:
                model.Material = fk_Material.Pink;
                break;

            case Type.bomb:
                model.Material = fk_Material.Orange;
                break;
            }
            window.Entry(model);
        }
        protected BulletBase(CharacterSide side, int lifeMax, fk_Vector position, fk_Vector velocity) : base(side, lifeMax, position)
        {
            Velocity = velocity;

            switch (side)
            {
            case CharacterSide.Player:
                GameInfo.GetInstance().AddPlayerSide(this);
                break;

            case CharacterSide.Enemy:
                GameInfo.GetInstance().AddEnemySide(this);
                break;

            case CharacterSide.Other:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(side), side, null);
            }
        }
Example #26
0
        public void Move(fk_AppWindow argWin)
        {
            fk_Vector origin = new fk_Vector(0.0, 0.0, -2.0);

            if (argWin.GetSpecialKeyStatus(fk_SpecialKey.LEFT, fk_SwitchStatus.PRESS))
            {
                pmodel.LoTranslate(-Speed, 0.0, 0.0);
            }
            if (argWin.GetSpecialKeyStatus(fk_SpecialKey.RIGHT, fk_SwitchStatus.PRESS))
            {
                pmodel.LoTranslate(Speed, 0.0, 0.0);
            }
            if (argWin.GetSpecialKeyStatus(fk_SpecialKey.UP, fk_SwitchStatus.PRESS))
            {
                pmodel.LoTranslate(0.0, 0.0, -Speed);
            }
            if (argWin.GetSpecialKeyStatus(fk_SpecialKey.DOWN, fk_SwitchStatus.PRESS))
            {
                pmodel.LoTranslate(0.0, 0.0, Speed * 3.0);
            }
        }
Example #27
0
        public MissileDeleteParticle(fk_AppWindow argWin)
        {
            double R, G, B;

            points  = new fk_Polyline[MaxParticle];
            pmodel  = new fk_Model[MaxParticle];
            randPos = new fk_Vector();
            for (int n = 0; n < MaxParticle; n++)
            {
                points[n]           = new fk_Polyline();
                pmodel[n].Shape     = points[n];
                pmodel[n].PointSize = 4.5;

                R = rand.NextDouble();
                G = rand.NextDouble();
                B = rand.NextDouble();

                Console.WriteLine("R : " + R + " G : " + G + " B : " + B);

                pmodel[n].PointColor = new fk_Color(R * (155.0 / 256.0) + (100.0 / 256.0), G * (155.0 / 256.0) + (100.0 / 256.0), B * (155.0 / 256.0) + (100.0 / 256.0));
                argWin.Entry(pmodel[n]);
            }
        }
Example #28
0
        public Boss(fk_Vector position) : base(CharacterSide.Enemy, LifeMax, position)
        {
            _moveRange = GameInfo.MoveRange - 5;

            _childList = new BossChild[ChildrenCount];

            Model = new fk_Model()
            {
                Shape      = new fk_Block(4, 4, 4),
                Material   = fk_Material.Cyan,
                BMode      = fk_BoundaryMode.CAPSULE,
                BDraw      = false,
                BLineColor = fk_Material.Red.Diffuse
            };
            Model.SetCapsule(new fk_Vector(0, 0, 0), new fk_Vector(0, 0, 0.01), 2);

            GameInfo.GetInstance().AddEnemySide(this);

            SetRandomVelocity();

            GenerateNewChild(position);

            _restReviveCount = -1;
        }
Example #29
0
        public Missile(int randNum)
        {
            liveflag  = true;
            mmodel    = new fk_Model();
            mbody     = new fk_Model();
            mwing     = new fk_Model();
            bodyshape = new fk_Capsule(2, 1.5, 0.5);
            wingshape = new fk_Prism(3, 1.25, 1.25, 0.25);
            rand      = new Random();
            randPos   = new fk_Vector();
            accel     = new fk_Vector();
            velocity  = new fk_Vector();
            position  = new fk_Vector();
            diff      = new fk_Vector();

            //ミサイルの移動パターン決定
            moveMode = randNum;
            if (moveMode < 10)
            {
                moveMode = (int)MoveMode.Line;
            }
            else if (moveMode < 50)
            {
                moveMode = (int)MoveMode.Curve;
            }
            else if (moveMode < 80)
            {
                moveMode = (int)MoveMode.RandCurve;
            }
            else
            {
                moveMode = (int)MoveMode.RandLine;
            }
            //ミサイルの消滅時間
            period = rand.Next(5, 8);
        }
Example #30
0
 static void CameraSet(fk_AppWindow argWin, fk_Vector parentPos)
 {
     argWin.CameraPos   = parentPos + new fk_Vector(0.0, -30.0, 0.0);
     argWin.CameraFocus = parentPos;
 }