コード例 #1
0
    void Awake()
    {
        // Setup the Main Camera
        Application.targetFrameRate = 150;
        float distance = transform.position.z - GameplayCamera.transform.position.z;

        ScreenHeight = CameraUtils.FrustumHeightAtDistance(distance, GameplayCamera.fieldOfView);
        ScreenBounds = ScreenHeight * GameplayCamera.aspect * 0.5f;

        // Setup input callbacks
        GameInput.OnTap  += HandleOnTap;
        GameInput.OnHold += HandleOnHold;

        // Initialize the game
        mActiveObjects     = new List <GameObject>();
        mTargetsList       = new Queue <int>();
        mCurrentDifficulty = GetComponentInChildren <DifficultyCurve>();
        mPlayerCharacter   = GetComponentInChildren <PlayerCharacter>();
        mGameStatus        = State.TapToStart;
        mMissedEnemies     = 0;
        Paused             = false;

        // Precalculate Bonus weight sum to avoid calculations each frame.
        for (int i = 0; i < BonusTypes.Length; i++)
        {
            mBonusWeightsSum += BonusTypes[i].weight;
        }
    }
コード例 #2
0
 public void Calculate()
 {
     if (Cam != null)
     {
         Height = CameraUtils.FrustumHeightAtDistance(Cam.farClipPlane - 1.0f, Cam.fieldOfView);
         Width  = Height * Cam.aspect;
         //transform.localScale = new Vector3(Width * 0.1f, 1.0f, Height * 0.1f);
     }
 }
コード例 #3
0
    void Awake()
    {
        if (GameObject.Find("UserData(Clone)") == null)
        {
            Instantiate(Resources.Load("Prefabs/UserData"), new Vector3(0, 0, 0), Quaternion.identity);
        }

        float distance = transform.position.z - GameplayCamera.transform.position.z;

        ScreenHeight = CameraUtils.FrustumHeightAtDistance(distance, GameplayCamera.fieldOfView);
        ScreenBounds = ScreenHeight * GameplayCamera.aspect * 0.5f;
    }
コード例 #4
0
    void Awake()
    {
        float distance = transform.position.z - GameplayCamera.transform.position.z;

        ScreenHeight = CameraUtils.FrustumHeightAtDistance(distance, GameplayCamera.fieldOfView);
        ScreenBounds = ScreenHeight * GameplayCamera.aspect * 0.5f;

        GameInput.OnTap      += HandleOnTap;
        GameInput.OnSwipe    += HandleOnSwipe;
        GameInput.OnKeyPress += HandleKeyPress;

        //mActiveEnemies = new List<GameObject>();
        mCurrentDifficulty = GetComponentInChildren <DifficultyCurve>();
        mPlayerCharacter   = GetComponentInChildren <PlayerCharacter>();
        mGameStatus        = State.TapToStart;
        mGameOverTime      = Time.timeSinceLevelLoad;
        mMissedEnemies     = 0;
        Paused             = false;
    }
コード例 #5
0
    void Awake()
    {
        //This should only be true when running game from Unity as the game usually loads from the Overworld.
        if (GameObject.Find("UserData(Clone)") == null)
        {
            Instantiate(Resources.Load("Prefabs/UserData"), new Vector3(0, 0, 0), Quaternion.identity);
        }
        float distance = transform.position.z - GameplayCamera.transform.position.z;

        ScreenHeight = CameraUtils.FrustumHeightAtDistance(distance, GameplayCamera.fieldOfView);
        ScreenBounds = ScreenHeight * GameplayCamera.aspect * 0.5f;

        GameInput.OnTap   += HandleOnTap;
        GameInput.OnSwipe += HandleOnSwipe;
        GameInput.OnTilt  += HandleOnTilt;
        mActiveEnemies     = new List <GameObject>();
        mCurrentDifficulty = GetComponentInChildren <DifficultyCurve>();
        mPlayerCharacter   = GetComponentInChildren <PlayerCharacter>();
        mGameStatus        = State.TapToStart;
        mGameOverTime      = Time.timeSinceLevelLoad;
        mMissedEnemies     = 0;
        Paused             = false;
        UserData.ResetLevelPoints();
    }