private void Inspect(GameObject gameObject, string name, GameObjectEx parent)
        {
            var currentPath = new List <uint>();

            if (parent != null)
            {
                currentPath.AddRange(parent.Path);
            }
            currentPath.Add(gameObject.Id);
            var gameObjectEx = new GameObjectEx(gameObject, currentPath.ToArray(), name);

            _extendedInfo[gameObject.Id] = gameObjectEx;

            if (gameObject.Type == ObjectType.Object)
            {
                foreach (var property in gameObject.Properties)
                {
                    Inspect(GameObjects[property.Value], property.Key, gameObjectEx);
                }
            }
            else if (gameObject.Type == ObjectType.Array)
            {
                var index = 0;
                foreach (var id in gameObject.Array)
                {
                    Inspect(GameObjects[id], "[" + index++ + "]", gameObjectEx);
                }
            }
        }
Пример #2
0
    public void DoRadialDamage()
    {
        List <Collider> obj      = Pool.GetList <Collider>();
        Vector3         position = base.transform.position + new Vector3(0f, radius * 0.75f, 0f);

        Vis.Colliders(position, radius, obj, AttackLayers);
        HitInfo hitInfo = new HitInfo();

        hitInfo.DoHitEffects = true;
        hitInfo.DidHit       = true;
        hitInfo.HitBone      = 0u;
        hitInfo.Initiator    = ((creatorEntity == null) ? GameObjectEx.ToBaseEntity(base.gameObject) : creatorEntity);
        hitInfo.PointStart   = base.transform.position;
        foreach (Collider item in obj)
        {
            if (item.isTrigger && (item.gameObject.layer == 29 || item.gameObject.layer == 18))
            {
                continue;
            }
            BaseCombatEntity baseCombatEntity = GameObjectEx.ToBaseEntity(item.gameObject) as BaseCombatEntity;
            if (!(baseCombatEntity == null) && baseCombatEntity.isServer && baseCombatEntity.IsAlive() && (!ignoreNPC || !baseCombatEntity.IsNpc) && baseCombatEntity.IsVisible(position))
            {
                if (baseCombatEntity is BasePlayer)
                {
                    Effect.server.Run("assets/bundled/prefabs/fx/impacts/additive/fire.prefab", baseCombatEntity, 0u, new Vector3(0f, 1f, 0f), Vector3.up);
                }
                hitInfo.PointEnd         = baseCombatEntity.transform.position;
                hitInfo.HitPositionWorld = baseCombatEntity.transform.position;
                hitInfo.damageTypes.Set(DamageType.Heat, damagePerSecond * tickRate);
                Interface.CallHook("OnFireBallDamage", this, baseCombatEntity, hitInfo);
                baseCombatEntity.OnAttacked(hitInfo);
            }
        }
        Pool.FreeList(ref obj);
    }
Пример #3
0
 public override void Process(uint seed)
 {
     if (RoadMeshes == null || RoadMeshes.Length == 0)
     {
         RoadMeshes = new Mesh[1] {
             RoadMesh
         };
     }
     foreach (PathList road in TerrainMeta.Path.Roads)
     {
         if (road.IsExtraNarrow)
         {
             continue;
         }
         foreach (PathList.MeshObject item in road.CreateMesh(RoadMeshes, 0f))
         {
             GameObject obj = new GameObject("Road Mesh");
             obj.transform.position = item.Position;
             obj.layer = 16;
             GameObjectEx.SetHierarchyGroup(obj, road.Name);
             obj.SetActive(false);
             MeshCollider meshCollider = obj.AddComponent <MeshCollider>();
             meshCollider.sharedMaterial = RoadPhysicMaterial;
             meshCollider.sharedMesh     = item.Meshes[0];
             obj.AddComponent <AddToHeightMap>();
             obj.SetActive(true);
         }
     }
 }
Пример #4
0
    public void ProcessCollision(Collision collision)
    {
        if (base.isClient || collision == null || collision.gameObject == null || collision.gameObject == null)
        {
            return;
        }
        ContactPoint contact    = collision.GetContact(0);
        BaseEntity   baseEntity = null;

        if (contact.otherCollider.attachedRigidbody == rigidBody)
        {
            baseEntity = GameObjectEx.ToBaseEntity(contact.otherCollider);
        }
        else if (contact.thisCollider.attachedRigidbody == rigidBody)
        {
            baseEntity = GameObjectEx.ToBaseEntity(contact.thisCollider);
        }
        if (baseEntity != null)
        {
            float forceMagnitude = collision.impulse.magnitude / UnityEngine.Time.fixedDeltaTime;
            if (QueueCollisionDamage(baseEntity, forceMagnitude) > 0f)
            {
                ShowCollisionFX(collision);
            }
        }
    }
Пример #5
0
 protected void UpdateBaseEntity()
 {
     if ((bool)this && (bool)base.gameObject)
     {
         _baseEntity = GameObjectEx.ToBaseEntity(base.gameObject) as T;
     }
 }
Пример #6
0
    internal override GameObject InterestedInObject(GameObject obj)
    {
        obj = base.InterestedInObject(obj);
        if (obj == null)
        {
            return(null);
        }
        BaseEntity baseEntity = GameObjectEx.ToBaseEntity(obj);

        if (baseEntity == null)
        {
            return(null);
        }
        if (baseEntity.isClient)
        {
            return(null);
        }
        if (!baseEntity.syncPosition)
        {
            return(null);
        }
        if (!baseEntity.GetComponent <MagnetLiftable>())
        {
            return(null);
        }
        return(baseEntity.gameObject);
    }
Пример #7
0
 private void InternalAttachGameObject(GameObjectEx go)
 {
     GameObject = go;
     Animator   = GameObject.gameObject.GetComponent <Animator>();
     UnityObject.DontDestroyOnLoad(GameObject.gameObject);
     OnAttachGameObject(go);
 }
		static void MergeScenes()
		{
			Scene activeScene = new Scene();
			AmsMultiSceneSetup activeSetup = null;
			List<AmsMultiSceneSetup.SceneEntry> bakedScenes = new List<AmsMultiSceneSetup.SceneEntry>();

			GetCommonParameters( ref activeScene, ref activeSetup, bakedScenes );
			if ( bakedScenes.Count < 1 )
				return;

			AmsDebug.Log( null, "Running AMS MergeScenes on Scene {0} ({1})", activeScene.name, activeSetup.scenePath );

			foreach( var entry in bakedScenes )
			{
				if ( !entry.scene.isLoaded )
				{
					AmsDebug.LogError( activeSetup, "Could not merge non-loaded scene: {0}", entry.scene.name );
					continue;
				}

				// Merge the cross-scene references (and keep track of the merges)
				var bakedSceneSetup = GameObjectEx.GetSceneSingleton<AmsMultiSceneSetup>( entry.scene.scene, false );
				if ( bakedSceneSetup )
					AmsCrossSceneReferences.EditorBuildPipelineMergeScene( bakedSceneSetup, activeSetup );

				AmsDebug.Log( null, "Running Unity MergeScenes for {0} into {1}", entry.scene.name, activeScene.name );
				EditorSceneManager.MergeScenes( entry.scene.scene, activeScene );
			}
		} // MergeScenes
Пример #9
0
 public override void Process(uint seed)
 {
     RiverMeshes = new Mesh[1] {
         RiverMesh
     };
     foreach (PathList river in TerrainMeta.Path.Rivers)
     {
         foreach (PathList.MeshObject item in river.CreateMesh(RiverMeshes, 0.1f))
         {
             GameObject obj = new GameObject("River Mesh");
             obj.transform.position = item.Position;
             obj.tag   = "River";
             obj.layer = 4;
             GameObjectEx.SetHierarchyGroup(obj, river.Name);
             obj.SetActive(false);
             MeshCollider meshCollider = obj.AddComponent <MeshCollider>();
             meshCollider.sharedMaterial = RiverPhysicMaterial;
             meshCollider.sharedMesh     = item.Meshes[0];
             obj.AddComponent <RiverInfo>();
             obj.AddComponent <WaterBody>();
             obj.AddComponent <AddToWaterMap>();
             obj.SetActive(true);
         }
     }
 }
