Inheritance: MonoBehaviour
Esempio n. 1
0
    ////new movement pt2
    //[SerializeField]
    //private Animator anim;
    //[SerializeField]
    //private float DirectionDampTime = 0.25f;
    //private float speed = 0.0f;
    //private float h = 0.0f;
    //private floatv=0.0f;

    void Start()
    {
        // Reference to the starcollector
        starCollector = GetComponent <StarCollector>();
        anim          = GetComponent <Animator>();

        locomotionId = Animator.StringToHash("Base Layer.BlendTreeForward");
    }
Esempio n. 2
0
 void Start()
 {
     newspapersHave = 0;
     haveEnough     = false;
     // haveMore = false;
     haveLess      = true;
     starCollector = player.GetComponent <StarCollector>();
 }
Esempio n. 3
0
 void Start()
 {
     isNearPlant     = false;
     anim            = GetComponent <Animator>();
     starCollector   = player.GetComponent <StarCollector>();
     audioSource     = GetComponent <AudioSource>();
     audioPlayedOnce = false;
 }
Esempio n. 4
0
    // Start is called before the first frame update
    void Start()
    {
        firstTime = true;

        sentences     = new Queue <string>();
        sheep         = NewsSheep.GetComponent <NewspaperSheep>();
        starCollector = player.GetComponent <StarCollector>();
    }
Esempio n. 5
0
 void Start()
 {
     anim = GetComponent <Animator>();
     // CanFloat = false;
     starIsFloating = false;
     starFloated    = false;
     isNearRock     = false;
     starCollector  = player.GetComponent <StarCollector>();
 }
Esempio n. 6
0
    //void OnTriggerEnter(Collider other){
    //    // tells that you're in range of star


    //    if(other.gameObject.CompareTag("Player")){
    //        //bc.canCollect = true;
    //        StarCollector bc = other.attachedRigidbody.gameObject.GetComponent<StarCollector>();
    //        //NEW Collection Implementation
    //        int starNum = int.Parse(this.name);
    //        //collect the star IF it has been allowed (after floating up)
    //        //OR it's one of the plain stars
    //        if (bc.canCollect
    //           || starNum == 0
    //           || starNum == 1
    //           || starNum == 4
    //           || starNum == 6
    //           || starNum == 5
    //          )
    //        { // only allow once it's revealed in spot
    //            bc.stars[int.Parse(this.name)] = true;
    //            // Debug.Log("stars collected" + bc.stars[0]);
    //            Destroy(this.gameObject);
    //            bc.ReceiveStar();
    //        }
    //    }
    //}
    void OnTriggerExit(Collider other)
    {
        // tells that you're in range of star
        StarCollector bc = other.attachedRigidbody.gameObject.GetComponent <StarCollector>();

        //if(other.gameObject.CompareTag("Player"))
        //{
        //    bc.canCollect = false;
        //}
    }
Esempio n. 7
0
    // prints a Debug.LogError() if GetComponent() doesn’t find the component you are looking for
    private void Awake()
    {
        starCollector = player.GetComponent <StarCollector>();
        canvasGroup   = GetComponent <CanvasGroup>();

        if (canvasGroup == null)
        {
            Debug.LogError("Could not find component.");
        }
    }
Esempio n. 8
0
 void Start()
 {
     isNearTree           = false;
     anim                 = GetComponent <Animator>();
     starCollector        = player.GetComponent <StarCollector>();
     treeStarAnim         = treeStar.GetComponent <Animator>();
     audioSource          = GetComponent <AudioSource>();
     audioPlayedOnce      = false;
     shakeAudioPlayedOnce = false;
 }
Esempio n. 9
0
 void Start()
 {
     rock = GetComponent <Rigidbody>();
     //player = GetComponent<Rigidbody>();
     anim          = GetComponent <Animator>();
     isNearRock    = false;
     isTurnedOver  = false;
     audioSource   = GetComponent <AudioSource>();
     starCollector = player.GetComponent <StarCollector>();
     // openText = "Press T.";
 }
Esempio n. 10
0
    public string name; // name is the index and star number(specific)
    //Enter->stay
    //void OnTriggerStay(Collider c)
    //{
    //    if (c.attachedRigidbody != null)
    //    {
    //        StarCollector bc = c.attachedRigidbody.gameObject.GetComponent<StarCollector>();
    //        // only destroy object and increment if was X pressed

    //        if (bc != null)
    //        {
    //            // tells that you're in range of star
    //            //bc.canCollect = true;
    //            // only go through with picking up steps IF pickedup animation is complete
    //            if(bc.pickedUp){
    //            //EventManager.TriggerEvent<BombBounceEvent, Vector3>(c.transform.position);

    //                // Add to correct star index
    //                bc.stars[int.Parse(this.name)] = true;

    //                // Debug.Log("stars collected" + bc.stars[0]);
    //                Destroy(this.gameObject);
    //                bc.ReceiveStar();
    //            }

    //        }
    //    }
    //}

    //if just standing there when star appears
    void OnTriggerStay(Collider other)
    {
        // tells that you're in range of star
        //if (other.gameObject.CompareTag("Player"))
        //{
        //    if (other.attachedRigidbody != null)
        //    {
        //        StarCollector bc = other.attachedRigidbody.gameObject.GetComponent<StarCollector>();

        //        if (bc != null)
        //        {
        //            //NEW Collection Implementation
        //            if (bc.canCollect)
        //            { // only allow once it's revealed in spot
        //                bc.stars[int.Parse(this.name)] = true;

        //                // Debug.Log("stars collected" + bc.stars[0]);
        //                Destroy(this.gameObject);
        //                bc.ReceiveStar();
        //            }
        //        }

        //    }
        //}

        if (other.gameObject.CompareTag("Player"))
        {
            //bc.canCollect = true;
            StarCollector bc = other.attachedRigidbody.gameObject.GetComponent <StarCollector>();
            //NEW Collection Implementation
            int starNum = int.Parse(this.name);
            //collect the star IF it has been allowed (after floating up)
            //OR it's one of the plain stars
            if (bc.canCollect ||
                starNum == 0 ||
                starNum == 1 ||
                starNum == 4 ||
                starNum == 6
                //|| starNum == 5
                )
            { // only allow once it's revealed in spot
                bc.stars[int.Parse(this.name)] = true;
                // Debug.Log("stars collected" + bc.stars[0]);
                Destroy(this.gameObject);
                bc.ReceiveStar();
            }
        }
    }
