internal void SetWaypoint(CollisionIndex WP, CollisionPlane p)
        {
            LastPlane = p;
            if (this.button1 == null)
            {
                InitializeComponent();
            }
            Current           = WP;
            this.Text         = WP.ToString();// +" matrix=" + WP.GetMatrix((float)WP.Position.Z);
            this.button1.Text = WP.ExtraInfoString(LastPlane);
            int i = 0;

            foreach (Button B in CurrentButtons)
            {
                Controls.Remove(B);
            }

            CurrentButtons.Clear();

            foreach (IMeshedObject O in WP.GetOccupiedObjects(p.MinZ, p.MaxZ))
            {
                i++;
                Button B = new Button();
                B.Location  = new System.Drawing.Point(24, 28 + i * 20);
                B.Name      = "o" + i;
                B.Size      = new System.Drawing.Size(715, 23);
                B.TabIndex  = i;
                B.Text      = O.DebugString();
                B.TextAlign = ContentAlignment.MiddleLeft;
                B.UseVisualStyleBackColor = true;
                B.Click += new System.EventHandler(this.object_click);
                this.Controls.Add(B);
                CurrentButtons.Add(B);
            }
        }
 /// <summary>
 /// エネミーの死亡と同時に、死亡したエネミーのデータのみを破棄。
 /// </summary>
 public void EnemyErase()
 {
     BattleManager.Instance.removeEnemyData(CurrentTargetIndex);
     Enemies.RemoveAt(CurrentTargetIndex);
     Pos.RemoveAt(CurrentTargetIndex);
     MainHP.RemoveAt(CurrentTargetIndex);
     MainSTR.RemoveAt(CurrentTargetIndex);
     MainDEF.RemoveAt(CurrentTargetIndex);
     CoreHP.RemoveAt(CurrentTargetIndex);
     CoreSTR.RemoveAt(CurrentTargetIndex);
     CoreDEF.RemoveAt(CurrentTargetIndex);
     CoreBroken.RemoveAt(CurrentTargetIndex);
     Size.RemoveAt(CurrentTargetIndex);
     CollisionIndex.RemoveAt(CurrentTargetIndex);
     EnemyElems = Pos.Count;
 }
Beispiel #3
0
    /// <summary>
    /// 当たり判定のCSVファイルを読み込み。
    /// </summary>
    private void CollisionCsvRead()
    {
        for (int k = 0; k < CollisionPath.Count; k++)
        {
            string[] _lines    = ReadCsvFoundation.ReadCsvData(CollisionPath[k]);
            int      _linesNum = _lines.Length;

            List <List <int> > _lineElems = new List <List <int> >();
            for (int i = 0; i < _linesNum; i++)
            {
                string[] _separatedData = ReadCsvFoundation.NotOptionDataSeparation(_lines[i], ",".ToCharArray(), 30);

                List <int> _elems = new List <int>();
                for (int j = 0; j < _separatedData.Length; j++)
                {
                    _elems.Add(Convert.ToInt32(_separatedData[j]));
                }
                _lineElems.Add(_elems);
            }
            CollisionIndex.Add(_lineElems);
        }
    }
        internal void SetWaypoint(CollisionIndex WP,CollisionPlane p)
        {
            LastPlane = p;
            if (this.button1 == null)
            {
                InitializeComponent();
            }
            Current = WP;
            this.Text = WP.ToString();// +" matrix=" + WP.GetMatrix((float)WP.Position.Z);
            this.button1.Text = WP.ExtraInfoString(LastPlane);
            int i = 0;

            foreach (Button B in CurrentButtons)
            {
                Controls.Remove(B);
            }

            CurrentButtons.Clear();

            foreach (IMeshedObject O in WP.GetOccupiedObjects(p.MinZ, p.MaxZ))
            {
                i++;
                Button B = new Button();
                B.Location = new System.Drawing.Point(24, 28+i*20);
                B.Name = "o"+i;
                B.Size = new System.Drawing.Size(715, 23);
                B.TabIndex = i;
                B.Text = O.DebugString();
                B.TextAlign = ContentAlignment.MiddleLeft;
                B.UseVisualStyleBackColor = true;
                B.Click += new System.EventHandler(this.object_click);
                this.Controls.Add(B);
                CurrentButtons.Add(B);
            }

        }
Beispiel #5
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (_Matrix == null)
            {
                return;
            }
            int x  = e.X / mGridSize;
            int sy = e.Y / mGridSize;
            int y  = TRANSPOSE(sy);
            var POINTS_PER_METER = PathStore.POINTS_PER_METER;

            if (x >= PathStore.MAPSPACE || x < 0 || y < 0 || y >= PathStore.MAPSPACE)
            {
                return;
            }

            // For times that tooltips are not working
            if (e.Button == MouseButtons.Right)
            {
                if (tipForm == null || tipForm.IsDisposed)
                {
                    tipForm = new WaypointProperties();
                }
                tipForm.SetWaypoint(PathStore.GetCollisionIndex(x, y), CurrentPlane);
                tipForm.Show();
                tipForm.Activate();
                return;
            }

            if (e.Button == MouseButtons.None || mDrawMode == DrawModeSetup.None)
            {
                string         str;
                CollisionIndex o = PathStore.GetCollisionIndexNoSideEffect(x, y);
                if (o != null)
                {
                    byte  before = Matrix[x, y];
                    float fbef   = CurrentPlane.HeightMap[o.PX, o.PY];
                    float low    = _CurrentPlane == null ? 0 : CurrentPlane.MinZ;
                    float high   = _CurrentPlane == null ? float.MaxValue : CurrentPlane.MaxZ;
                    str = "";
                    if (_CurrentPlane != null)
                    {
                        str += o.OccupiedString(_CurrentPlane);
                    }
                    if (_Matrix != null)
                    {
                        str += String.Format(" matrix={0}", Matrix[x, y]);
                    }
                    if (_CurrentPlane != null)
                    {
                        str += String.Format(" GL={0}", CurrentPlane.HeightMap[o.PX, o.PY]);
                    }
                    if (_Matrix != null)
                    {
                        if (Matrix[x, y] != before)
                        {
                            Matrix[x, y] = before;
                        }
                    }
                    if (_CurrentPlane != null)
                    {
                        if (CurrentPlane.HeightMap[o.PX, o.PY] != fbef)
                        {
                            CurrentPlane.HeightMap[o.PX, o.PY] = fbef;
                        }
                    }
                }
                else
                {
                    str = "" + Matrix[x, y];
                }
                tip.SetToolTip(this, str + " at " + x / POINTS_PER_METER + "/" + y / POINTS_PER_METER + "/" + CurrentPlane.MinZ);
                return;
            }

            byte[,] mMatrix = Matrix;
            switch (mDrawMode)
            {
            case DrawModeSetup.Start:
                this.Invalidate(new Rectangle(mStart.X * mGridSize, mStart.Y * mGridSize, mGridSize, mGridSize));
                mStart = new Point(x, y);
                PathStore.SetPassable(x / POINTS_PER_METER, y / POINTS_PER_METER, ZLevel);    // mMatrix[x, y] = 1;
                break;

            case DrawModeSetup.End:
                this.Invalidate(new Rectangle(mEnd.X * mGridSize, mEnd.Y * mGridSize, mGridSize, mGridSize));
                mEnd = new Point(x, y);
                PathStore.SetPassable(x / POINTS_PER_METER, y / POINTS_PER_METER, ZLevel);    // mMatrix[x, y] = 1;
                break;

            case DrawModeSetup.Block:
                if (e.Button == (MouseButtons.Left | MouseButtons.Right))
                {
                    SetMatrix(x, y, ((byte)(mMatrix[x, y] - mNodeWeight > 1 ? mMatrix[x, y] - mNodeWeight : 1)));
                }
                else if (e.Button == MouseButtons.Left)
                {
                    SetMatrix(x, y, mNodeWeight);
                }
                else if (e.Button == MouseButtons.Right)
                {
                    SetMatrix(x, y, (byte)(mMatrix[x, y] + mNodeWeight < 256 ? mMatrix[x, y] + mNodeWeight : 255));
                }
                break;
            }

            this.Invalidate(new Rectangle(x * mGridSize, sy * mGridSize, mGridSize, mGridSize));
            base.OnMouseMove(e);
        }
Beispiel #6
0
        private void RemoveFromWaypoint(float MaxX, float MaxY, float MinZ, float MaxZ)
        {
            CollisionIndex I = PathStore.CreateFirstNode(MaxX, MaxY);

            I.RemoveObject(this);
        }