Example #1
0
 public Transition(StoryScene Scene, float Time, Color?FadeColor)
 {
     m_TargetType  = TargetType.Scene;
     m_TargetScene = Scene;
     m_TargetPoint = null;
     m_Time        = Time;
     m_FadeColor   = FadeColor ?? Color.black;
 }
Example #2
0
 public Transition(StoryTeleportPoint Point, float Time, Color?FadeColor)
 {
     m_TargetType  = TargetType.TeleportPoint;
     m_TargetScene = null;
     m_TargetPoint = Point;
     m_Time        = Time;
     m_FadeColor   = FadeColor ?? Color.black;
 }
Example #3
0
  void Start() {
    if (GetComponent<Collider>() != null) GetComponent<Collider>().isTrigger = true;
    m_LocalScale = transform.localScale;

#if TILTBRUSH_STEAMVRPRESENT
    // Get callbacks from laser pointers
    foreach(var pointer in Resources.FindObjectsOfTypeAll<SteamVR_LaserPointer>()) {
      pointer.PointerIn += Pointer_PointerIn;
      pointer.PointerOut += Pointer_PointerOut;
    }
#endif
    // Create an icon
    if (m_IconTexture != null) {
      if (m_IconMaterial == null) {
          Debug.LogError("No material for the telporting icon defined, using default.", this);
          m_IconMaterial = new Material(Shader.Find("Diffuse"));
      }
      m_IconObject = GameObject.CreatePrimitive(PrimitiveType.Quad);
      Destroy(m_IconObject.GetComponent<Collider>());
      m_IconObject.name = "Icon";
      m_IconObject.transform.SetParent(transform);
      m_IconObject.transform.localPosition = Vector3.zero;
      m_IconObject.transform.localScale = Vector3.one * GetComponent<SphereCollider>().radius * 2f;
      var shader = Shader.Find("Unlit/AlwaysVisible");
      if (shader == null) shader = Shader.Find("Unlit/Color");
      var renderer = m_IconObject.GetComponent<MeshRenderer>();
      renderer.material = m_IconMaterial;
      renderer.material.color = TELEPORT_MAINCOLOR;
      renderer.material.mainTexture = m_IconTexture;
      if (Camera.main)
        m_IconObject.transform.LookAt(Camera.main.transform);
    }

    // Find the parent scene
    var parent = transform.parent;
    while (parent != null) {
      m_ParentScene = parent.GetComponent<StoryScene> ();
      if (m_ParentScene != null)
        break;
      parent = parent.parent;
    }

    // Get target points
    if (m_TeleportToAllPoints) {
      var allpoints = new List<StoryTeleportPoint>();
      foreach(var p in Resources.FindObjectsOfTypeAll<StoryTeleportPoint>()) {
        if (p != this)
          allpoints.Add(p);
      }
      m_RuntimePoints = allpoints.ToArray();
    } else {
      m_RuntimePoints = m_Points;
    }

    // Teleport on start
    if (m_TeleportOnStart)
      TeleportHere();
  }
Example #4
0
 public void TransitionTo(StoryScene Scene, TransitionType Type = TransitionType.Instant, float FadeTime = 1, Color?FadeColor = null)
 {
     TransitionTo(new Transition(Scene, FadeTime, FadeColor), Type, FadeTime, FadeColor);
 }