void Awake() { acScript = GameObject.FindGameObjectWithTag("Arrow").GetComponent<ArrowController>(); texture = transform.Find ("Texture"); foodSpawn = GameObject.FindGameObjectWithTag("GameController").GetComponent<foodSpawner>(); texture = transform.Find("Texture").transform; theBox.enabled = true; sr = texture.GetComponent<SpriteRenderer> (); // if (type == foodType.COW) { // texture.transform.localScale += new Vector3 (0.3f, 0.3f, 0.0f); // } //origTextScale = texture.localScale; }
private void Start() { gameObject.name = "Werner der " + gen + "."; vehicleParent = GameObject.Find("Vehicles"); sr = GetComponent <SpriteRenderer>(); gm = FindObjectOfType <GameManager>(); foodSpawner = FindObjectOfType <foodSpawner>(); vehicleSpawner = FindObjectOfType <vehicleSpawner>(); rb = GetComponent <Rigidbody>(); maxHealth = health; cloningRate = gm.cloningRate; mutationRate = gm.mutationRate; // InvokeRepeating("cloneMe", cloningRate, cloningRate); InvokeRepeating("createRandomVector3", 1, 1); randomVector = new Vector3(Random.Range(-gm.getWindowWidth(), gm.getWindowWidth()), Random.Range(-gm.getWindowHeight(), gm.getWindowHeight()), 0); setDna(); }
void Awake() { acScript = GameObject.FindGameObjectWithTag("Arrow").GetComponent<ArrowController>(); current = this; specialPositions = new List<Vector3>(); regularPositions = new List<Vector3>(); //specialTiles = new GameObject[20]; //regularTiles = new GameObject[500]; basicFood = Resources.Load ("Food"); foodPool = new Stack<GameObject> (); for (int i = 0; i < maxFood; ++i) { returnFood((GameObject)Instantiate(basicFood)); ++spawnedFood; //compensate for returnFood } specialPositions = new List<Vector3> (); regularPositions = new List<Vector3> (); //grab tile objects specialTiles = GameObject.FindGameObjectsWithTag("specialFoodSpot"); //Debug.Log ("specialTiles size " + specialTiles.Length); regularTiles = GameObject.FindGameObjectsWithTag ("foodSpot"); //Debug.Log ("regularTiles size " + regularTiles.Length); //add tranforms to lists for (int i = 0; i < specialTiles.Length; ++i) { specialPositions.Add (specialTiles [i].transform.position); } //Debug.Log ("SpecialTransforms size " + specialPositions.Count); for (int i = 0; i < regularTiles.Length; ++i) { regularPositions.Add (regularTiles [i].transform.position); //Debug.Log (regularTiles [i].transform.position); } //Debug.Log ("regularPositions size " + regularPositions.Count); }