Пример #10
0
    public BaseEntity CreateConstruction(Target target, bool bNeedsValidPlacement = false)
    {
        GameObject gameObject = GameManager.server.CreatePrefab(fullName, Vector3.zero, Quaternion.identity, false);
        bool       flag       = UpdatePlacement(gameObject.transform, this, ref target);
        BaseEntity baseEntity = GameObjectEx.ToBaseEntity(gameObject);

        if (bNeedsValidPlacement && !flag)
        {
            if (BaseEntityEx.IsValid(baseEntity))
            {
                baseEntity.Kill();
            }
            else
            {
                GameManager.Destroy(gameObject);
            }
            return(null);
        }
        DecayEntity decayEntity = baseEntity as DecayEntity;

        if ((bool)decayEntity)
        {
            decayEntity.AttachToBuilding(target.entity as DecayEntity);
        }
        return(baseEntity);
    }
Пример #11
0
        public void Start()
        {
            _visibilities = GetComponentsInChildren <Visibility>();
            _mainPlayer   = GameObjectEx.FindGameObjectWithTag(GameObjectTags.Player).transform;
            var shadowLayer = Layers.GetLayer(LayerName.ShadowLayer);

            _layerMask = (1 << shadowLayer) | (1 << Layers.GetLayer(LayerName.Player));
        }
Пример #12
0
 /// <summary>
 /// Entity附加GameObject;
 /// </summary>
 /// <param name="go"></param>
 protected virtual void OnAttachGoEx(GameObjectEx go)
 {
     gameObjectEx = go;
     if (_entityLoadFinishHandler != null)
     {
         _entityLoadFinishHandler(this, gameObjectEx.gameObject);
     }
 }
        public UniqueObject(Object obj)
        {
            scene                    = new AmsSceneReference();
            fullPath                 = string.Empty;
            componentName            = string.Empty;
            version                  = CurrentSerializedVersion;
            componentIndex           = 0;
            editorLocalId            = 0;
            editorPrefabRelativePath = string.Empty;

            if (!obj)
            {
                return;
            }

            GameObject gameObject = GameObjectEx.EditorGetGameObjectFromComponent(obj);

            if (gameObject)
            {
                scene    = new AmsSceneReference(gameObject.scene);
                fullPath = gameObject.GetFullName();

                Component comp = obj as Component;
                if (comp)
                {
                    componentName = obj.GetType().AssemblyQualifiedName;
                    gameObject.GetComponents(obj.GetType(), _reusableComponentsList);
                    componentIndex = _reusableComponentsList.IndexOf(comp);
                }
            }

#if UNITY_2018_3_OR_NEWER
            // Get the nearest root (which will have an editor id)
            var prefabObj = PrefabUtility.GetPrefabInstanceHandle(obj);
            if (prefabObj)
            {
                editorLocalId = GetEditorId(prefabObj);

                var prefabRoot = PrefabUtility.GetOutermostPrefabInstanceRoot(obj);
                editorPrefabRelativePath = TransformEx.GetPathRelativeTo(gameObject.transform, prefabRoot.transform);
            }
#else
            // Get the prefab object
            var prefabObj = PrefabUtility.GetPrefabObject(obj);
            if (prefabObj)
            {
                GameObject prefabRoot = PrefabUtility.FindPrefabRoot(gameObject);
                editorLocalId            = prefabRoot ? GetEditorId(prefabRoot) : GetEditorId(obj);
                editorPrefabRelativePath = TransformEx.GetPathRelativeTo(gameObject.transform, prefabRoot.transform);
            }
#endif

            if (editorLocalId == 0)
            {
                editorLocalId = GetEditorId(obj);
            }
        }
Пример #14
0
        /// <summary>
        /// Resolve a cross-scene reference if possible.
        /// </summary>
        /// <returns>The cross-scene referenced object if it's possible</returns>
        private Object  RuntimeResolve()
        {
            var scene = this.scene.scene;

            if (!scene.IsValid())
            {
                return(null);
            }

            // Try to find the Object with our custom method that checks only the subscene
            GameObject gameObject = GameObjectEx.FindBySceneAndPath(scene, fullPath);

            // If that fails, we can try using Unity's GameObject.Find in case the user has switched it on us, or
            // in the case that's it's in a DontDestroyOnLoad scene
            if (!gameObject)
            {
                gameObject = GameObject.Find(fullPath);

                // It's truly failed
                if (!gameObject)
                {
                    return(null);
                }
                else
                {
                    AmsDebug.LogWarning(gameObject, "UniqueObject '{0}' resolved unexpected to '{1}'{2}.  Did you move it manually?", this, gameObject.scene.name, gameObject.GetFullName());
                }
            }

            if (string.IsNullOrEmpty(componentName))
            {
                return(gameObject);
            }

            // This is the old method where we didn't store the component index (deprecated)
            if (version < 1)
            {
                Component oldStyleComponent = gameObject.GetComponent(componentName);
                if (componentIndex < 0 || oldStyleComponent)
                {
                    return(oldStyleComponent);
                }
            }

            // Get the component and index
            System.Type type = System.Type.GetType(componentName, false);
            if (type != null)
            {
                gameObject.GetComponents(type, _reusableComponentsList);
                if (componentIndex < _reusableComponentsList.Count)
                {
                    return(_reusableComponentsList[componentIndex]);
                }
            }

            return(null);
        }
Пример #15
0
 public ChangerFloat Create(string t_propertyName, GameObjectEx t_invoker, float t_time, float t_startVal, float t_endVal)
 {
     m_property = t_invoker.GetType().GetProperty(t_propertyName);
     m_time = t_time;
     m_startVal = t_startVal;
     m_endVal = t_endVal;
     m_activated = true;
     m_invoker = t_invoker;
     return this;
 }
Пример #16
0
 public void Clear()
 {
     if (IsSpawned)
     {
         BaseEntity baseEntity = GameObjectEx.ToBaseEntity(spawnInstance.gameObject);
         if (baseEntity != null)
         {
             baseEntity.Kill();
         }
     }
 }
Пример #17
0
            public static RendererInstance From(Renderer renderer)
            {
                RendererInstance result = default(RendererInstance);

                result.IsVisible      = renderer.isVisible;
                result.CastShadows    = renderer.shadowCastingMode != ShadowCastingMode.Off;
                result.RecieveShadows = renderer.receiveShadows;
                result.Enabled        = renderer.enabled && renderer.gameObject.activeInHierarchy;
                result.Size           = renderer.bounds.size.magnitude;
                result.Distance       = Vector3.Distance(renderer.bounds.center, Camera.main.transform.position);
                result.MaterialCount  = renderer.sharedMaterials.Length;
                result.RenderType     = renderer.GetType().Name;
                BaseEntity baseEntity = GameObjectEx.ToBaseEntity(renderer.gameObject);

                if ((bool)baseEntity)
                {
                    result.EntityName = baseEntity.PrefabName;
                    if (baseEntity.net != null)
                    {
                        result.EntityId = baseEntity.net.ID;
                    }
                }
                else
                {
                    result.ObjectName = TransformEx.GetRecursiveName(renderer.transform);
                }
                if (renderer is MeshRenderer)
                {
                    result.BoneCount = 0;
                    MeshFilter component = renderer.GetComponent <MeshFilter>();
                    if ((bool)component)
                    {
                        result.ReadMesh(component.sharedMesh);
                    }
                }
                if (renderer is SkinnedMeshRenderer)
                {
                    SkinnedMeshRenderer skinnedMeshRenderer = renderer as SkinnedMeshRenderer;
                    result.ReadMesh(skinnedMeshRenderer.sharedMesh);
                    result.UpdateWhenOffscreen = skinnedMeshRenderer.updateWhenOffscreen;
                }
                if (renderer is ParticleSystemRenderer)
                {
                    ParticleSystem component2 = renderer.GetComponent <ParticleSystem>();
                    if ((bool)component2)
                    {
                        result.MeshName      = component2.name;
                        result.ParticleCount = component2.particleCount;
                    }
                }
                return(result);
            }
