public void init(float x, float y, GameManager gm) { this.transform.position = new Vector3(x, y, 0); this.gm = gm; this.name = "Seed"; GameObject modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad); // Create a quad object for holding the bird texture. model = modelObject.AddComponent <SeedModel> (); // Add a bird_model script to control visuals of the bird. model.init(this); }
public void init(Controller c, float startX, float startY, float destX, float destY, int coordX) { this.transform.position = new Vector3(startX, startY, 0); this.c = c; this.destX = destX; this.destY = destY; this.coordX = coordX; c.inControl = false; var seedObject = GameObject.CreatePrimitive(PrimitiveType.Quad); seed = seedObject.AddComponent <SeedModel> (); seed.init(this); saplingHeight = 0f; branchColor = c.branchColors[c.colorsArrayIndex]; leafColor = c.leafColors [c.colorsArrayIndex]; rootColor = c.rootColors [c.colorsArrayIndex]; c.colorsArrayIndex = (c.colorsArrayIndex + 1) % c.branchColors.Count; }