private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { var vehicle = other.GetComponent <PlayerVehicle>(); vehicle.CmdPickUpResource(_type, _resourceCount); _spawnPool.Destroy(this); } }
private void OnTriggerEnter2D(Collider2D other) { //Use for explosion effect? //Collider[] colliders = Physics.OverlapSphere(transform.position, explosionRadius, layerMask); //Player collision if (other.CompareTag("Player")) { var vehicle = other.GetComponent <PlayerVehicle>(); var knockBackForce = _Body.velocity.normalized * weapon.knockBack; vehicle.CmdHitByProjectile(knockBackForce, weapon.damage); } //Destroy projectile _spawnPool.Destroy(this); }