bool CanCreateFx(FxType hisType) { bool canCreateFx = false; foreach (FxGameObject fxGameObject in FXGameObjectList) { // Check if tag name exist if (fxGameObject.fxType == hisType) { canCreateFx = true; // Check if gameobject exist if (fxGameObject.fxGameObject == null) { Debug.LogWarning("Can't find FX object !"); return(false); } else { FxGameObjectStocked = fxGameObject; } } } return(canCreateFx); }
public GameObject SendFx(FxType myTypeFx, Vector3 position) { FxGameObject fxGameObject = GetFxGameObject(myTypeFx); if (fxGameObject != null) { GameObject newFx = Instantiate(fxGameObject.fxGameObject); newFx.transform.position = position + fxGameObject.offset; return(newFx); } return(null); }
public void CreateFx(FxType myTypeFx, Vector3 position) { FxGameObject fxGameObject = GetFxGameObject(myTypeFx); if (fxGameObject != null) { if (fxGameObject.fxGameObject == null) { return; } GameObject newFx = Instantiate(fxGameObject.fxGameObject); newFx.transform.position = position + fxGameObject.offset; } }
FxGameObject GetFxGameObject(FxType type) { FxGameObject fxGameObject = null; for (int i = 0; i < FXGameObjectList.Length; i++) { if (FXGameObjectList[i].fxType == type) { fxGameObject = FXGameObjectList[i]; return(fxGameObject); } } return(fxGameObject); }
public void CreateFxThrow(FxType myTypeFx, Vector3 position, Quaternion roration) { FxGameObject fxGameObject = GetFxGameObject(myTypeFx); if (fxGameObject != null) { GameObject newFx = Instantiate(fxGameObject.fxGameObject); newFx.transform.position = position + fxGameObject.offset; if (myTypeFx == FxType.discThrow) { // Change the rotation newFx.transform.position = position + fxGameObject.offset; var modifiedRotation = roration.eulerAngles; modifiedRotation = new Vector3(modifiedRotation.x, modifiedRotation.y - 90, modifiedRotation.z); newFx.transform.rotation = Quaternion.Euler(modifiedRotation); } } }