Esempio n. 1
0
 private void OnBulletCollisionEvent(BulletCollisionEventPayload payload)
 {
     if (payload.CollisionTransform != transform)
     {
         return;
     }
     EventBus.Dispatch(DestroyObjectEntityEventPayload.Create(this, payload.BulletEntity.transform));
     GameManager.Instance.GameFactory.ObjectFactory.DestroyEntity(this);
 }
Esempio n. 2
0
        private void Update()
        {
            Vector2 lastPosition = transform.position;

            transform.Translate(transform.up * (m_force * Time.deltaTime));
            Vector2      currentPosition = transform.position;
            RaycastHit2D hit             = Physics2D.Linecast(lastPosition, currentPosition);

            if (hit)
            {
                EventBus.Dispatch(BulletCollisionEventPayload.Create(this, hit.transform, hit.point, hit.normal));
            }
        }
 private void OnBulletColllision(BulletCollisionEventPayload payload)
 {
     GameManager.Instance.GameFactory.BulletFactory.DestroyEntity(payload.BulletEntity);
 }