Inheritance: MonoBehaviour
コード例 #1
0
        public Tree(XmlReader r, Forest parent, WorldEditor worldEditor)
        {
            this.app    = worldEditor;
            this.parent = parent;

            FromXml(r);
        }
コード例 #2
0
    /// <summary>
    /// Function that handles all the input in the actual scene window
    /// </summary>
    void OnSceneGUI()
    {
        //Check for edit mode
        if (Event.current.alt)
        {
            inEditMode = false;
        }
        else
        {
            inEditMode = true;
        }
        // if in edit mode, start processing inputs
        if (inEditMode)
        {
            //Disable mouse selection while in edit mode to prevent selection
            if (Event.current.type == EventType.layout)
            {
                HandleUtility.AddDefaultControl(GUIUtility.GetControlID(GetHashCode(), FocusType.Passive));
            }

            if (Event.current.type == EventType.mouseDown)
            {
                Ray        ray = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition); //cast ray from screen point towards 3d space - super useful
                RaycastHit hit = new RaycastHit();
                if (Physics.Raycast(ray, out hit, 1000f))
                {
                    //if we hit terrain, execute prop instantiation.
                    Vector3 brushPosition = hit.point;
                    worldEditor = (WorldEditor)target;
                    worldEditor.PrefabBrush(brushPosition, (GameObject)prefab);
                }
            }
        }
    }
コード例 #3
0
 public PointLight(WorldEditor worldEditor, IWorldContainer parent, SceneManager scene, XmlReader r)
 {
     this.app    = worldEditor;
     this.parent = parent;
     this.scene  = scene;
     fromXML(r);
 }
コード例 #4
0
        public void AddToScene()
        {
            if (!foundOffset)
            {
                terrainOffset = position.y - app.GetTerrainHeight(Position.x, Position.z);
                foundOffset   = true;
            }
            if (app.DisplayPointLightMarker)
            {
                this.DisplayPointLightMarker();
                if (displayObject.Entity.Mesh.TriangleIntersector == null)
                {
                    displayObject.Entity.Mesh.CreateTriangleIntersector();
                }
            }
            string uniqueName = WorldEditor.GetUniqueName(ObjectType, name);

            pLight           = this.scene.CreateLight(uniqueName);
            pLight.Type      = Axiom.Graphics.LightType.Point;
            pLight.Position  = position;
            pLight.Specular  = specular;
            pLight.Diffuse   = diffuse;
            pLight.IsVisible = true;
            pLight.SetAttenuation(attenuationRange, attenuationConstant, attenuationLinear, attenuationQuadratic);
            inScene = true;
            if (app.DisplayPointLightCircles)
            {
                UpdateShowCircles();
            }
        }
コード例 #5
0
 public ScaleChangeCommand(WorldEditor app, IObjectScale scaleObj, float oldScale, float newScale)
 {
     this.scaleObj = scaleObj;
     this.oldScale = oldScale;
     this.newScale = newScale;
     this.app      = app;
 }
コード例 #6
0
        public AddObjectCommand(WorldEditor worldEditor, IWorldContainer parentObject, string objectName,
                                string meshName, bool randomRotation, bool randomScale, float minScale, float maxScale,
                                Vector3 position)
        {
            this.app            = worldEditor;
            this.parent         = parentObject;
            this.name           = objectName;
            this.meshName       = meshName;
            this.location       = position;
            this.randomRotation = randomRotation;
            this.randomScale    = randomScale;
            this.minScale       = minScale;
            this.maxScale       = maxScale;

            // apply random scale and rotation
            if (randomRotation)
            {
                rotation = (float)app.Random.NextDouble() * 360f;
            }
            if (randomScale)
            {
                float scaleRange = maxScale - minScale;

                scale = minScale + (float)app.Random.NextDouble() * scaleRange;
            }

            placing = false;
        }
コード例 #7
0
 public PositionChangeCommand(WorldEditor app, IObjectPosition posObj, Vector3 oldPosition, Vector3 newPosition)
 {
     this.posObj      = posObj;
     this.oldPosition = oldPosition;
     this.newPosition = newPosition;
     this.app         = app;
 }
コード例 #8
0
        public Sound(XmlReader r, IWorldContainer parent, WorldEditor worldEditor)
        {
            this.parent = parent;
            this.app    = worldEditor;

            FromXml(r);
        }
コード例 #9
0
 public SearchDialog(WorldTreeNode node, TreeNodeCollection collection, WorldEditor worldEditor)
 {
     this.rootNode           = node;
     this.rootNodeCollection = collection;
     this.app = worldEditor;
     InitializeComponent();
 }