Esempio n. 11
0
	private void OnDestroy()
	{
		star_instance = null;
	}
Esempio n. 12
0
 // Start is called before the first frame update
 void Start()
 {
     starCollector = player.GetComponent <StarCollector>();
 }
Esempio n. 13
0
    // Start is called before the first frame update
    void Start()
    {
        soundSource = GameObject.Find("SoundControl").GetComponent <AudioSource>();

        musicEnabled = PlayerPrefs.GetInt("musicEnabled", 1);
        soundEnabled = PlayerPrefs.GetInt("soundEnabled", 1);

        if (SceneManager.GetActiveScene().buildIndex == 0)
        {
            checkReturnToLevelSelect();
            musicEnabled = 1;
            soundEnabled = 1;
            PlayerPrefs.SetInt("musicEnabled", 1);
            PlayerPrefs.SetInt("soundEnabled", 1);
        }
        else
        {
            plane  = FindObjectOfType <PlaneControl>();
            star1C = GameObject.Find("endScreen").transform.GetChild(1).gameObject;
            star2C = GameObject.Find("endScreen").transform.GetChild(3).gameObject;
            star3C = GameObject.Find("endScreen").transform.GetChild(5).gameObject;
            endScreen.gameObject.SetActive(false);
            sC           = FindObjectOfType <StarCollector>();
            engineSource = GameObject.Find("Plane").GetComponent <AudioSource>();

            nextLevelStarDisplay = GameObject.Find("currentPlayerStar");

            nextLevelStarDisplay.transform.parent = nextLevelButton.gameObject.transform;
            nextLevelStarDisplay.GetComponent <RectTransform>().localPosition = new Vector3(-296, -105, 0);


            Image[] images1 = GameObject.Find("Sound Button").GetComponentsInChildren <Image>();
            foreach (Image image in images1)
            {
                if (image.gameObject.transform.parent.name == "Sound Button")
                {
                    soundAnim = image;
                }
            }

            Image[] images2 = GameObject.Find("Music Button").GetComponentsInChildren <Image>();
            foreach (Image image in images2)
            {
                if (image.gameObject.transform.parent.name == "Music Button")
                {
                    musicAnim = image;
                }
            }

            if (musicEnabled == 1)
            {
                musicAnim.sprite = Resources.Load <Sprite>("music_icon_on");
            }
            else
            {
                musicAnim.sprite = Resources.Load <Sprite>("music_icon_off");
            }


            if (soundEnabled == 1)
            {
                soundAnim.sprite = Resources.Load <Sprite>("sound_icon_on");
            }
            else
            {
                soundAnim.sprite = Resources.Load <Sprite>("sound_icon_off");
            }
        }


        musicSource = GameObject.Find("BackGroundSound").GetComponent <AudioSource>();


        if (soundEnabled == 1)
        {
            soundSource.enabled = true;
            if (SceneManager.GetActiveScene().buildIndex > 0)
            {
                engineSource.enabled = true;
            }
        }
        else
        {
            soundSource.enabled = false;
            if (SceneManager.GetActiveScene().buildIndex > 0)
            {
                engineSource.enabled = false;
            }
        }

        if (musicSource != null)
        {
            if (musicEnabled == 1)
            {
                musicSource.enabled = true;
            }
            else
            {
                musicSource.enabled = false;
            }
        }
    }
Esempio n. 14
0
 // Start is called before the first frame update
 void Start()
 {
     anim                   = GetComponent <Animator>();
     starCollector          = player.GetComponent <StarCollector>();
     starCollector.isThrown = false;
 }
Esempio n. 15
0
 private void Start()
 {
     instance = this;
     numberOfStarsCollected = 0;
 }
Esempio n. 16
0
	private void Awake()
	{
		DontDestroyOnLoad(gameObject);
		star_instance = this;
	}
Esempio n. 17
0
    // Start is called before the first frame update

    //public Text indication;

    void Start()
    {
        firstTime     = true;
        quest         = false;
        starCollector = player.GetComponent <StarCollector>();
    }