[SerializeField] private BulletProjector _projector; //todo manager #endregion #region ICollision public void OnCollision(InfoCollision info) { if (_projector == null) { return; } var projectorRotation = Quaternion.FromToRotation(-Vector3.forward, info.Contact.normal); var obj = Instantiate(_projector, info.Contact.point + info.Contact.normal * 0.25f, projectorRotation, info.ObjectCollision); //manager; obj.transform.rotation = Quaternion.Euler(obj.transform.eulerAngles.x, obj.transform.eulerAngles.y, Random.Range(0, 360)); }
public void OnCollision(InfoCollision info) { if (_isDead) { return; } if (HealthPoint > 0) { HealthPoint -= info.Damage; } if (HealthPoint <= 0) { if (!TryGetComponent <Rigidbody>(out _)) { gameObject.AddComponent <Rigidbody>(); } Destroy(gameObject, _timeToDestroy); OnPointChange.Invoke(); _isDead = true; } }
public void OnCollision(InfoCollision info) { OnApplyDamageChange.Invoke(new InfoCollision(info.Damage * 500, info.Contact, info.ObjectCollision, info.Direction)); }
public void OnCollision(InfoCollision info) { OnApplyDamageChange.Invoke(info); }