Exemplo n.º 1
0
    void OnEnable()
    {
        Debug.Log("Aquarium Game Enabled");

        if (GetComponent <Main>().enabled)
        {
            GetComponent <Main>().enabled = false;
        }

        for (int i = 0; i < numObjects; ++i)
        {
            ws2[i] = Instantiate(ws2[i]);
            ws2[i].GetComponent <ActionObject>().Initialize(Utility.GetRandomVector(0f, 5f, 5f, 10f), Random.Range(0.5f, 1.5f));

            whaleList2 [i] = new whaleClass(ws2[i], targetPos);

            Debug.Log("Instantiate whale");
        }

        foreach (whaleClass w in whaleList2)
        {
            w.targetPos = Utility.GetRandomVector(0f, 5f, 5f, 10f);
            w.whale.GetComponent <ActionObject>().MoveTowardsTarget(w.targetPos);
        }
    }
Exemplo n.º 2
0
    private AquariumMusic music; // how this module plays music in the application

    #endregion Fields

    #region Methods

    void OnEnable()
    {
        Debug.Log ("Aquarium Game Enabled");

        if (GetComponent<Main>().enabled)
            GetComponent<Main>().enabled = false;

        for (int i = 0; i < numObjects; ++i) {
            ws2[i] = Instantiate(ws2[i]);
            ws2[i].GetComponent<ActionObject>().Initialize(Utility.GetRandomVector(), Random.Range (0.5f, 1.5f));

            whaleList2 [i] = new whaleClass (ws2[i], targetPos);

            Debug.Log ("Instantiate whale");
        }

        foreach (whaleClass w in whaleList2) {
            w.whale.GetComponent<ActionObject>().MoveTowardsTarget(offscreenPos);
        }
    }