Пример #18
0
    private bool OnGround()
    {
        BaseEntity component = GetComponent <BaseEntity>();

        if ((bool)component)
        {
            Construction construction = PrefabAttribute.server.Find <Construction>(component.prefabID);
            if ((bool)construction)
            {
                Socket_Base[] allSockets = construction.allSockets;
                for (int i = 0; i < allSockets.Length; i++)
                {
                    SocketMod[] socketMods = allSockets[i].socketMods;
                    for (int j = 0; j < socketMods.Length; j++)
                    {
                        SocketMod_AreaCheck socketMod_AreaCheck = socketMods[j] as SocketMod_AreaCheck;
                        if ((bool)socketMod_AreaCheck && socketMod_AreaCheck.wantsInside && !socketMod_AreaCheck.DoCheck(component.transform.position, component.transform.rotation))
                        {
                            if (ConVar.Physics.groundwatchdebug)
                            {
                                Debug.Log("GroundWatch failed: " + socketMod_AreaCheck.hierachyName);
                            }
                            return(false);
                        }
                    }
                }
            }
        }
        List <Collider> obj = Facepunch.Pool.GetList <Collider>();

        Vis.Colliders(base.transform.TransformPoint(groundPosition), radius, obj, layers);
        foreach (Collider item in obj)
        {
            BaseEntity baseEntity = GameObjectEx.ToBaseEntity(item.gameObject);
            if (!baseEntity || (!(baseEntity == component) && !baseEntity.IsDestroyed && !baseEntity.isClient))
            {
                DecayEntity decayEntity  = component as DecayEntity;
                DecayEntity decayEntity2 = baseEntity as DecayEntity;
                if (!decayEntity || decayEntity.buildingID == 0 || !decayEntity2 || decayEntity2.buildingID == 0 || decayEntity.buildingID == decayEntity2.buildingID)
                {
                    Facepunch.Pool.FreeList(ref obj);
                    return(true);
                }
            }
        }
        if (ConVar.Physics.groundwatchdebug)
        {
            Debug.Log("GroundWatch failed: Legacy radius check");
        }
        Facepunch.Pool.FreeList(ref obj);
        return(false);
    }
Пример #19
0
		private static void HandleSavingScenes( IList<Scene> scenes )
		{
			// We need to create an AmsMultiSceneSetup singleton in every scene.  This is how we keep track of Awake scenes and
			// it also allows us to use cross-scene references.
			foreach( var scene in scenes )
			{
				if ( !scene.isLoaded )
					continue;

				var sceneSetup = GameObjectEx.GetSceneSingleton<AmsMultiSceneSetup>( scene, true );
				sceneSetup.OnBeforeSerialize();
			}
		}
        private void MergeScene(SceneEntry entry)
        {
            var scene = entry.scene.scene;

            // Make sure there is only ever one AmsMultiSceneSetup in a given scene
            var sourceSetup = GameObjectEx.GetSceneSingleton <AmsMultiSceneSetup>(scene, false);

            if (sourceSetup)
            {
                GameObject.Destroy(sourceSetup.gameObject);
            }

            AmsDebug.Log(this, "Merging {0} into {1}", scene.path, gameObject.scene.path);
            SceneManager.MergeScenes(scene, gameObject.scene);
        }
Пример #21
0
		/// <summary>
		/// When a scene is opened, determine if we must add an AmsMultiSceneSetup to it
		/// </summary>
		/// <param name="scene">The scene that was opened</param>
		/// <param name="mode">How it was opened</param>
		private static void EditorSceneManager_sceneOpened( Scene scene, OpenSceneMode mode )
		{
			if ( !scene.isLoaded )
				return;

			var sceneSetup = GameObjectEx.GetSceneSingleton<AmsMultiSceneSetup>( scene, false );
			if ( !sceneSetup )
			{
				sceneSetup = GameObjectEx.GetSceneSingleton<AmsMultiSceneSetup>( scene, true );
				sceneSetup.transform.SetSiblingIndex(0);

				// Let's not mark it dirty as it doesn't need to be dirtied (really) as nothing's changed yet.
				//EditorSceneManager.MarkSceneDirty( scene );
			}
		}
Пример #22
0
 public override void ObjectEntered(GameObject obj)
 {
     if (!base.isClient)
     {
         if (!Armed())
         {
             CancelInvoke(Arm);
             blocked = true;
         }
         else if (Interface.CallHook("OnTrapTrigger", this, obj) == null)
         {
             BasePlayer ply = GameObjectEx.ToBaseEntity(obj) as BasePlayer;
             Trigger(ply);
         }
     }
 }
