// Use this for initialization void Start() { if (!foreground) { foreground = GameObject.FindGameObjectWithTag("foreground").transform; } health = gameObject.GetComponent <Health> (); health.enabled = false; if (weapon) { weapon = Instantiate(weapon, new Vector3(this.transform.position.x, this.transform.position.y, 0), this.transform.rotation) as Weapon; weapon.transform.SetParent(this.transform); weapon.enabled = false; } rbody = this.GetComponent <Rigidbody2D> (); movement = this.GetComponent <EnemyMovement> (); movement.enabled = false; boundingstimeout = this.GetComponent <BoundingsTimeout2D> (); boundingstimeout.enabled = false; spriterenderer = this.GetComponent <SpriteRenderer> (); }
// Use this for initialization void Start() { health = gameObject.GetComponent<Health> (); health.enabled = false; if (weapon) { weapon = Instantiate (weapon, new Vector3 (this.transform.position.x, this.transform.position.y, 0), this.transform.rotation) as Weapon; weapon.transform.SetParent (this.transform); weapon.enabled = false; } rbody = this.GetComponent<Rigidbody2D> (); movement = this.GetComponent<EnemyMovement> (); movement.enabled = false; boundingstimeout = this.GetComponent<BoundingsTimeout2D> (); boundingstimeout.enabled = false; spriterenderer = this.GetComponent<SpriteRenderer> (); }