void Awake() { this._rigidbody = GetComponent <Rigidbody2D>(); sp = GetComponent <LebensPunkte>(); sp.init(lebensPunkte, damage); this._camera = Camera.main; sc = GetComponent <SceneController>(); }
public Enemy Init(EnemyPool pool, Vector2 position) { this._rigidbody.simulated = true; this._renderer.enabled = true; this._pool = pool; this.transform.position = position; sp.init(lebensPunkte, damage); return(this); }
public virtual Projectile Init(ProjectilePool pool, Vector2 position, Vector2 direction) { this._pool = pool; //the caller sets the corresponding objectpool this.transform.position = position; //For stuff like teleportation we use the transform. We dont want the physics engine to interrupt ;) this._direction = direction; this._direction = this._direction.normalized; //we normalize AFTER setting z to 0, otherwise we dont have vectors of size 1 anymore sp.init(lebensPunkte, damage); this.Rotate(); return(this); }