// Update is called once per frame void Update() { timer += Time.deltaTime; if (timer > interval) { //spawn random cloud cloudTypes = RandomCloud <CloudTypes>(); switch (cloudTypes) { case CloudTypes.model1: Instantiate(cloudModel1, transform.position, Quaternion.identity, transform); break; case CloudTypes.model2: Instantiate(cloudModel2, transform.position, Quaternion.identity, transform); break; case CloudTypes.model3: Instantiate(cloudModel3, transform.position, Quaternion.identity, transform); break; case CloudTypes.model4: Instantiate(cloudModel4, transform.position, Quaternion.identity, transform); break; default: break; } timer -= interval; } }
public void setup(Transform cloudPoint, CloudTypes type, int number) { this.type = type; this.number = number; transform.SetParent(cloudPoint, false); numberLabel.text = number.ToString(); }
private GameCloud addRandomCloud(Transform cloudPoint, int number, CloudTypes type) { string resource = "prefabs/Cloud_" + Random.Range(1, 4).ToString(); GameObject instance = Instantiate(Resources.Load(resource, typeof(GameObject))) as GameObject; GameCloud cloud = instance.GetComponent <GameCloud>(); cloud.setup(cloudPoint.transform, type, number); return(cloud); }
public Cloud(Level level, CloudFiles file, CloudTypes type) { Level = level; Type = type; switch (file) { case CloudFiles.One: base.InitWithTexture(level.PlayerCharacterSheet.Texture, new CCRect(1024, 595, 97, 67)); break; case CloudFiles.Two: base.InitWithTexture(level.PlayerCharacterSheet.Texture, new CCRect(1135, 590, 123, 78)); break; case CloudFiles.Three: base.InitWithTexture(level.PlayerCharacterSheet.Texture, new CCRect(1270, 588, 112, 87)); break; } _velocityPoint = new CCPoint(Level.PlatformVelocity / 2.0f, 0); Reset(); }
private GameCloud addRandomCloud(Transform cloudPoint, int number, CloudTypes type) { string resource = "prefabs/Cloud_" + Random.Range(1, 4).ToString(); GameObject instance= Instantiate(Resources.Load(resource, typeof(GameObject))) as GameObject; GameCloud cloud = instance.GetComponent<GameCloud>(); cloud.setup(cloudPoint.transform, type, number); return cloud; }