Created
April 17, 2020 19:01
-
-
Save sanyae2439/964ad6f4c0a623fcf5a94ba0a9e6e75e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void SpawnGrenade(Vector3 position, bool isFlash = false, float fusedur = -1, ReferenceHub player = null) | |
{ | |
if(player == null) player = ReferenceHub.GetHub(PlayerManager.localPlayer); | |
var gm = player.GetComponent<Grenades.GrenadeManager>(); | |
Grenades.Grenade component = UnityEngine.Object.Instantiate(gm.availableGrenades[isFlash ? (int)GRENADE_ID.FLASH_NADE : (int)GRENADE_ID.FRAG_NADE].grenadeInstance).GetComponent<Grenades.Grenade>(); | |
if(fusedur != -1) component.fuseDuration = fusedur; | |
component.FullInitData(gm, position, Quaternion.Euler(component.throwStartAngle), Vector3.zero, component.throwAngularVelocity); | |
NetworkServer.Spawn(component.gameObject); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment