Ejemplo 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
        }
Ejemplo n.º 2
0
        public void AddPoint(GameObject go)
        {
            if (go == null)
            {
                return;
            }

            Vector3      location = go.transform.position;
            Vector3      rotation = go.transform.eulerAngles;
            PegasusPoint pp       = null;

            if (m_path.Count > 0)
            {
                pp = m_path[m_path.Count - 1];
                if (pp.m_location == location && pp.m_rotationEuler != rotation)
                {
                    return;
                }
            }
            m_path.Add(new PegasusPoint(location, rotation));
            #if UNITY_EDITOR
            EditorUtility.SetDirty(this);
            #endif
        }