Beispiel #1
0
    void OnTriggerEnter(Collider other)
    {
        if (!this.enabled || this.annotationType != (int)AnnotationTypes.AREA)
        {
            // do not act as area annotation if not enabled or not specified as one
            return;
        }

        // ensure we're being triggered by a player
        FirstPersonInteractor interactor = other.gameObject.GetComponent <FirstPersonInteractor> ();

        if (interactor == null)
        {
            return;
        }
        else
        {
            interactor.areaAnnotationsInRange.Add(this);

            // Draw area annotation entries in the lower left corner
            AreaAnnotationGui aag = interactor.GetComponentInChildren <AreaAnnotationGui> ();
            if (!aag.isUIActive())
            {
                aag.ActivateGui();
            }
            aag.AddAnnotationEntry(this);

            // Add area annotation log to journal
            if (addToJournal)
            {
                interactor.GetComponentInChildren <Journal> ().AddToJournal(this);
            }
        }
    }
Beispiel #2
0
    void OnTriggerExit(Collider other)
    {
        if (!this.enabled || this.annotationType != (int)AnnotationTypes.AREA)
        {
            // do not act as area annotation if not enabled or not specified as one
            return;
        }

        // ensure we're being triggered by a player
        FirstPersonInteractor interactor = other.gameObject.GetComponent <FirstPersonInteractor> ();

        if (interactor == null)
        {
            return;
        }
        else
        {
            interactor.areaAnnotationsInRange.Remove(this);

            // Remove annotation entry from the toolbox on the lower left corner.
            interactor.GetComponentInChildren <AreaAnnotationGui> ().RemoveAnnotationEntry(this);

            if (interactor.areaAnnotationsInRange.Count == 0)
            {
                interactor.GetComponentInChildren <AreaAnnotationGui> ().DeactivateGui();
            }
        }
    }
Beispiel #3
0
    protected override void PerformAction()
    {
        if (importType != (int)ImportTypes.NONE)
        {
            FirstPersonInteractor player = this.GetPlayer();
            if (player != null)
            {
                player.setWorldActive("Annotation");

                // Add summary annotation log to journal
                if (addToJournal && annotationType == (int)AnnotationTypes.SUMMARY)
                {
                    player.GetComponentInChildren <Journal> ().AddToJournal(this);
                }

                // Display full annotation
                FullAnnotationGui annotationGui = player.GetComponentInChildren <FullAnnotationGui> ();

                if (!annotationGui.isUIActive())
                {
                    annotationGui.ActivateGui(this);
                }
            }
        }
    }
Beispiel #4
0
 void Update()
 {
     if (beingCarried == true)
     {
         FirstPersonInteractor player = this.GetPlayer();
         transform.position = player.transform.position + new Vector3(3 / 2, 1 / 2, 0);
         transform.position = player.transform.GetChild(0).transform.position + player.transform.GetChild(0).transform.forward * 2;
     }
 }
    private void returnToGameStateFromInventory()
    {
        FirstPersonInteractor player = this.GetPlayer();

        if (player != null)
        {
            player.setWorldActive("Inventory");
        }
    }
    protected override void PerformAction()
    {
        FirstPersonInteractor player = this.GetPlayer();

        if (player != null)
        {
            player.setWorldActive("Inventory");
        }
    }
Beispiel #7
0
 // Use this for initialization
 void Awake()
 {
     open            = false;
     showInventoryUI = true;
     gameObject.transform.Find(PAUSEMENU).gameObject.SetActive(false);
     gameObject.transform.Find(OPTIONSMENU).gameObject.SetActive(false);
     gameObject.transform.Find(KEYBINDINGS).gameObject.SetActive(false);
     playerScript = (FirstPersonInteractor)GameObject.FindWithTag(PLAYER).GetComponent(typeof(FirstPersonInteractor));
 }
 public static FirstPersonInteractor GetPlayer(this Interaction i)
 {
     if (i.rootInteractor != null)
     {
         FirstPersonInteractor player = i.rootInteractor.GetComponent <FirstPersonInteractor> ();
         return(player);
     }
     return(null);
 }
Beispiel #9
0
 public void Deactivate()
 {
     if (this.isDecisionNode)
     {
         FirstPersonInteractor player = (FirstPersonInteractor)FindObjectOfType(typeof(FirstPersonInteractor));
         player.setWorldActive("DialogueClose");
     }
     this.enabled = false;
     TwineNodeList.Remove(this);
 }
Beispiel #10
0
 private void Start()
 {
     if (isStartNode)
     {
         FirstPersonInteractor interactor       = (FirstPersonInteractor)FindObjectOfType(typeof(FirstPersonInteractor));
         GameObject            interactorObject = interactor.gameObject;
         this._Activate(interactorObject);
     }
     StartCoroutine(Example());
 }
Beispiel #11
0
    private void DropAtCurrentLocation(GameObject obj)
    {
        FirstPersonInteractor player = this.GetPlayer();

        Transform t   = player.transform;
        Vector3   pos = t.position;

        // Drop the object right in front of the player
        obj.transform.SetPositionAndRotation(pos + t.TransformDirection(new Vector3(0.5f, 0f, 0.5f)),
                                             obj.transform.rotation);
        obj.SetActive(true);
    }
