void Start() { bs = BalloonSpawnerObject.GetComponent <BalloonSpawner> (); cs = ConffetiSpawnerObject.GetComponent <ConfettiSpawner> (); lc = LeftClap.GetComponent <Animator> (); rc = RightClap.GetComponent <Animator> (); }
public static void Load(BalloonSpawner spawner) { // 모든 세이브 슬롯에 대해 로드를 성공 할 때까지 시도한다. var exceptionList = new List <Exception>(); for (var i = 0; i < maxSaveDataSlot; i++) { try { if (LoadInternal(spawner)) { // 저장 파일 중 하나는 제대로 읽히긴 했다. if (i != 0) // 그런데 한번 이상 실패했다면 에러 메시지는 보여준다. { Debug.LogError($"Save data rolled back {i} time(s)...!!!"); } // 게임은 속행하면 된다. 롤백이 됐건 안됐건 읽긴 읽었다... return; } // 뭔가 예외 발생에 의한 실패는 아니지만 실패일 수도 있다. // 어쩄든 실패긴 실패. // 이전 슬롯으로 넘어간다. exceptionList.Add(new Exception("Balloon Save Data Load Exception")); DecreaseSaveDataSlotAndWrite(); } catch (NotSupportedBalloonSaveDataVersionException e) { // 지원되지 않는 저장 파일 버전 Debug.LogWarning(e.ToString()); exceptionList.Add(e); DecreaseSaveDataSlotAndWrite(); } }
// Use this for initialization void Awake() { BalloonSpawner balloonSpawner = GameObject.FindGameObjectWithTag("BalloonSpawner").GetComponent <BalloonSpawner>(); hotAirBallonSpawner = GameObject.FindGameObjectWithTag("HotAirBalloonSpawner").GetComponent <HotAirBalloonSpawner>(); progressText = gameObject.GetComponent <TextMesh>(); totalBalloons = balloonSpawner.getBalloonClusters().Count *BALLOONS_PER_CLUSTER; currentBalloons = totalBalloons; }
public void Initialize(BalloonSpawner spawner, float size, bool applyInitialForce) { // transform.localScale = size * Vector3.one; buoyancy *= Mathf.Pow(size, buoyancyFactor); maxYSpeed *= Mathf.Pow(size, 0.5f); this.spawner = spawner; if (applyInitialForce) { rigidbody.AddForce(Vector2.up * buoyancy * Time.deltaTime); } }
// Use this for initialization void Start() { GameObject gobj = Instantiate(balloonSpawnerPrefab); // parent this to gameObject so it gets cleaned up when level is unloaded gobj.transform.parent = transform; BalloonSpawner spawner = gobj.GetComponent <BalloonSpawner>(); spawner.controller = this; ShowCard(0); }
private void Start() { //get the cannons script cannonManager = GameObject.Find("Cannons Manager"); cannonScript = cannonManager.GetComponent <Cannons>(); cannonballList = cannonScript.cannonballList; //get launch angle if (shootingFromTheLeft = cannonScript.getActiveCannon() == true) { launchAngle = cannonScript.getCurRotleft(); } else { launchAngle = cannonScript.getCurRotRight(); } //decomposing the launch speed into it's x and y components xVel = cannonScript.getLaunchVelocity() * Mathf.Cos(launchAngle); yVel = cannonScript.getLaunchVelocity() * Mathf.Sin(launchAngle); //Velocity's sign depends on which cannon we are firing from if (shootingFromTheLeft == false) { xVel *= -1; } //get terrain data points GameObject mountains = GameObject.Find("Mountain range"); Terrain terrainScript = mountains.GetComponent <Terrain>(); mountainPoints = terrainScript.mountainPoints; leftSidePoints = terrainScript.leftSidePoints; rightSidePoints = terrainScript.rightSidePoints; waterPoints = terrainScript.waterPoints; waterAvgHeight = terrainScript.getWaterAvgHeight(); //Getting the balloon manager script balloonManager = GameObject.Find("Balloon Spawner"); balloonManagerScript = balloonManager.GetComponent <BalloonSpawner>(); }
public static bool Save(BalloonSpawner spawner, ConfigPopup configPopup, BalloonSound sound, Data data, SaveReason sr) { // 에디터에서 간혹 게임 플레이 시작할 때 Load도 호출되기도 전에 Save가 먼저 호출되기도 한다. // (OnApplicationPause 통해서) // 실제 기기에서도 이럴 수 있나? 이러면 망인데... // 그래서 플래그를 하나 추가한다. 이 플래그는 로드가 제대로 한번 됐을 때 true로 변경된다. if (spawner.loadedAtLeastOnce == false) { Debug.LogWarning( "****** Save() called before first Load(). There might be an error during Load(). Save() will be skipped to prevent losing your save data."); return(false); } var balloonSaveData2 = new BalloonSaveData2(); SushiDebug.LogFormat("Saving..."); balloonSaveData2.version = LatestVersion; return(SaveBalloonSaveData2(balloonSaveData2)); }
private void Start() { //Create and add a line of 11 vertices, set width and color line = gameObject.AddComponent <LineRenderer>(); line.positionCount = 11; line.startWidth = 0.1f; line.endWidth = 0.1f; line.startColor = new Color(1, 0, 1, 1); line.endColor = new Color(1, 0, 1, 1); //random spawn delta deltaX = Random.Range(-3f, 3f); //manipulate the line to create the balloon shape CreateBalloonShape(); stringAngle = 270; //get a ref to the balloon spawner balloonSpawner = GameObject.Find("Balloon Spawner"); script = balloonSpawner.GetComponent <BalloonSpawner>(); //get the mountain position points terrainScript = GameObject.Find("Mountain range").GetComponent <Terrain>(); mountainPoints = terrainScript.mountainPoints; }