public void init(Tower t) { this.owner = t; var modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad); // Create a quad object for holding the gem texture. model = modelObject.AddComponent <BulletModel>(); // Add a towerModel script to control visuals of the gem. model.transform.parent = transform.parent; model.init(this); }
// Use this for initialization public void init(playerModel owner) { this.name = "Bullet"; speed = 7; playerType = owner.getType(); clock = 0f; var modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad); // Create a quad object for holding the gem texture. model = modelObject.AddComponent <BulletModel>(); // Add a marbleModel script to control visuals of the gem. model.init(this); BoxCollider2D playerbody = gameObject.AddComponent <BoxCollider2D> (); playerbody.isTrigger = true; }
// Use this for initialization public void init(playerModel owner) { print("Created BUllet: " + owner.owner.playerType); if (owner.owner.usingcircpowerup == true || owner.owner.tag == "inviscircle") { if (owner.owner.usingcircpowerup == true) { print("With powerup"); } this.name = "SpecialBullet"; } else { this.name = "Bullet"; } playerType = owner.getType(); if (owner.owner.m.inSlowDown) { speed -= 6; } if (this.playerType == 0) { speed = 9.5f; } else if (this.playerType == 1) { speed = 8f; } else if (this.playerType == 2) { speed = 6.5f; } //speed += 3; if (this.name == "SpecialBullet") { speed -= 1.5f; } if (owner.owner.m.inSlowDown) { speed -= 1; } clock = 0f; var modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad); // Create a quad object for holding the gem texture. model = modelObject.AddComponent <BulletModel>(); // Add a marbleModel script to control visuals of the gem. model.init(this); BoxCollider2D playerbody = gameObject.AddComponent <BoxCollider2D> (); Rigidbody2D bossRbody = gameObject.AddComponent <Rigidbody2D> (); bossRbody.gravityScale = 0; playerbody.isTrigger = true; if (this.name == "Bullet") { transform.localScale = new Vector3(.3f, 0.8f, 1); } else { transform.localScale = new Vector3(.65f, 0.8f, 1); } }