void Awake() { if (instance == null) { instance = this; } mm = Instantiate(mm) as MilkshakeManager; pm = Instantiate(pm) as PersonManager; cm = Instantiate(cm) as CowManager; bm = Instantiate(bm) as BuildingManager; }
void Awake() { if (m_instance == null) { //If I am the first instance, make me the Singleton m_instance = this; } else { //If a Singleton already exists and you find //another reference in scene, destroy it! if (this != m_instance) { Destroy(this.gameObject); } } }
// Initialize the UFO's properties, also chose the first target of the UFO override public void Start() { base.Start(); // Set the max speed this.maxSpeed = 57; // Get the particle system ps = GameObject.Find("UFO Particles").GetComponent <ParticleSystem>(); em = ps.emission; // Disable emission em.enabled = false; // Get the CowManager Script cowz = CowManager.GetComponent <CowManager>(); nextCorn = 0; // Randomly chose to get a cow or a pig if (Random.Range(-10, 10) > 0) { co = cowz.cows[0]; target = cowz.cows[0].transform.position; co.GetComponent <Cow>().setControled(); isNotPig = true; } else { co = cowz.pigs[0]; target = cowz.pigs[0].transform.position; co.GetComponent <Pig>().setControled(); isNotPig = false; } // Set the booleans to their correct values abducting = false; destroyingCorn = false; started = false; finished = false; allFinished = false; }
/// <summary> /// Start method /// Initialize necessary values /// </summary> virtual public void Start() { // CharacterController component is on the same GameObject as this script, // so we can simply call GetComponent to find it charControl = this.GetComponent <CharacterController>(); // SimManager script is on another GameObject in the scene - to find it, use the static Find method // of the GameObject class and oass in the name of the GameObject in the hierarchy managerScript = GameObject.Find("CowManagerGO").GetComponent <CowManager>(); velocity = new Vector3(Random.Range(-1, 1), 0f, Random.Range(-1, 1)); //acceleration = Vector3.zero; // testing to get the dude to move acceleration = new Vector3(0, 0, 0); wanderAngle = Random.Range(0, 2 * Mathf.PI); if (!isCow) { maxSpeed = 1; } // mass = 1; //maxForce = 15; }
void Awake() { if(m_instance == null){ //If I am the first instance, make me the Singleton m_instance = this; }else{ //If a Singleton already exists and you find //another reference in scene, destroy it! if(this != m_instance) Destroy(this.gameObject); } }
private void Awake() { manager = GetComponent <CowManager>(); }