Пример #23
0
 public void DelayedFire()
 {
     if ((bool)hurtTarget)
     {
         BaseEntity baseEntity = GameObjectEx.ToBaseEntity(hurtTarget);
         if (baseEntity != null)
         {
             HitInfo hitInfo = new HitInfo(this, baseEntity, DamageType.Bite, 50f, base.transform.position);
             hitInfo.damageTypes.Add(DamageType.Stab, 30f);
             baseEntity.OnAttacked(hitInfo);
         }
         hurtTarget = null;
     }
     RadialResetCorpses(1800f);
     Fire();
     Hurt(25f);
 }
Пример #24
0
    private void OnGroundMissing()
    {
        BaseEntity baseEntity = GameObjectEx.ToBaseEntity(base.gameObject);

        if (baseEntity != null && Interface.CallHook("OnEntityGroundMissing", baseEntity) == null)
        {
            BaseCombatEntity baseCombatEntity = baseEntity as BaseCombatEntity;
            if (baseCombatEntity != null)
            {
                baseCombatEntity.Die();
            }
            else
            {
                baseEntity.Kill(BaseNetworkable.DestroyMode.Gib);
            }
        }
    }
Пример #25
0
 private static bool CheckFlags(List <Collider> list, DeployVolume volume)
 {
     for (int i = 0; i < list.Count; i++)
     {
         GameObject gameObject = list[i].gameObject;
         if (gameObject.CompareTag("DeployVolumeIgnore"))
         {
             continue;
         }
         ColliderInfo component = gameObject.GetComponent <ColliderInfo>();
         if (!(component == null) && volume.ignore != 0 && component.HasFlag(volume.ignore))
         {
             continue;
         }
         if (volume.entityList.Length == 0)
         {
             return(true);
         }
         BaseEntity baseEntity = GameObjectEx.ToBaseEntity(list[i]);
         bool       flag       = false;
         if (baseEntity != null)
         {
             BaseEntity[] array = volume.entityList;
             foreach (BaseEntity baseEntity2 in array)
             {
                 if (baseEntity.prefabID == baseEntity2.prefabID)
                 {
                     flag = true;
                     break;
                 }
             }
         }
         if (volume.entityMode == EntityMode.IncludeList)
         {
             if (flag)
             {
                 return(true);
             }
         }
         else if (volume.entityMode == EntityMode.ExcludeList && !flag)
         {
             return(true);
         }
     }
     return(false);
 }
        /// <summary>
        /// Resolve a cross-scene reference if possible.
        /// </summary>
        /// <returns>The cross-scene referenced object if it's possible</returns>
        private Object  RuntimeResolve()
        {
            var scene = this.scene.scene;

            if (!scene.IsValid())
            {
                return(null);
            }

            // Try to find the Object
            GameObject gameObject = GameObjectEx.FindBySceneAndPath(scene, fullPath);

            if (!gameObject)
            {
                return(null);
            }

            if (string.IsNullOrEmpty(componentName))
            {
                return(gameObject);
            }

            // This is the old method where we didn't store the component index (deprecated)
            if (version < 1)
            {
                Component oldStyleComponent = gameObject.GetComponent(componentName);
                if (componentIndex < 0 || oldStyleComponent)
                {
                    return(oldStyleComponent);
                }
            }

            // Get the component and index
            System.Type type = System.Type.GetType(componentName, false, true);
            if (type != null)
            {
                gameObject.GetComponents(type, _reusableComponentsList);
                if (componentIndex < _reusableComponentsList.Count)
                {
                    return(_reusableComponentsList[componentIndex]);
                }
            }

            return(null);
        }
Пример #27
0
    public void Awake()
    {
        _dynamicGameObjects      = GameObjectEx.Find(GameObjectNames.DynamicObjects);
        _playerGameObject        = GameObjectEx.FindGameObjectWithTag(GameObjectTags.Player);
        _toMoveDirectionRotation = GetComponent <ToMoveDirectionRotation>();
        _toTargetObjectRotation  = GetComponent <ToTargetObjectRotation>();

        var shadowLayer = Layers.GetLayer(LayerName.ShadowLayer);

        _layerMask     = (1 << shadowLayer) | (1 << Layers.GetLayer(LayerName.Player));
        _moveScript    = GetComponent <MoveScript>();
        _weaponManager = GetComponentInChildren <WeaponManager>();

        if (_weaponManager == null)
        {
            Debug.LogError("Weapon manager not found in child objects.");
        }
    }
