void Awake() { gearScript = transform.GetComponent <GearPlacer>(); dimensionManager = transform.GetComponent <DimensionManager>(); uIAnimator = GCodeSettings.AddComponent <UIAnimator>(); colonyJob = gameObject.AddComponent <AntColonyProgram>(); }
private void Start() { cubeMesh = gameObject.GetComponent <MeshFilter>().mesh; trashBin = GameObject.Find("BottomPlate").GetComponent <TrashBin>(); gearScript = GameObject.Find("BottomPlate").GetComponent <GearPlacer>(); coordScript = GameObject.Find("BottomPlate").GetComponent <CoordinateManager>(); }
// Use this for initialization void Start() { uIAnimator = gameObject.AddComponent <UIAnimator>(); uIAnimator.SetUp(2f); uIAnimator.canvas.alpha = 0f; gearScript = GameObject.Find("BottomPlate").GetComponent <GearPlacer>(); coordScript = GameObject.Find("BottomPlate").GetComponent <CoordinateManager>(); gearTypes = gearScript.gearTypes; }
public void PlaceGearsFromCoordinates(string _text) { GearPlacer gearScript = transform.GetComponent <GearPlacer>(); gearScript.Reset(); if (_text.StartsWith("#[GearPlacementInfo]\n")) { float xCoord; float zCoord; int gearType; _text = _text.Remove(0, 20); string[] lines = _text.Split(']'); var halfscale = gearScript.gameObject.transform.localScale / 2; for (int i = 0; i < lines.Length - 1; i++) { int.TryParse(lines[i][lines[i].Length - 1].ToString(), out gearType); lines[i] = lines[i].Remove(lines[i].Length - 10, 10); lines[i] = lines[i].Remove(0, 2); string[] Coords = lines[i].Split(',', '(', ')'); float.TryParse(Coords[0], out xCoord); float.TryParse(Coords[1], out zCoord); gearPlacerScript.SpawnGear(xCoord - halfscale.x, 0, zCoord - halfscale.z, gearType); gearPlacerScript.showGearToPlace = false; } gearPlacerScript.activeGears.Reverse(); } UpdateText(); RotationBehaviour.instance.Rotate(); }