예제 #1
0
        private void cmbBoxObjectForm_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbBoxObjectForm.SelectedIndex == 0)
            {
                objectShape = ObjectShape.Circle;
            }
            else if (cmbBoxObjectForm.SelectedIndex == 1)
            {
                objectShape = ObjectShape.Triangle;
            }
            else if (cmbBoxObjectForm.SelectedIndex == 2)
            {
                objectShape = ObjectShape.Rectangle;
            }
            else if (cmbBoxObjectForm.SelectedIndex == 3)
            {
                objectShape = ObjectShape.Image;
                tmrObject.Stop();

                using (OpenFileDialog dlg = new OpenFileDialog())
                {
                    //dlg.ShowDialog();
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        img = new Bitmap(dlg.FileName);
                    }
                }
                tmrObject.Start();
            }
        }
예제 #2
0
 public static void SafeDestroy(ObjectShape obj)
 {
     if (obj != null)
     {
         Destroy(obj.gameObject);
     }
 }
예제 #3
0
    /// <summary>
    /// 物理エンジンの処理を行う
    /// </summary>
    /// <returns>状態(-1:何らかの不具合)</returns>
    public static int MainOperation(double spd)
    {
        m_world.Step((float)(timeStep * spd), velocityIterations, positionIterations);
        ObjectShape.Operation();

        return(0);
    }
예제 #4
0
 public static void Init()
 {
     ObjectShape.Init();
     Physics.Init();
     DrawGameMain.Init();
     DX.SRand(DateTime.Now.Millisecond);
 }
예제 #5
0
 public Rope(Rectangle rect, Texture2D tex, ObjectShape Shape, bool IsHazardous, bool gravity)
     : base(rect, tex, Shape)
 {
     isHazardous = IsHazardous;
     hasGravity = gravity;
     hasNinja = false;
     isReleasing = false;
 }
예제 #6
0
 /// <summary>
 /// Simple constructor of a motionless platform. 
 /// </summary>
 /// <param name="rect">Position and size of the platform.</param>
 /// <param name="Velocity">Vector2: initial velocity of the platform.</param>
 /// <param name="tex">Texture2D: texture for the platform.</param>
 /// <param name="Shape">ObjectShape: shape of the platform.</param>
 /// <param name="IsHazardous">boolean: Platform is hazardous.</param>
 /// <param name="gravity">boolen: Platform is affected by gravity.</param>
 public Platform(Rectangle rect, int textureIndex, ObjectShape Shape, bool IsHazardous, bool gravity)
     : base(rect, textureArray[textureIndex], Shape)
 {
     isHazardous = IsHazardous;
     hasGravity = gravity;
     base.isTiled = true;
     patrol = null;
     suspendRopes = new List<SuspendRope>();
 }
예제 #7
0
    public static void Operation()
    {
        if (operation.GetKeyFrame(DX.KEY_INPUT_Z) == 1)
        {
            main.FuncState = main.GAMEINIT;
        }

        if (operation.GetKeyFrame(DX.KEY_INPUT_W) % 2 == 1)
        {
            DrawGameMain.PanningScreen(0, -5);
        }
        if (operation.GetKeyFrame(DX.KEY_INPUT_S) % 2 == 1)
        {
            DrawGameMain.PanningScreen(0, 5);
        }
        if (operation.GetKeyFrame(DX.KEY_INPUT_D) % 2 == 1)
        {
            DrawGameMain.PanningScreen(5, 0);
        }
        if (operation.GetKeyFrame(DX.KEY_INPUT_A) % 2 == 1)
        {
            DrawGameMain.PanningScreen(-5, 0);
        }

        if (operation.GetKeyState(DX.KEY_INPUT_C) == 1)
        {
            GameSpeed = 0.25;
        }
        else
        {
            GameSpeed = 1;
        }

        if (operation.GetKeyFrame(DX.KEY_INPUT_X) == 1)
        {
            Vec2[] vec = new Vec2[3 + DX.GetRand(3)];

            //vec = new Vec2[4];

            for (int i = 0; i < vec.Length; i++)
            {
                vec[i] = new Vec2((float)System.Math.Cos(main.Angle(360 / vec.Length * i)), (float)System.Math.Sin(main.Angle(360 / vec.Length * i)));
            }

            ObjectShape.BornObject(new Vec2(6.5f, 0.5f), main.Angle(0), new Vec2(), 1, vec);

            //if (operation.GetFrame() % 60 == 0)
            //    ObjectShape.BornObject(new Vec2(6.5f, 0.5f), main.Angle(45), 1, new Vec2[] { new Vec2(-1, 0), new Vec2(0, -1), new Vec2(1, 0), new Vec2(0, 1) });
            //else
            //    ObjectShape.BornObject(new Vec2(6.5f, 0.5f), main.Angle(-90), 1, new Vec2[] { new Vec2(0, (float)-System.Math.Sqrt(3)), new Vec2(0, 0), new Vec2(-1, 0) });
        }

        player.Input input = new player.Input();

        player.Player.PlayerOperation(input);
        Physics.MainOperation(gamespeed);
    }
