void OnEnable()
    {
        Debug.Log ("Line Game Enabled");
        end = false;
        if (GetComponent<Main>().enabled)
            GetComponent<Main>().enabled = false;

        targetPos = new Vector3(2.7f,2.5f,0);
        for (int i = 0; i < 4; ++i) {
            whaleList [i] = new whaleWithState (Instantiate(ws[i]), objectState.NORMAL, targetPos, diveTargetPos);
            Debug.Log ("Instantiate whale");
            targetPos.x = targetPos.x + 1.5f;
        }

        foreach (whaleWithState w in whaleList) {
            w.state = objectState.NORMAL;
            onscreenPos = Utility.GetRandomVector(2.5f, 7.5f, 0f, 5f);
            w.whale.GetComponent<ActionObject>().MoveTowardsTarget(onscreenPos);
        }
    }
Example #2
0
    void OnEnable()
    {
        Camera mainCam;
        mainCam = Camera.main;
        mainCam.transform.position = new Vector3 (5f, 5f, -7f);
        Debug.Log ("Line Game Enabled");
        end = false;
        if (GetComponent<Main>().enabled)
            GetComponent<Main>().enabled = false;

        targetPos = new Vector3(0f,2f,2f);
        for (int i = 0; i < 4; ++i) {
            whaleList [i] = new whaleWithState (Instantiate(ws[i]), objectState.NORMAL, targetPos, diveTargetPos);
            Debug.Log ("Instantiate whale");
            targetPos.x = targetPos.x + 3;
        }

        foreach (whaleWithState w in whaleList) {
            w.state = objectState.NORMAL;
            onscreenPos = Utility.GetRandomVector(8);
            w.whale.GetComponent<ActionObject>().MoveTowardsTarget(onscreenPos);
        }
    }
Example #3
0
    void OnEnable()
    {
        Debug.Log("Line Game Enabled");
        end = false;
        if (GetComponent <Main>().enabled)
        {
            GetComponent <Main>().enabled = false;
        }

        targetPos = new Vector3(2.7f, 2.5f, 0);
        for (int i = 0; i < 4; ++i)
        {
            whaleList [i] = new whaleWithState(Instantiate(ws[i]), objectState.NORMAL, targetPos, diveTargetPos);
            Debug.Log("Instantiate whale");
            targetPos.x = targetPos.x + 1.5f;
        }

        foreach (whaleWithState w in whaleList)
        {
            w.state     = objectState.NORMAL;
            onscreenPos = Utility.GetRandomVector(2.5f, 7.5f, 0f, 5f);
            w.whale.GetComponent <ActionObject>().MoveTowardsTarget(onscreenPos);
        }
    }