Пример #28
0
    public override GameObject InterestedInObject(GameObject obj)
    {
        obj = base.InterestedInObject(obj);
        if (obj == null)
        {
            return(null);
        }
        BaseEntity baseEntity = GameObjectEx.ToBaseEntity(obj);

        if (baseEntity == null)
        {
            return(null);
        }
        if (baseEntity.isClient)
        {
            return(null);
        }
        return(baseEntity.gameObject);
    }
Пример #29
0
    private void AR_Exit()
    {
        this.Log("[App] AR_Exit");
        hamburgerButton.interactable  = true;
        exitARModeButton.interactable = false;
        hamburgerButton_canvasGroup.DOFade(1f, 0.8f);
        exitARModeButton_canvasGroup.DOFade(0f, 0.4f);
        //Restore UI?
        arOverlay_Animator.HideAROverlay_StartAnim();
        // arOverlay_Animator.HideFooter_Panel();
        //Disable image recognition scripts
        arScriptsContainer.SetActive(false);

        //Deactivate all ar contents
        GameObjectEx.FindAllOfType <ClickableTrackableUX>().ForEach(obj => obj.gameObject.SetActive(false));

        sidePanel.gameObject.SetActive(true);
        sidePanel.infoPanelsContainer.SetActive(true);
    }
		private static void GetCommonParameters( ref Scene activeScene, ref AmsMultiSceneSetup activeSceneSetup, List<AmsMultiSceneSetup.SceneEntry> bakedScenes )
		{
			// We can only execute this when building the player.  Otherwise we expect entries to already be in the scene.
            if ( !BuildPipeline.isBuildingPlayer )
                return;

			// Get the SceneSetup for the Active Scene.
			activeScene = EditorSceneManager.GetActiveScene();
			activeSceneSetup = GameObjectEx.GetSceneSingleton<AmsMultiSceneSetup>( activeScene, false );
			if ( !activeSceneSetup )
				return;

			var scenesInSetup = activeSceneSetup.GetSceneSetup();
			foreach( var entry in scenesInSetup )
			{
                bool bShouldBake = entry.loadMethod == AmsMultiSceneSetup.LoadMethod.Baked;
				if ( bShouldBake )
					bakedScenes.Add( entry );
			}
		}
Пример #31
0
 public virtual void UpdatePillars()
 {
     BoxCollider[] array = pillars;
     foreach (BoxCollider boxCollider in array)
     {
         boxCollider.gameObject.SetActive(true);
         Collider[] array2 = Physics.OverlapBox(boxCollider.transform.TransformPoint(boxCollider.center), boxCollider.size * 0.5f, boxCollider.transform.rotation, 2097152);
         foreach (Collider collider in array2)
         {
             if (collider.CompareTag("Usable Auxiliary"))
             {
                 BaseEntity baseEntity = GameObjectEx.ToBaseEntity(collider.gameObject);
                 if (!(baseEntity == null) && !EqualNetID(baseEntity) && collider != boxCollider)
                 {
                     boxCollider.gameObject.SetActive(false);
                 }
             }
         }
     }
 }
Пример #32
0
        private void Inspect(GameObject gameObject, string name, GameObjectEx parent)
        {
            var currentPath = new List<uint>();
            if (parent != null)
            {
                currentPath.AddRange(parent.Path);
            }
            currentPath.Add(gameObject.Id);
            var gameObjectEx = new GameObjectEx(gameObject, currentPath.ToArray(), name);
            _extendedInfo[gameObject.Id] = gameObjectEx;

            if (gameObject.Type == ObjectType.Object)
            {
                foreach (var property in gameObject.Properties)
                {
                    Inspect(GameObjects[property.Value], property.Key, gameObjectEx);
                }
            }
            else if (gameObject.Type == ObjectType.Array)
            {
                var index = 0;
                foreach (var id in gameObject.Array)
                {
                    Inspect(GameObjects[id], "[" + index++ + "]", gameObjectEx);
                }
            }
        }