Beispiel #12
0
 protected override void PerformAction()
 {
     if (importType != (int)ImportTypes.NONE)
     {
         active = true;
         FirstPersonInteractor player = this.GetPlayer();
         if (player != null)
         {
             player.SetCanMove(false);
             player.SetDrawsGUI(false);
         }
     }
 }
Beispiel #13
0
	/// <summary>
	/// Find the FirstPersonInteractor in the world, and use it to activate
	/// 	the TwineNode's child at the given index.
	/// </summary>
	/// <param name="index">Index of the child to activate.</param>
	private void ActivateChildAtIndex(int index) 
	{
		// Find the interactor:
		FirstPersonInteractor interactor = (FirstPersonInteractor) FindObjectOfType(typeof(FirstPersonInteractor));

		if (interactor != null) {
			GameObject interactorObject = interactor.gameObject;
		
			// Now activate the child using this interactor!
			TwineNode child = this.children [index].GetComponent<TwineNode> ();
			child.Activate (interactorObject);
		}
	}
Beispiel #14
0
 /// <summary>
 /// Activate this TwineNode immediately, without any checks beforehand.
 /// </summary>
 /// <param name="interactor"></param>
 private void _Activate(GameObject interactor)
 {
     if (this.isDecisionNode)
     {
         FirstPersonInteractor player = (FirstPersonInteractor)FindObjectOfType(typeof(FirstPersonInteractor));
         player.setWorldActive("DialogueOpen");
     }
     this.enabled     = true;
     this.isMinimized = false;
     this.RunVariableAssignments();
     this.UpdateConditionalLinks();
     this.DeactivateAllParents();
     this.StartInteractions(interactor);
 }
Beispiel #15
0
    protected override void PerformAction()
    {
        Active = true;

        // Start at beginning of slideshow upon interaction
        CurrentSlide = 0;

        // Disable player movement/interactor upon interaction
        FirstPersonInteractor player = this.GetPlayer();

        if (player != null)
        {
            player.SetCanMove(false);
            player.SetDrawsGUI(false);
        }
    }
Beispiel #16
0
    void Update()
    {
        FirstPersonInteractor player = this.GetPlayer();

        if (player != null)
        {
            FullAnnotationGui annotationGui = player.GetComponentInChildren <FullAnnotationGui> ();
            if (annotationGui.isUIActive())
            {
                if (Input.GetKey(KeyCode.Q))
                {
                    annotationGui.DeactivateGui();
                    player.setWorldActive("Annotation");
                }
            }
        }
    }
Beispiel #17
0
    void Update()
    {
        if (active)
        {
            if (Input.GetKey(KeyCode.Q) || Input.GetKey(KeyCode.Escape))
            {
                active           = false;
                Cursor.visible   = false;
                Cursor.lockState = CursorLockMode.Locked;

                FirstPersonInteractor player = this.GetPlayer();
                if (player != null)
                {
                    player.SetCanMove(true);
                    player.SetDrawsGUI(true);
                }
            }
        }
    }
Beispiel #18
0
    void OnTriggerExit(Collider other)
    {
        if (this.annotationType != (int)AnnotationTypes.AREA)
        {
            // do not act as area annotation if not specified as one
            return;
        }

        // ensure we're being triggered by a player
        FirstPersonInteractor interactor = other.gameObject.GetComponent <FirstPersonInteractor> ();

        if (interactor == null)
        {
            return;
        }
        else
        {
            interactor.areaAnnotationsInRange.Remove(this);
        }
    }
Beispiel #19
0
    //Function that interacts with the object
    //If the player picks up the object, then the camera zooms in on the object,
    //Then removes movement and I think removes the UI
    //If the object is stopped being interacted with, it goes back to normal, and so does the player
    protected override void PerformAction()
    {
        pickedUp = !pickedUp;
        FirstPersonInteractor player = this.GetPlayer();

        if (player != null)
        {
            if (pickedUp)
            {
                this.transform.position = Camera.main.transform.position + Camera.main.transform.forward * distance;
                player.SetCanMove(false);
                player.SetDrawsGUI(false);
            }
            else
            {
                this.transform.rotation = oldRotation;
                this.transform.position = oldPosition;
                player.SetCanMove(true);
                player.SetDrawsGUI(true);
            }
        }
    }
Beispiel #20
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.D))
     {
         // Advance w/ right arrow or D key; loop back to first image when on last image
         if (CurrentSlide < Slides.Length - 1)
         {
             CurrentSlide++;
         }
         else
         {
             CurrentSlide = 0;
         }
     }
     else if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.A))
     {
         // Retreat w/ left arrow or A key; loop back to last image when on first image
         if (CurrentSlide > 0)
         {
             CurrentSlide--;
         }
         else
         {
             CurrentSlide = Slides.Length - 1;
         }
     }
     else if (Input.GetKey(KeyCode.Q) || Input.GetKey(KeyCode.Escape))
     {
         // Upon ESC, exit from GUI and reenable player control
         Active = false;
         FirstPersonInteractor player = this.GetPlayer();
         if (player != null)
         {
             player.SetCanMove(true);
             player.SetDrawsGUI(true);
         }
     }
 }
 void Start()
 {
     videoFilePath         = Application.dataPath + videoFilePath;
     firstPersonInteractor = GameObject.FindObjectOfType <FirstPersonInteractor>() as FirstPersonInteractor;
 }
Beispiel #22
0
 public void Awake()
 {
     player = (FirstPersonInteractor)target;
 }