private void OnActionAEvent(InputActionAEventPayload payload) { if (payload.State == InputActionStateEnum.Down && m_enable) { m_eventBus.Dispatch(BulletThrowEventPayload.Create(m_playerEntity.transform, m_playerEntity.transform.position, Vector2.up, 5)); } }
private void OnBulletThrowEvent(BulletThrowEventPayload payload) { if (payload.Sender != m_playerEntity.transform) { return; } m_currentBullets -= 1; m_eventBus.Dispatch(PlayerUpdateBulletEventPayload.Create(m_currentBullets)); }
private void OnBulletThrowEvent(BulletThrowEventPayload payload) { BulletEntity bulletEntity = GameManager.Instance.GameFactory.BulletFactory.Create(); bulletEntity.SetOwner(payload.Sender); bulletEntity.SetEventBus(m_eventBus); bulletEntity.transform.position = payload.FromPosition; bulletEntity.SetDirection(payload.ToDirection); bulletEntity.SetForce(payload.Force); GameManager.Instance.GameFactory.BulletFactory.DestroyEntity(bulletEntity, 10); GameManager.Instance.GameFactory.BulletFactory.DestroyEntity(bulletEntity, x => Vector2.Distance(payload.FromPosition, x.transform.position) > 10); }