Exemple #1
0
        public override void GenerateBullet(IUnitControl owner, Vector2 position, Quaternion rotation, Vector2 direction)
        {
            GameObject      b  = Instantiate(gameObject, position, rotation);
            BulletCollision bc = b.GetComponent <BulletCollision>();

            bc.setOwner(owner);
            Rigidbody2D rb = b.GetComponent <Rigidbody2D>();

            rb.velocity = direction.normalized * speed;
        }
        protected virtual void GenerateOneBullet(IUnitControl owner, Vector2 position, Quaternion rotation, Vector2 direction)
        {
            GameObject      b  = Instantiate(gameObject, position, rotation);
            BulletCollision bc = b.GetComponent <BulletCollision>();

            bc.setOwner(owner);
            Rigidbody2D rb = b.GetComponent <Rigidbody2D>();

            rb.AddForce(direction, ForceMode2D.Impulse);
        }