Beispiel #1
0
    void Start()
    {
        rend = GetComponent <Renderer> ();                                                                                              //Set sprite to be transperent when instantiated
        rend.material.color = new Color(1f, 1f, 1f, 0f);

        RingManagerScript script = ringManager.GetComponent <RingManagerScript> ();                                     //Get variables from RingManager Script

        fadeInThreshold  = script.FadeInThreshold;
        fadeOutThreshold = script.FadeOutThreshold;
    }
Beispiel #2
0
    void sharkSpawn()
    {
        RingManagerScript ringTracker = gameManager.GetComponentInChildren <RingManagerScript> ();
        GameObject        outerRing   = ringTracker.sharkSpawnRing;

        //Get ringhomes current scale.
        float currentScale = outerRing.transform.localScale.x;

        GameObject sharkInstance = shark;

        //Script used to instantiate shar, as a child of sharkRing in the third ring.
        float      spawnOffset = outerRing.transform.localScale.x;
        GameObject newFish     = Instantiate(sharkInstance, new Vector3(0, -16f * spawnOffset, -1), sharkInstance.transform.rotation) as GameObject;

        newFish.transform.parent      = outerRing.transform.FindChild("sharkRing");
        newFish.transform.localScale *= 1.75f * currentScale;
        sharkTimer = 0.0f;
    }
Beispiel #3
0
    // Use this for initialization
    void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }
        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
//		DontDestroyOnLoad(gameObject);


        GameObject instanc = Instantiate(ringManager, new Vector3(0f, 0f, 0f), Quaternion.identity) as GameObject;

        instanc.transform.SetParent(transform);

        level3switch = false;

        man  = GameObject.Find("ManInTheBoatObject").GetComponent <ManInTheBoatScript> ();
        ring = instanc.GetComponent <RingManagerScript> ();
//		Debug.Log ("We are in level: " + (Application.loadedLevel - 1));
        currentLevel = Application.loadedLevel - 1;
        if (currentLevel == 1)
        {
            man.health = 50.0f;
            Camera.main.orthographicSize = 6;
        }

        if (currentLevel == 2)
        {
            man.health = 30.0f;
            Camera.main.orthographicSize = 7;
        }
        if (currentLevel == 3)
        {
            man.health = 90.0f;
            Camera.main.orthographicSize = 8.0f;
        }
        if (currentLevel == 4)
        {
            man.health = 65.0f;
            Camera.main.orthographicSize = 8.0f;
        }
        if (currentLevel == 5)
        {
            man.health = 50.0f;
            Camera.main.orthographicSize = 8.0f;
        }
        if (currentLevel == 6)
        {
            man.health = 60.0f;
            Camera.main.orthographicSize = 8.0f;
        }
        if (currentLevel == 7)
        {
            man.health = 60.0f;
            Camera.main.orthographicSize = 8.0f;
        }
        if (currentLevel == 8)
        {
            man.health = 50.0f;
            Camera.main.orthographicSize = 8.0f;
            Time.timeScale = 1.5f;
        }
        if (currentLevel == 9)
        {
            man.health = 50.0f;
            Camera.main.orthographicSize = 8.0f;
            Time.timeScale = 1.5f;
        }
        if (currentLevel == 10)
        {
            man.health = 50.0f;
            Camera.main.orthographicSize = 8.0f;
            Time.timeScale = 1.75f;
        }
    }