コード例 #1
0
ファイル: ObjectPencil.cs プロジェクト: eickegao/Blazera
        protected override Boolean Paint(Vector2f point)
        {
            switch (Mode)
            {
                case EMode.Normal:
                    String baseType = CurrentObject.GetType().Name;

                    WorldObject currentObject = null;
                    switch (baseType)
                    {
                        case "Element": currentObject = new Element((Element)CurrentObject); break;
                        case "DisplaceableElement": currentObject = new DisplaceableElement((DisplaceableElement)CurrentObject); break;
                        case "GroundElement": currentObject = new GroundElement((GroundElement)CurrentObject); break;
                        case "WorldItem": currentObject = new WorldItem((WorldItem)CurrentObject); break;
                    }

                    Int32 x = (Int32)(point.X - currentObject.Halfsize.X);
                    Int32 y = (Int32)(point.Y - currentObject.Halfsize.Y);

                    currentObject.SetMap(MapMan.GetCurrent(), x, y);

                    return true;

                default: return false;
            }
        }