Example #1
0
    /// <summary>
    /// Used to set spawned field to true and initialize start and end positions for lerping across the screen
    /// </summary>
    /// <param name="topHeight">The height that the top of this obstacle should reach (counting the bottom of the viewport as 0)</param>
    /// <param name="timeToTraverseScreen">The amount of time it should take this obstacle to lerp across the entire viewport horizontally</param>
    public void Spawn(float topHeight, float timeToTraverseScreen, GameObject gameControllerParam)
    {
        transform.parent = gameControllerParam.transform;
        gameController   = gameControllerParam.GetComponent <BalloonGameController>();
        cloudController.InitGC(gameController);
        totalBuildingHeight = topHeight;

        startPos = CalculateStartPos(topHeight);
        //endPos is essentially just a horizontal flip of startPos because (0,0) is at center in Unity
        endPos     = new Vector3(-startPos.x, startPos.y, 1);
        travelTime = timeToTraverseScreen;

        spawned = true;
    }
 void Awake()
 {
     Instance = this;
 }
Example #3
0
 public void InitGC(BalloonGameController gameControllerParam)
 {
     gameController = gameControllerParam.GetComponent <BalloonGameController>();
 }