コード例 #10
0
        // Look up the path set associated with a particular mesh
        public static InteriorPathSet FindPathsForMesh(WorldEditor app, string meshName)
        {
            InteriorPathSetLookup result;

            if (pathSetDictionary.TryGetValue(meshName, out result))
            {
                return(result.paths);
            }
            else
            {
                string meshNameWithoutExtension = Path.GetFileNameWithoutExtension(meshName);
                string modelPathFile            = meshNameWithoutExtension + ".modelpaths";
                try {
                    Stream          stream  = ResourceManager.FindCommonResourceData(modelPathFile);
                    InteriorPathSet pathset = new InteriorPathSet(stream, app, meshNameWithoutExtension);
                    return(pathset);
                }
                catch (Exception e) {
                    LogManager.Instance.Write("Could not read '{0}'; error was '{1}'",
                                              modelPathFile, e.Message);
                    pathSetDictionary[meshNameWithoutExtension] = new InteriorPathSetLookup(false, null);
                    return(null);
                }
            }
        }
コード例 #11
0
        public AlphaSplatTerrainDisplay(WorldTerrain parent, WorldEditor worldEditor, XmlReader r)
        {
            this.parent = parent;
            this.app    = worldEditor;

            FromXml(r);
        }
コード例 #12
0
 public ChangeCollectionCommandFactory(WorldEditor worldEditor, List <IObjectChangeCollection> changeObjList,
                                       IObjectCollectionParent toCollection)
 {
     this.app          = worldEditor;
     this.objList      = changeObjList;
     this.toCollection = toCollection;
 }
コード例 #13
0
        public PlantType(XmlReader r, Grass parent, WorldEditor app)
        {
            this.app    = app;
            this.parent = parent;

            FromXml(r);
        }
コード例 #14
0
        public Skybox(IWorldContainer parentContainer, WorldEditor worldEditor, XmlReader r)
        {
            this.parent = parentContainer;
            this.app    = worldEditor;

            FromXml(r);
        }
コード例 #15
0
 public Grass(Boundary parent, WorldEditor app, String name)
 {
     this.parent    = parent;
     this.app       = app;
     this.name      = name;
     this.plantList = new List <IWorldObject>();
 }
コード例 #16
0
 public GlobalAmbientLight(IWorldContainer parentContainer, WorldEditor worldEditor)
 {
     this.app    = worldEditor;
     this.parent = parentContainer;
     this.scene  = app.Scene;
     this.color  = app.Config.DefaultAmbientLightColor;
 }
コード例 #17
0
 public GlobalAmbientLight(IWorldContainer parentContainer, WorldEditor worldEditor, SceneManager sceneManager, ColorEx lightColor)
 {
     this.parent = parentContainer;
     this.app    = worldEditor;
     this.scene  = sceneManager;
     this.color  = lightColor;
 }
コード例 #18
0
 public RotationChangeCommand(WorldEditor app, IObjectRotation rotObj, float oldRot, float newRot)
 {
     this.rotObj = rotObj;
     this.oldRot = oldRot;
     this.newRot = newRot;
     this.app    = app;
 }
コード例 #19
0
 public GlobalDirectionalLight(IWorldContainer parent, WorldEditor worldEditor, XmlReader r)
 {
     this.app    = worldEditor;
     this.parent = parent;
     this.scene  = app.Scene;
     fromXml(r);
 }
コード例 #20
0
 public TerraformTool(EditorScreen screen, WorldEditor editor)
     : base(screen, editor, EditorToolType.Terraform, Key.Number6)
 {
     window         = new TerraformWindow(UI.GUISystem, UI.Theme);
     window.Visible = false;
     UI.GUISystem.Add(window);
 }
コード例 #21
0
 public PaintTool(EditorScreen screen, WorldEditor editor)
     : base(screen, editor, EditorToolType.Paint, Key.Number4)
 {
     window         = new PaintWindow(UI.GUISystem, UI.Theme);
     window.Visible = false;
     UI.GUISystem.Add(window);
 }
コード例 #22
0
        public ParticleEffect(XmlReader r, IWorldObject parent, WorldEditor app)
        {
            this.parent = parent;
            this.app    = app;

            FromXml(r);
        }
コード例 #23
0
        public PointCollection(IWorldContainer parent, WorldEditor worldEditor, bool noIntersect, bool displayMarkers, string markerMeshName, string markerMaterialName, MPPointType type, XmlReader r)
            :
            this(parent, worldEditor, noIntersect, displayMarkers, markerMeshName, markerMaterialName, type)
        {
            //
            // don't do the intersection test when adding points from xml
            //
            this.noIntersect = false;

            while (r.Read())
            {
                // look for the start of an element
                if (r.NodeType == XmlNodeType.Whitespace)
                {
                    continue;
                }
                if (r.NodeType == XmlNodeType.EndElement)
                {
                    break;
                }
                if (r.NodeType == XmlNodeType.Element)
                {
                    if (String.Equals(r.Name, "Point"))
                    {
                        Vector3 ptLoc = XmlHelperClass.ParseVectorAttributes(r);
                        int     pointNum;
                        AddPoint(ptLoc, out pointNum);
                    }
                }
            }

            this.noIntersect = noIntersect;
        }
コード例 #24
0
        static public void SendUserError(string text, string anchor, int displayTime, bool includeBeep, object objin, WorldEditor appin)
        {
            app  = appin;
            link = anchor;
            if (includeBeep)
            {
                SystemSounds.Beep.Play();
            }
            obj = objin;

            if (showing == false)
            {
                showing = true;
                toolStripErrorMessage                  = new ToolStripLabel(text, null, false);
                toolStripErrorMessage.ForeColor        = Color.Red;
                toolStripErrorMessage.Click           += toolStripErrorMessage_clicked;
                toolStripErrorMessage.IsLink           = true;
                toolStripErrorMessage.ActiveLinkColor  = Color.Red;
                toolStripErrorMessage.LinkBehavior     = LinkBehavior.AlwaysUnderline;
                toolStripErrorMessage.LinkColor        = Color.Red;
                toolStripErrorMessage.VisitedLinkColor = Color.Red;
                toolStripErrorMessageItem              = toolStripErrorMessage as ToolStripItem;
                app.StatusBarAddItem(toolStripErrorMessageItem);
                timeOutErrorMessage(toolStripErrorMessageItem, displayTime);
            }
        }
コード例 #25
0
        public void MultipleDragMove(WorldEditor app, int x, int y)
        {
            int i = 0;

            location = app.PickTerrain(x, y);
            Vector3 position;

            foreach (IObjectDrag disObject in dragObjects)
            {
                switch (disObject.ObjectType)
                {
                case "PointLight":
                case "Marker":
                case "Object":
                    position = location + dragOffset[i];
                    if (i == 0)
                    {
                        if (disObject.AllowAdjustHeightOffTerrain)
                        {
                            position = app.ObjectPlacementLocation(x, y) + new Vector3(0, terrainOffset[i], 0);
                        }
                        else
                        {
                            position = app.ObjectPlacementLocation(x, y);
                        }
                        disObject.Position = position;
                        break;
                    }
                    else
                    {
                        if (disObject.AllowAdjustHeightOffTerrain)
                        {
                            position = app.ObjectPlacementLocation(location + dragOffset[i]) + new Vector3(0, terrainOffset[i], 0);
                        }
                        else
                        {
                            position = app.ObjectPlacementLocation(location + dragOffset[i]);
                        }
                        disObject.Position = position;
                        break;
                    }

                default:
                    position           = location + dragOffset[i];
                    position.y         = app.GetTerrainHeight(location.x, location.z);
                    disObject.Position = position;
                    if (String.Equals(disObject.ObjectType, "Points") && (disObject as PointCollection).DisplayMarkers != true)
                    {
                        (disObject as PointCollection).DisplayMarkers = true;
                    }
                    break;
                }
                if (!disObject.InScene)
                {
                    (disObject as IWorldObject).AddToScene();
                }
                i++;
            }
        }
コード例 #26
0
 public AddFogCommand(WorldEditor app, Boundary parent, ColorEx color, float nearin, float farin)
 {
     this.app    = app;
     this.parent = parent;
     this.color  = color;
     this.near   = nearin;
     this.far    = farin;
 }
コード例 #27
0
 public InsertPointsCommand(WorldEditor worldEditor, IWorldContainer parent, Vector3 newPoint, int index)
 {
     this.app      = worldEditor;
     this.parent   = (PointCollection)parent;
     this.newPoint = newPoint;
     this.index    = index;
     this.placing  = true;
 }
コード例 #28
0
        public Grass(XmlReader r, Boundary parent, WorldEditor app)
        {
            this.parent    = parent;
            this.app       = app;
            this.plantList = new List <IWorldObject>();

            FromXml(r);
        }
コード例 #29
0
ファイル: Fog.cs プロジェクト: yanivkalfa/MultiversePlatform
        public Fog(XmlReader r, Boundary parent, WorldEditor app)
        {
            this.app        = app;
            this.parentNode = null;
            this.parent     = parent;

            FromXml(r);
        }
コード例 #30
0
 public AddMarkerAtCameraCommand(WorldEditor app, IWorldContainer parent, string name)
 {
     this.app    = app;
     this.parent = parent;
     this.name   = name;
     this.pos    = app.CameraPosition;
     this.orient = new Quaternion(app.CameraOrientation.w, app.CameraOrientation.x, app.CameraOrientation.y, app.CameraOrientation.z);
 }