Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections.Generic;
  3. using System.Collections;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6.  
  7. public class MoveAfterXSeconds : MonoBehaviour
  8. {
  9. public GameObject TargetObject;
  10. private bool move = true;
  11. void Start()
  12. {
  13. //Every 41 seconds, que switch at climax of song. Song is 89 secs long.
  14. InvokeRepeating("OnOff", 41f, 89f);
  15.  
  16. }
  17.  
  18. void OnOff()
  19. {
  20. //tell update to fade in or fade out.
  21. move = !move;
  22. Debug.Log ("Switched!");
  23.  
  24. }
  25. void update(){
  26. if (move == false) {
  27. TargetObject.gameObject.SendMessage ("FadeOut", 0.5f);
  28. Debug.Log ("fading!");
  29. }
  30. if (move == true) {
  31. gameObject.transform.position = new Vector3 (-43, 69, -70);
  32. TargetObject.gameObject.SendMessage ("FadeIn", 0.5f);
  33. Debug.Log ("Growing!");
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement