public override void Shooting() { var gameObjectBuilder = new GameObjectBuilder(); GameObject player = gameObjectBuilder.Visual.Name("Roman").Sprite(_sprite).Physics.Rigidbody2D(5, 0) .BoxCollider2D(false); player.transform.position = _barrel.position; player.GetComponent <Rigidbody2D>().AddForce(_barrel.up * _force); }
public GameObject Pop() { GameObject go; if (_stack.Count == 0) { go = new GameObjectBuilder().Visual.Name("Bullet").Sprite(Resources.Load <Sprite>("Bullet/bullet_sprite")).LayerSortingOrder(2).SpriteColor(Color.red).Scale(8.0f, 8.0f) .Physics.SetMass2D(_object.GetComponent <Rigidbody2D>().mass).IsKinematic(false).IsTrigger2D(false).AddView <BulletView>(); go.transform.parent = _root.transform; } else { go = _stack.Pop(); } go.SetActive(true); go.GetComponent <Rigidbody2D>().simulated = true; go.GetComponent <BulletView>().ProviderDestroyed += Push; return(go); }