/// <summary> /// From delegate HandgunController.BulletSpawnEventHandler /// </summary> public void Fire(GameObject hit, WeaponHandSide handSide) { //CmdHit(hit); if (hit != null && hit.tag.Contains(Constants.DefaultZombieTag)) { CmdFire(hit.transform.root.gameObject, handSide, hit.tag); } else { CmdFire(null, handSide, ""); } }
[Command] public void CmdFire(GameObject _hit, WeaponHandSide _handSide, string _tag) { if (_handSide == WeaponHandSide.Left) { GetComponent <PlayerWeaponsManager>().ShootLeft(); } else { GetComponent <PlayerWeaponsManager>().ShootRight(); } if (_hit != null) { var health = _hit.GetComponent <Zombie_Health>(); if (health != null) { health.TakeDamage(playerID, _tag, KillEnemy); } } }