Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections.Generic;
- using System.Collections;
- using UnityEngine;
- using UnityEngine.UI;
- public class MoveAfterXSeconds : MonoBehaviour
- {
- public GameObject TargetObject;
- private bool move = true;
- void Start()
- {
- //Every 41 seconds, que switch at climax of song. Song is 89 secs long.
- InvokeRepeating("OnOff", 41f, 89f);
- }
- void OnOff()
- {
- //tell update to fade in or fade out.
- move = !move;
- Debug.Log ("Switched!");
- }
- void update(){
- if (move == false) {
- TargetObject.gameObject.SendMessage ("FadeOut", 0.5f);
- Debug.Log ("fading!");
- }
- if (move == true) {
- gameObject.transform.position = new Vector3 (-43, 69, -70);
- TargetObject.gameObject.SendMessage ("FadeIn", 0.5f);
- Debug.Log ("Growing!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement