Esempio n. 1
0
        public void CreatePegasusFromPath()
        {
            //Exit if nothing to do
            if (m_path.Count == 0)
            {
                return;
            }

            GameObject     pegasusGo = new GameObject("Pegasus Manager");
            PegasusManager pegasus   = pegasusGo.AddComponent <PegasusManager>();

            pegasus.SetDefaults();
            pegasus.m_heightCheckType       = PegasusConstants.HeightCheckType.None;
            pegasus.m_minHeightAboveTerrain = 0.1f;
            pegasus.m_flythroughType        = PegasusConstants.FlythroughType.SingleShot;

            PegasusPoint p = null;

            for (int i = 0; i < m_path.Count; i++)
            {
                p = m_path[i];
                pegasus.AddPOI(p.m_location, p.m_location + Quaternion.Euler(p.m_rotationEuler) * (Vector3.forward * 2f));
            }

            pegasus.SetSpeed(m_defaultSpeed);

            #if UNITY_EDITOR
            Selection.activeObject = pegasusGo;
            #endif
        }
Esempio n. 2
0
        public static void AddPegasusToScene(MenuCommand menuCommand)
        {
            GameObject     pegasusGo = new GameObject("Pegasus Manager");
            PegasusManager manager   = pegasusGo.AddComponent <PegasusManager>();

            manager.SetDefaults();

            // Ensure it gets reparented if this was a context click (otherwise does nothing)
            GameObjectUtility.SetParentAndAlign(pegasusGo, menuCommand.context as GameObject);
            // Register the creation in the undo system
            Undo.RegisterCreatedObjectUndo(pegasusGo, "Created " + pegasusGo.name);
            Selection.activeObject = pegasusGo;
        }