public static int GetBaseLevel(this GameObject gameObject, GameObjectContainer saveFile) { ObjectReference objectReference = gameObject.GetPropertyValue <ObjectReference>("MyCharacterStatusComponent"); GameObject statusComponent = objectReference != null ? saveFile[objectReference] : null; return(statusComponent?.GetPropertyValue <int>("BaseCharacterLevel") ?? 1); }
public override void updateStage(float percent) { // update required game objects GameObjectContainer oc = GameObjectContainer.instance; if (this.getSubPercent(0, 0.3f, percent, out float percent1)) { // Remove Rings and Orbiting Planets oc.ringManagerScript.SetRingSpeed(Mathf.Lerp(initialSpeed, 0, percent1)); oc.PlanetOrbit.transform.localScale = Vector3.Lerp(planOrbitScale, Vector3.zero, percent1); oc.interactableManager.SetScalePercent(1 - percent1); } if (this.getSubPercent(0.3f, 0.6f, percent, out float percent2)) { // Darken Sky oc.skyboxManager.SetBlackPercent(percent2); } if (this.getSubPercent(0.3f, 0.8f, percent, out float percent3)) { // spinning and shrinking fractal oc.mandelBulbRig.AddTorque(new Vector3(1, 3, 1), ForceMode.Acceleration); oc.Mendelbulb.transform.localScale = Vector3.Lerp(mandleBulbScale, Vector3.zero, percent3); } if (this.getSubPercent(0.8f, 1, percent, out float percent4)) { // start explosion } }
// Use this for initialization void Start() { player = GameObject.Find("Player"); movingPlayer = false; gameObjects = GameObjectContainer.Instance; }
public override void transisionFromStage(float percent) { // used for the transion from the stage GameObjectContainer oc = GameObjectContainer.instance; oc.PlanetOrbit.transform.localScale = Vector3.Lerp(this.GoalScale, Vector3.zero, percent); }
public MainEventProcessor(GameObjectContainer gameObjectContainer, GameObjectFactory factory, EventBus eventBus) { _objectFactory = factory; _objectContainer = gameObjectContainer; _eventBus = eventBus; _initializeSubscriptions(); }
/// <summary> /// Initialize an AssetContainer to represent the given UnityObject /// This will scan the object for missing references and retain the information for display in /// the given window. /// </summary> /// <param name="unityObject">The main UnityObject for this asset</param> /// <param name="path">The path to this asset, for gathering sub-assets</param> /// <param name="options">User-configurable options for this view</param> public AssetContainer(UnityObject unityObject, string path, Options options) { m_Object = unityObject; CheckForMissingReferences(unityObject, PropertiesWithMissingReferences, options); // Collect any sub-asset references foreach (var asset in AssetDatabase.LoadAllAssetRepresentationsAtPath(path)) { if (asset is GameObject prefab) { var gameObjectContainer = new GameObjectContainer(prefab, options); if (gameObjectContainer.Count > 0) { SubAssets.Add(gameObjectContainer); } } else { var assetContainer = new AssetContainer(asset, options); if (assetContainer.PropertiesWithMissingReferences.Count > 0) { SubAssets.Add(assetContainer); } } } }
public void createPrefabObjects() { // load all Gameobjects in the other objects this.CityGameObjects = new GameObjectContainer(this.terr.cityStages, this.terr.cityGroundFloors, this.terr.cityRooftops); // ... other Objects }
public override void transisionToStage(float percent) { // used for the transion from initial load to fully loaded GameObjectContainer oc = GameObjectContainer.instance; oc.PlanetOrbit.transform.localScale = Vector3.Lerp(Vector3.zero, this.GoalScale, percent); }
public void OnViewFrameTime(float dt) { int num = this.loadQueue.Count - 1; AssetRequest assetRequest = this.loadQueue[num]; this.LoadQueueRemoveAt(num); string assetName = assetRequest.AssetName; GameObjectContainer gameObjectContainer = this.cache[assetName]; GameObject gameObj = gameObjectContainer.GameObj; gameObj.SetActive(true); if (gameObjectContainer.Flagged) { Service.Get <StaRTSLogger>().Error("Cannot use a cached screen multiple times: " + gameObj.name); if (assetRequest.OnFailure != null) { assetRequest.OnFailure(assetRequest.Cookie); return; } } else { gameObjectContainer.Flagged = true; if (assetRequest.OnSuccess != null) { assetRequest.OnSuccess(gameObj, assetRequest.Cookie); } } }
void Awake() { // implementing singleton pattern with this class if (instance == null) { instance = this; } }
public GameObject GetObject(GameObjectContainer objectContainer) { if (ObjectType == TypeId && ObjectId > -1 && ObjectId < objectContainer.Objects.Count) { return(objectContainer.Objects[ObjectId]); } return(null); }
public void Despawn() { while (spawnedList.Count > 0) { GameObjectContainer toDespawn = spawnedList[0]; spawnedList.RemoveAt(0); GameObjUtil.Destroy(toDespawn.gameObject); } }
public ObjectCollector(GameObjectContainer container, int startIndex = 0) { this.startIndex = startIndex; foreach (GameObject obj in container) { MappedObjects[obj.Id + startIndex] = obj; } insertIndex = MappedObjects.Count + startIndex; }
public static async Task <IEnumerable <StructuresViewModel> > ReadStructures(string mapName, string filename) { GameObjectContainer gameObjectContainer = filename != null ? await SavegameService.GetGameObjectsForFile(filename) : await SavegameService.GetGameObjects(mapName); return(extractStructures(gameObjectContainer, MapData.For(mapName)) .OrderBy(s => s.Key) .Select(structureLine => new StructuresViewModel(structureLine.Key.Item1, structureLine.Key.Item2, structureLine.Count(), structureLine.Key.Item3, structureLine.ToList()))); }
public override void updateStage(float percent) { // update required game objects GameObjectContainer oc = GameObjectContainer.instance; if (this.getSubPercent(0, 0.1f, percent, out float subpercent)) { oc.ringManagerScript.SetRingEmission(Mathf.Lerp(0, 3, subpercent)); } }
public override void unloadStageFromGameView() { // sets all gameobject to inactive GameObjectContainer oc = GameObjectContainer.instance; //oc.CommitDeActivation(oc.InteractableOrbs); oc.CommitDeActivation(oc.Mendelbulb); oc.CommitDeActivation(oc.RFloor); this.isLoaded = false; }
public override void loadStageToGameView() { GameObjectContainer oc = GameObjectContainer.instance; oc.CommitDeActivation(oc.InteractableOrbs); oc.CommitDeActivation(oc.Mendelbulb); oc.CommitDeActivation(oc.PlanetOrbit); oc.CommitDeActivation(oc.RFloor); oc.CommitDeActivation(oc.Rings); this.isLoaded = true; }
public override void loadStageToGameView() { // sets required game objects to active and starting state GameObjectContainer oc = GameObjectContainer.instance; oc.CommitActivation(oc.InteractableOrbs); oc.CommitActivation(oc.Mendelbulb); oc.CommitActivation(oc.RFloor); oc.CommitActivation(oc.Rings); this.isLoaded = true; }
public override void unloadStageFromGameView() { // sets all gameobject to inactive GameObjectContainer oc = GameObjectContainer.instance; oc.CommitDeActivation(oc.Mendelbulb); oc.CommitDeActivation(oc.RFloor); this.path.setPercent(1); this.path.enabled = false; this.isLoaded = false; }
private void LoadDownloadFile(string url, bool isStreamingAsset, Action <MultilanguageResultCode, MulitlanguageXml, string> callback) { Action <MultilanguageResultCode, string, string> requestCallback = (result, loadText, resultMessage) => { if (result != MultilanguageResultCode.SUCCESS) { callback(result, null, resultMessage); return; } if (string.IsNullOrEmpty(loadText) == true) { callback(MultilanguageResultCode.FILE_PARSING_ERROR, null, null); return; } XMLManager.LoadXMLFromText <MulitlanguageXml>( loadText, (xmlResultCode, xmlData, xmlResultMessage) => { callback(GetResultCode(xmlResultCode), xmlData, xmlResultMessage); }); }; IEnumerator loadEnumerator = null; #if !UNITY_2017_1_OR_NEWER && !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS) if (isStreamingAsset == true) { loadEnumerator = LoadStreamingAssetFile(url, requestCallback); } else #endif { loadEnumerator = DownloadFile(url, requestCallback); } #if UNITY_EDITOR if (UnityEditor.EditorApplication.isPlaying == false) { EditorCoroutine.Start(loadEnumerator); } else #endif { if (monoObject == null) { monoObject = GameObjectContainer.GetGameObject(MultilanguageManager.SERVICE_NAME).GetComponent <MonoBehaviour>(); } monoObject.StartCoroutine(loadEnumerator); } }
public void Despawn(string name) { for (int i = 0; i < spawnedList.Count; i++) { GameObjectContainer goc = spawnedList[i]; if (string.Compare(goc.name, name) == 0) { spawnedList.RemoveAt(i); GameObjUtil.Destroy(goc.gameObject); i--; } } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); gameObjectContainer = target as GameObjectContainer; GUILayout.BeginHorizontal(); if (GUILayout.Button("Load", GUILayout.Width(100))) { this.gameObjectContainer.LoadGameObjects(); } GUILayout.EndHorizontal(); }
public ObjectCollector(GameObjectContainer container, GameObject gameObject, bool followReferences, bool withComponents) { Stack <IPropertyContainer> toVisit = new Stack <IPropertyContainer>(); startIndex = 0; MappedObjects[gameObject.Id] = gameObject; toVisit.Push(gameObject); visit(toVisit, container, followReferences, withComponents); insertIndex = MappedObjects.Any() ? MappedObjects.Keys.Max() : 0; }
/// <summary> /// Reset transform and call IPoolable.Spawn on components. /// </summary> private static void RecycleItem(GameObjectContainer container, Vector3 position, Quaternion rotation) { var t = container.Object.transform; t.rotation = rotation; t.position = position; container.Object.SetActive(true); container.Cycles++; foreach (var c in container.PoolingEnabledComponents) { c.Spawn(); } }
public override void updateStage(float percent) { // update required game objects GameObjectContainer oc = GameObjectContainer.instance; if (this.getSubPercent(0, 0.3f, percent, out float subpercent)) { oc.Mendelbulb.transform.localScale = Vector3.Lerp(initialScale, Vector3.zero, subpercent); oc.ringManagerScript.SetRingSize(Mathf.Lerp(this.initalSize, 0.1f, subpercent)); } oc.ringManagerScript.SetRingSpeed(Mathf.Lerp(initialSpeed, 2, percent)); oc.ringManagerScript.SetRingEmission(Mathf.Lerp(intialEmission, 0, percent)); }
public override void unloadStageFromGameView() { // sets all gameobject to inactive GameObjectContainer oc = GameObjectContainer.instance; oc.CommitDeActivation(oc.InteractableOrbs); oc.CommitDeActivation(oc.Mendelbulb); oc.CommitDeActivation(oc.RFloor); oc.CommitDeActivation(oc.PlanetOrbit); oc.PlanetOrbit.transform.localScale = Vector3.zero; this.isLoaded = false; AudioManager.instance.FadeOutPlanet(); }
public override void loadStageToGameView() { // sets required game objects to active and starting state GameObjectContainer oc = GameObjectContainer.instance; oc.CommitActivation(oc.Mendelbulb); oc.CommitActivation(oc.RFloor); oc.CommitActivation(oc.Rings); oc.ringManagerScript.SetRingEmission(0); oc.ringManagerScript.SetRingOrbital(new Vector3(0, 4, 0)); oc.ringManagerScript.StartRings(); oc.mandelBulbScript.StartPulsating(); this.isLoaded = true; }
/// <summary> /// Scan the contents of a given path and add the results as a subfolder to this container /// </summary> /// <param name="path">The path to scan</param> /// <param name="options">User-configurable options for this view</param> public void AddAssetAtPath(string path, Options options) { var asset = AssetDatabase.LoadAssetAtPath <UnityObject>(path); // Prefabs are processed differently so that we can scan components and children // Model prefabs may contain materials which we want to scan. The "real prefab" as a sub-asset if (asset is GameObject prefab && PrefabUtility.GetPrefabAssetType(asset) != PrefabAssetType.Model) { var gameObjectContainer = new GameObjectContainer(prefab, options); if (gameObjectContainer.Count > 0) { GetOrCreateFolderForAssetPath(path).m_Assets.Add(gameObjectContainer); } }
public DroppedItem(GameObject droppedItem, GameObjectContainer container) { className = droppedItem.ClassName; CreatureData structureData = ArkDataManager.GetStructure(droppedItem.ClassString); type = structureData != null ? structureData.Name : droppedItem.ClassString; location = droppedItem.Location; myItem = droppedItem.GetPropertyValue <ObjectReference, GameObject>("MyItem", map: reference => container[reference]); droppedByName = droppedItem.GetPropertyValue <string>("DroppedByName", defaultValue: string.Empty); targetingTeam = droppedItem.GetPropertyValue <int>("TargetingTeam"); originalCreationTime = droppedItem.GetPropertyValue <double>("OriginalCreationTime"); initialLifeSpan = droppedItem.GetPropertyValue <float>("InitialLifeSpan", defaultValue: float.PositiveInfinity); }
public override void loadStageToGameView() { // sets required game objects to active and starting state GameObjectContainer oc = GameObjectContainer.instance; //oc.CommitActivation(oc.InteractableOrbs); oc.CommitActivation(oc.Mendelbulb); oc.CommitActivation(oc.RFloor); oc.CommitActivation(oc.Rings); oc.CommitActivation(oc.PlanetOrbit); oc.PlanetOrbit.transform.localScale = Vector3.zero; this.isLoaded = true; AudioManager.instance.PlayPlanetTrack(); }
public InitView(GameObject go) { this.m_Go = go; GameObjectContainer container = go.GetComponent <GameObjectContainer>(); if (container == null) { return; } m_TitleText = container.GetUI <Text>(1); m_ProgressImg = container.GetUI <Image>(2); m_DetailText = container.GetUI <Text>(3); m_VersionText = container.GetUI <Text>(4); }
public void Find( GameObject gameObject, string memberName, params object[] parameters ) { var container = new GameObjectContainer( gameObject ); for ( int i = 0; i < container.Members.Count; i++ ) { var member = container.Members[i]; if ( member == null ) continue; if ( member.Name != memberName ) continue; if ( member.Parameters.Count != parameters.Length ) continue; var foundMember = true; foreach ( var mParam in member.Parameters ) { var foundParameter = false; foreach ( var pParam in parameters ) { var t = pParam.GetType(); if ( mParam.Type == t || t.IsSubclassOf( mParam.Type ) ) { foundParameter = true; break; } } if ( !foundParameter ) { foundMember = false; break; } } if ( !foundMember ) continue; container.Index = i; foreach ( var mParam in member.Parameters ) { foreach ( var pParam in parameters ) { if ( mParam.Type != pParam.GetType() ) continue; switch ( mParam.TypeName ) { case "String": mParam.StringValue = (string)pParam; break; case "Int32": mParam.IntValue = (int)pParam; break; case "Int64": mParam.LongValue = (long)pParam; break; case "Single": mParam.FloatValue = (float)pParam; break; case "Double": mParam.DoubleValue = (double)pParam; break; case "Boolean": mParam.BoolValue = (bool)pParam; break; case "Vector2": mParam.Vector2Value = (Vector2)pParam; break; case "Vector3": mParam.Vector3Value = (Vector3)pParam; break; case "Vector4": mParam.Vector4Value = (Vector4)pParam; break; case "Quaternion": mParam.QuaternionValue = (Quaternion)pParam; break; case "Bounds": mParam.BoundsValue = (Bounds)pParam; break; case "Rect": mParam.RectValue = (Rect)pParam; break; case "Matrix4x4": mParam.MatrixValue = (Matrix4x4)pParam; break; case "AnimationCurve": mParam.AnimationCurveValue = (AnimationCurve)pParam; break; case "Object": case "GameObject": mParam.ObjectValue = (UnityEngine.Object)pParam; break; case "Enum": for ( int j = 0; j < mParam.EnumNames.Length; j++ ) { if ( mParam.EnumNames[j] == pParam.ToString() ) { mParam.EnumValue = j; break; } } break; default: Debug.LogErrorFormat( "The type {0} is not supported", mParam.Type.Name ); break; } } } Listeners.Add( container ); break; } }