예제 #8
0
 public WorldObject(Vector2 Pos, Vector2 Velocity, Vector2 Size, Texture2D tex, ObjectShape Shape)
 {
     pos = Pos;
     velocity = Velocity;
     size = Size;
     positionMask = PositionState.NotSet;
     texture = tex;
     shape = Shape;
     rotationAngle = 0.0f;
 }
예제 #9
0
        public MainForm()
        {
            InitializeComponent();

            this.polygonForm = new PolygonForm(this);

            objectShape = ObjectShape.Circle;

            foreach (Control pan in Menu.Controls)
            {
                if (pan is Panel)
                {
                    foreach (Control lab in pan.Controls)
                    {
                        if (lab is Label)
                        {
                            performSlideDown[(Label)lab] = false;
                        }
                    }
                    menuPanels.Add((Panel)pan);
                }
            }

            pnlStartColor = pnlStart.BackColor;

            foreach (Panel control in this.Controls)
            {
                control.MouseDown += new MouseEventHandler(panel_MouseDown);
                control.MouseUp   += new MouseEventHandler(panel_MouseUp);
                control.MouseMove += new MouseEventHandler(panel_MouseMove);
            }

            fieldHeight = Field.Height;
            fieldWidth  = Field.Width;

            rnd = new Random();

            x = rnd.Next(0, fieldWidth - figureHeight);
            y = rnd.Next(0, fieldHeight - figureWidth);

            direction = (Direction)rnd.Next(0, 4);

            moveDist = 1;

            Menu.AutoScroll = false;
            Menu.HorizontalScroll.Enabled = false;
            Menu.HorizontalScroll.Visible = false;
            Menu.HorizontalScroll.Maximum = 0;
            Menu.AutoScroll = true;

            cmbBoxObjectForm.SelectedIndex = 0;

            SetDefaultValues();
        }
예제 #10
0
 public Enemy(Rectangle rect, Texture2D tex, string name, ObjectShape Shape, int vr)
     : base(rect, tex, Shape)
 {
     shoots = true;
     visionrange = vr;
     projectiles = new List<Projectile>();
     EnemyName = name;
     state = LifeState.Alive;
     actionState = EnemyActionState.Standing;
     RunTextures = new List<Texture2D>();
     AttackTextures = new List<Texture2D>();
 }
예제 #11
0
        //private static Texture2D[] textureArray;
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="rect"></param>
        /// <param name="Velocity"></param>
        /// <param name="tex"></param>
        /// <param name="Shape"></param>
        public Enemy(Rectangle rect, Texture2D tex, string name, ObjectShape Shape)
            : base(rect, tex, Shape)
        {
            shoots = false;

            projectileTexture = null;
            EnemyName = name;
            state = LifeState.Alive;
            actionState = EnemyActionState.Standing;
            RunTextures = new List<Texture2D>();
            AttackTextures = new List<Texture2D>();
        }
예제 #12
0
        private void SetDefaultValues()
        {
            pen_R = 0;
            pen_G = 170;
            pen_B = 0;

            brush_R = 11;
            brush_G = 123;
            brush_B = 123;

            figureHeight = 100;
            figureWidth  = 100;

            trkBarBG_Red.Value   = Field.BackColor.R;
            trkBarBG_Blue.Value  = Field.BackColor.B;
            trkBarBG_Green.Value = Field.BackColor.G;

            txtBoxBGColor_Red.Text   = trkBarBG_Red.Value.ToString();
            txtBoxBGColor_Blue.Text  = trkBarBG_Blue.Value.ToString();
            txtBoxBGColor_Green.Text = trkBarBG_Green.Value.ToString();

            trkBarObject_Red.Value   = brush_R;
            trkBarObject_Blue.Value  = brush_B;
            trkBarObject_Green.Value = brush_G;

            txtBoxObjectColor_Red.Text   = brush_R.ToString();
            txtBoxObjectColor_Blue.Text  = brush_B.ToString();
            txtBoxObjectColor_Green.Text = brush_G.ToString();

            trkBarObjectBorderColor_Red.Value   = pen_R;
            trkBarObjectBorderColor_Blue.Value  = pen_B;
            trkBarObjectBorderColor_Green.Value = pen_G;

            txtBoxObjectBorderColor_Red.Text   = pen_R.ToString();
            txtBoxObjectBorderColor_Blue.Text  = pen_B.ToString();
            txtBoxObjectBorderColor_Green.Text = pen_G.ToString();

            Field.BackColor = Color.FromArgb(25, 87, 128);

            moveDist          = 1;
            trkBarSpeed.Value = 1;

            trkBarWidth.Value  = figureWidth;
            trkBarHeight.Value = figureHeight;

            objectShape = ObjectShape.Circle;

            points[0] = new Point(x, y);
            points[1] = new Point(x + figureWidth, y);
            points[2] = new Point(x + figureWidth / 2, y - figureHeight);
        }
예제 #13
0
        /// <summary>
        /// Game World Constructor.
        /// </summary>
        /// <param name="rect">Rectangle in which to draw this object.</param>
        /// <param name="vel">Velocity this object initially moves with.</param>
        /// <param name="tex">Texture with which to draw this object.</param>
        /// <param name="shape">Shape of this object for collision purposes.</param>
        public WorldObject(Rectangle rect, Texture2D tex, ObjectShape newShape)
            : base(rect, tex)
        {
            rotationAngle = 0.0f;
            lastUpdated = 0;
            positionMask = PositionState.NotSet;
            velocity = Vector2.Zero;
            drawStyle = WorldObjectDrawStyle.StretchToFit;

            collisionRect = drawRect;
            shape = newShape;
            boundObjects = new LinkedList<WorldObject>();
            hasGravity = false;
        }
예제 #14
0
        public Enemy(Rectangle rect, int type, ObjectShape Shape, int vr, int projectileNum)
            : base(rect, null, Shape)
        {
            myType = (EnemyType) type;
            visionrange = vr;
            state = LifeState.Alive;
            actionState = EnemyActionState.Standing;

            if (vr == 0)
            {
                shoots = false;
                projectileTexture = null;
                projectiles = null;
            }
            else
            {
                shoots = true;
                projectileTexture = ProjectileTextures[0];
                projectiles = new List<Projectile>();
            }
        }
예제 #15
0
 public void GenerateMap()
 {
     foreach (var grideCell in GrideCells)
     {
         Util.SafeDestroy(grideCell.objectShape);
     }
     grideCells.Clear();
     for (int i = 0; i < horCount; i++)
     {
         for (int j = 0; j < verCount; j++)
         {
             GrideCell cell = new GrideCell(i, j);
             cell.pos = startCornor + new Vector3(cell.x * cellUnit, cell.y * cellUnit, 0) + new Vector3((i + 1) * space, (j + 1) * space, 0);
             GameObject obj = Instantiate(target.gameObject, cell.pos, Quaternion.identity);
             obj.transform.SetParent(canvasParent);
             ObjectShape objectShape = obj.GetComponent <ObjectShape>();
             objectShape.grideCell = cell;
             cell.SetObjctShade(objectShape);
             objectShape.SetValue(Random.Range(1, 5).ToString());
             grideCells.Add(cell);
         }
     }
 }
예제 #16
0
    private static void DrawShape()
    {
        for (int i = 0; i < ObjectShape.GetCount(); i++)
        {
            ObjectShape obj = ObjectShape.GetObject(i);
            if (obj != null)
            {
                Vec2[] vec = obj.GetDrawPos(Scale);
                for (int j = 0; j < vec.Length; j++)
                {
                    int p1 = j + 1;
                    if (j == vec.Length - 1)
                    {
                        p1 = 0;
                    }

                    DX.DrawLine((int)vec[j].X, (int)vec[j].Y, (int)vec[p1].X, (int)vec[p1].Y, 0xffffff);
                    DX.DrawString((int)vec[j].X, (int)vec[j].Y, "" + j, 0xffffff);
                }
            }
        }

        return;
    }
예제 #17
0
 /// <summary>
 /// Simple constructor of a motionless platform. 
 /// </summary>
 /// <param name="rect">Position and size of the platform.</param>
 /// <param name="Velocity">Vector2: initial velocity of the platform.</param>
 /// <param name="tex">Texture2D: texture for the platform.</param>
 /// <param name="Shape">ObjectShape: shape of the platform.</param>
 /// <param name="IsHazardous">boolean: Platform is hazardous.</param>
 /// <param name="gravity">boolen: Platform is affected by gravity.</param>
 public Platform(Rectangle rect, Texture2D drawTex, ObjectShape Shape, bool IsHazardous, bool gravity)
     : base(rect, drawTex, Shape)
 {
     isHazardous = IsHazardous;
     hasGravity = gravity;
     patrol = null;
     suspendRopes = new List<SuspendRope>();
 }
예제 #18
0
 public virtual void Select(ObjectShape obj)
 {
 }
예제 #19
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="rect"></param>
 /// <param name="Velocity"></param>
 /// <param name="tex"></param>
 /// <param name="Shape"></param>
 public Enemy(Rectangle rect, int type, ObjectShape Shape)
     : this(rect, type, Shape, 0, 0)
 {
 }
예제 #20
0
 /// <summary>
 /// Registers multiple search fields for a given object shape.
 /// </summary>
 /// <param name="shape">Object shape.</param>
 /// <exception cref="System.ArgumentNullException"><paramref name="shape">shape</paramref> is null.</exception>
 public void RegisterMultipleFields(ObjectShape shape)
 {
     if (shape == null)
         throw new ArgumentNullException("shape");
     else
         RegisterMultipleFieldsInternal(shape, true);
 }
예제 #21
0
 public abstract void Draw(ObjectShape obj);
예제 #22
0
파일: Viewer.cs 프로젝트: jalil1408/BiomPSP
 void DrawTxtFld(string txt, int x, int y, int width, int height, MprStlTxt stlTxt, ObjectShape shape, MprStlRect stlRect, MprStlEllp stlEllp)
 {
     if (shape == ObjectShape.Rectangle)
     {
         DrawRect(x, y, width, height, stlRect);
     }
     else
     {
         DrawEllp(x, y, width, height, stlEllp);
     }
     DrawTxt(txt, x, y, width, height, stlTxt);
 }
예제 #23
0
        /// <summary>
        /// Registers multiple search fields for a given object shape.
        /// </summary>
        /// <param name="shape">Object shape.</param>
        /// <param name="updateIndexes">Value indicating whether to update indexes.</param>
        /// <exception cref="System.ArgumentNullException"><paramref name="shape">shape</paramref> is null.</exception>
        private void RegisterMultipleFieldsInternal(ObjectShape shape, bool updateIndexes)
        {
            string[] nameSearchableProperties = { "Id", "Name", "Description" };

            if (shape != null)
            {
                RegisterMultipleFieldsInternal(shape.Properties, false);

                foreach (ObjectProperty p in shape.Properties.Where(p => p != null && !string.IsNullOrEmpty(p.Name) &&
                    nameSearchableProperties.Any(sp => string.Compare(sp, p.Name, StringComparison.InvariantCultureIgnoreCase) == 0)))
                {
                    RegisterFieldInternal(p, shape.Name, false);
                }

                if (updateIndexes)
                    UpdateIndexes();
            }
        }
예제 #24
0
 public bool CompareValue(ObjectShape other)
 {
     return(string.Equals(GetValue(), other.GetValue()));
 }
예제 #25
0
 /// <summary>
 /// Game World Constructor.
 /// </summary>
 /// <param name="rect">Rectangle in which to draw this object.</param>
 /// <param name="vel">Velocity this object initially moves with.</param>
 /// <param name="tex">Texture with which to draw this object.</param>
 /// <param name="shape">Shape of this object for collision purposes.</param>
 public WorldObject(Rectangle rect, Texture2D tex, ObjectShape newShape)
     : base(rect, tex)
 {
     defaultInit();
     shape = newShape;
 }
예제 #26
0
 public Doodad(Rectangle rect, int textureIndex, ObjectShape Shape)
     : base(rect, textureArray[textureIndex], Shape)
 {
 }
예제 #27
0
 public SuspendRope(Rectangle rect, Texture2D tex, ObjectShape Shape, bool IsHazardous, bool gravity)
     : base(rect, tex, Shape)
 {
     isHazardous = IsHazardous;
     hasGravity = gravity;
 }
예제 #28
0
 public void SetObjctShade(ObjectShape objectShape)
 {
     this.objectShape = objectShape;
 }