public BulletAttackReport CreateBullet(Unit unit) { BulletAttackReport bullet = Instantiate(bulletprefab); bullet.SetUnit(unit); return(bullet); }
private IEnumerator CreateBullet(string name, Vector2 direction, Vector2 pos, float rotation, float time) { yield return(new WaitForSeconds(time)); BulletAttackReport bullet = GameManager.Instance.CreateBullet(Unit); bullet.gameObject.name = name; if (isRight) { direction.x *= -1f; } bullet.Rigid.velocity = direction; bullet.transform.position = (Vector2)transform.position + pos; bullet.transform.rotation = Quaternion.Euler(bullet.transform.eulerAngles.x, (isRight == true ? 180f : 0f), rotation); }
public virtual void BulletHit(Unit unit, BulletAttackReport bullet) { AttackProperties property = GameManager.Instance.GetAttackProperties(unit.tag, bullet.name); Hit(unit, property); }