示例#1
0
    protected override void Shoot(Transform shootPoint)
    {
        Vector3 trailTarget = shootPoint.transform.position + shootPoint.forward * _maxDistance;

        if (Physics.Raycast(new Ray(_aimingCamera.transform.position, _aimingCamera.transform.forward), out RaycastHit target, _maxDistance))
        {
            if (target.collider.gameObject.TryGetComponent(out DamageReceiver destroyable))
            {
                destroyable.TakeShot(_damage);
            }
        }

        BulletTrail trail = Instantiate(_trailPrefab, shootPoint.position, Quaternion.identity);

        trail.Init(trailTarget);
    }
示例#2
0
 public override void InitExtraFunc(int playerID, int itemID)
 {
     base.InitExtraFunc(playerID, itemID);
     trail.Init(player.color);
 }