/// <summary> /// Called when the block swap fails due to specified reason. /// </summary> /// <param name="block">Second block. First block is pulled from memory</param> private void BlockSelectionFail(Component block) { block.GetComponent<Block>().Selected = false; _swap.GridBlocks[_blockMemoryInt].GetComponent<Block>().Selected = false; block.GetComponent<Block>().AudioFail(); _blockMemoryInt = -1; BlockSelectedCount = 0; }
protected (Component component, MemberInfo memberInfo) ParseViewEntry(Component viewProvider, string entry) { var(typeName, memberName) = ParseEntry2TypeMember(entry); var component = viewProvider.GetComponent(typeName); if (component == null) { Her.Error($"Can't find component of type: {typeName} on {viewProvider}."); return(null, null); } var viewMemberInfos = component.GetType().GetMember(memberName); if (viewMemberInfos.Length <= 0) { Her.Error($"Can't find member of name: {memberName} on {component}."); return(null, null); } var memberInfo = viewMemberInfos[0]; return(component, memberInfo); }
//Should only be created as part of our base framework public static AiRig ExtractRigInfo(Component c) { var rig = c.GetComponent<AiRig>(); if (rig == null) c.GetComponentInParent<AiRig>(); return rig; }
public static void AddHealth(Component entity, int health) { HealthHandler handler = entity.GetComponent<HealthHandler>(); if (handler) { handler.AddHealth(health); } }
public SourceBindingProperty(Component target, string fieldName) { mTarget = target; mName = fieldName; var strs = mName.Split(':'); var strComps = strs[0].Split('.'); object obj = target.GetComponent(strComps[strComps.Length - 1]); if (obj == null) { throw new Exception("bad root name"); } for (var i = 1; i < strs.Length - 1; i++) { var type = obj.GetType(); var propertyInfo = type.GetProperty(strs[i]); obj = propertyInfo.GetGetMethod().Invoke(obj, new object[] {}); } mNotifyPropertyChanged = obj as INotifyPropertyChanged; if (mNotifyPropertyChanged == null) { return; } mPropertyName = strs[strs.Length - 1]; }
static int QPYX_GetComponent_YXQP(IntPtr L_YXQP) { try { int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP); if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <string>(L_YXQP, 2)) { UnityEngine.Component QPYX_obj_YXQP = (UnityEngine.Component)ToLua.CheckObject <UnityEngine.Component>(L_YXQP, 1); string QPYX_arg0_YXQP = ToLua.ToString(L_YXQP, 2); UnityEngine.Component QPYX_o_YXQP = QPYX_obj_YXQP.GetComponent(QPYX_arg0_YXQP); ToLua.Push(L_YXQP, QPYX_o_YXQP); return(1); } else if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <System.Type>(L_YXQP, 2)) { UnityEngine.Component QPYX_obj_YXQP = (UnityEngine.Component)ToLua.CheckObject <UnityEngine.Component>(L_YXQP, 1); System.Type QPYX_arg0_YXQP = (System.Type)ToLua.ToObject(L_YXQP, 2); UnityEngine.Component QPYX_o_YXQP = QPYX_obj_YXQP.GetComponent(QPYX_arg0_YXQP); ToLua.Push(L_YXQP, QPYX_o_YXQP); return(1); } else { return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to method: UnityEngine.Component.GetComponent")); } } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
static int GetComponent(IntPtr L) { #if UNITY_EDITOR ToluaProfiler.AddCallRecord("UnityEngine.Component.Register"); #endif try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes <string>(L, 2)) { UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject <UnityEngine.Component>(L, 1); string arg0 = ToLua.ToString(L, 2); UnityEngine.Component o = obj.GetComponent(arg0); ToLua.Push(L, o); return(1); } else if (count == 2 && TypeChecker.CheckTypes <System.Type>(L, 2)) { UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject <UnityEngine.Component>(L, 1); System.Type arg0 = (System.Type)ToLua.ToObject(L, 2); UnityEngine.Component o = obj.GetComponent(arg0); ToLua.Push(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Component.GetComponent")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int GetComponent(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (matchType(l, "GetComponent__Type", argc, 2, typeof(System.Type))) { UnityEngine.Component self = (UnityEngine.Component)checkSelf(l); System.Type a1; checkType(l, 3, out a1); var ret = self.GetComponent(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (matchType(l, "GetComponent__String", argc, 2, typeof(string))) { UnityEngine.Component self = (UnityEngine.Component)checkSelf(l); System.String a1; checkType(l, 3, out a1); var ret = self.GetComponent(a1); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int GetComponent(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (matchType(l, argc, 2, typeof(string))) { UnityEngine.Component self = (UnityEngine.Component)checkSelf(l); System.String a1; checkType(l, 2, out a1); var ret = self.GetComponent(a1); pushValue(l, ret); return(1); } else if (matchType(l, argc, 2, typeof(System.Type))) { UnityEngine.Component self = (UnityEngine.Component)checkSelf(l); System.Type a1; checkType(l, 2, out a1); var ret = self.GetComponent(a1); pushValue(l, ret); return(1); } LuaDLL.luaL_error(l, "No matched override function to call"); return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public bool GetComponent <COMPONENT>(this UnityEngine.Component pTarget, COMPONENT pComponent) where COMPONENT : UnityEngine.Component { pComponent = pTarget.GetComponent <COMPONENT>(); return(pComponent != null); }
public UIShowHideController(GameObject go, Component panel) { this.panel = panel; this.animator = (go != null) ? go.GetComponent<Animator>() : null; if (animator == null && panel != null) animator = panel.GetComponent<Animator>(); this.animCoroutine = null; }
static int GetComponent(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Component), typeof(string))) { UnityEngine.Component obj = (UnityEngine.Component)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); UnityEngine.Component o = obj.GetComponent(arg0); ToLua.Push(L, o); return(1); } else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Component), typeof(System.Type))) { UnityEngine.Component obj = (UnityEngine.Component)ToLua.ToObject(L, 1); System.Type arg0 = (System.Type)ToLua.ToObject(L, 2); UnityEngine.Component o = obj.GetComponent(arg0); ToLua.Push(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Component.GetComponent")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void AddLink(Component obj) { if (IsFull) return; if (links == null) { links = new Rigidbody[4]; } links[linkCount++] = obj.GetComponent<Rigidbody>(); }
public static bool DeductHealth(Component entity, int health) { HealthHandler handler = entity.GetComponent<HealthHandler>(); if (handler) { return handler.DeductHealth(health); } return false; }
void IInteractable.Interact(Component sender) { var damager = sender.GetComponent<IWallDamage>(); if (damager != null) { DamageWall(damager.GetWallDamage()); } }
public static Cooltimer Set(Component component, float cooltime, Action onFinished) { var cooltimer = component.GetComponent<Cooltimer>(); if (cooltimer == null) cooltimer = component.gameObject.AddComponent<Cooltimer>(); cooltimer.cooltime = cooltime; cooltimer.onFinished = onFinished; return cooltimer; }
// ------------------- static public int IsThereEventSystemInTheScene() { UnityEngine.Component sysGo = (UnityEngine.Component)(GameObject.FindObjectOfType(typeof(UnityEngine.EventSystems.EventSystem))); if (sysGo == null) { return(0); } return(sysGo.GetComponent(typeof(ControlFreak2.GamepadInputModule)) ? 1 : -1); }
public void menu2option_(Component menu) { //RectTransform RT = menu_option.GetComponent<RectTransform>(); Animator A = menu.GetComponent<Animator>(); A.SetBool("IsOpen", true); GetComponent<Animator>().SetBool("IsOpen", false); //GetComponent("Menu").GetComponent<CanvasGroup>().alpha = 0; //GetComponent("Menu").GetComponent<RectTransform>().position = new Vector3(0,370,0); //RT.position = new Vector3(0, 370, 0); }
private static IEnumerator MovePlane(Component plane, GameObject target) { if (plane == null) throw new ArgumentNullException("plane"); var rotation = plane.GetComponent<Orbiting>(); Destroy(rotation); var move = plane.gameObject.AddComponent<MoveToTarget>(); move.Target = target; yield return 0; }
void OnTriggerEnter(Component other) { if (other.name.Equals ("Player")) { Player player = other.GetComponent<Player>(); if(player != null){ print ("Geyser burn"); player.currentHealth -= (int) (player.startingHealth * .10); } } }
private static bool DontValidateIfMeshRenderer(object obj) { UnityEngine.Component component = obj as UnityEngine.Component; if (component == null) { return(true); } return(component.GetComponent <MeshRenderer>() == null); }
// Get or Add component one time static public T GetOrAddComponent <T>(this UnityEngine.Component child) where T : UnityEngine.Component { T result = child.GetComponent <T>(); if (result == null) { result = child.gameObject.AddComponent <T>(); } return(result); }
private static void ProcessDepthOfField(Component gameComponent, Component sceneComponent) { Type dofType = sceneComponent.GetType(); FieldInfo fPlaneField = dofType.GetField("focusPlane", Utilities.DEFAULT_BINDING_FLAG); if (fPlaneField == null) return; float currentValue = (float)fPlaneField.GetValue(sceneComponent); float factor = Mathf.Pow(Mathf.Pow(currentValue, 4) / (sceneComponent.GetComponent<Camera>().farClipPlane / gameComponent.GetComponent<Camera>().farClipPlane), 1.0f / 4); fPlaneField.SetValue(sceneComponent, factor); }
///<summary> Returns true if the component existsed and was removed </summary> public static bool RemoveComponentImmediate <T>(this Component co, bool allowDestroyingAssets = false) where T : Component { T component = co.GetComponent <T>(); if (component != null) { Object.DestroyImmediate(component, allowDestroyingAssets); return(true); } return(false); }
public static T GetOrAddComponent <T>(this Component co) where T : Component { T component = co.GetComponent <T>(); if (component == null) { component = co.gameObject.AddComponent <T>(); } return(component); }
///<summary> Returns true if the component existsed and was removed </summary> public static bool RemoveComponent <T>(this Component co) where T : Component { T component = co.GetComponent <T>(); if (component != null) { Object.Destroy(component); return(true); } return(false); }
public static T GetSafeComponent<T>(this UnityEngine.Component obj, T target) where T : MonoBehaviour { T component = obj.GetComponent<T>(); if (component == null) { Debug.LogError("Expected to find component of type " + typeof(T) + " but found none", obj); } return component; }
// Update is called once per frame void Update() { //Finds the point on the ground that is being moused over Ray camPoint = Camera.mainCamera.ScreenPointToRay(Input.mousePosition); RaycastHit hitInfo; bool overGround = Physics.Raycast(camPoint, out hitInfo, Mathf.Infinity, GlobalConstants.GROUND_MASK);//Mask to hit only the ground Debug.DrawRay(camPoint.origin, camPoint.direction * 100, overGround ? Color.green : Color.red); //The mouse isn't over the map if(!overGround) return; //Computer what tile that point is in OverTile.x = (int)(hitInfo.point.x / GlobalConstants.TileSize); OverTile.y = (int)(hitInfo.point.z / GlobalConstants.TileSize); if(GuiManager.InBuildMode) { if(HoverObject != null) HoverObject.gameObject.active = false; HoverObject = GuiManager.GetSelectedComponent(); HoverObject.gameObject.active = true; Vector2 structSize = ((Structure)HoverObject.GetComponent("Structure")).Size; HoverObject.transform.position = new Vector3(OverTile.x, 0f, OverTile.y) * GlobalConstants.TileSize + new Vector3(GlobalConstants.TileSize, 0, GlobalConstants.TileSize) / 2; } else if(HoverObject != null) HoverObject.transform.position = new Vector3(-100, -100, -100); Debug.Log(hitInfo.point); if(Input.GetMouseButtonDown(0) && !lastMouse && overGround && GuiManager.SelectedStructure != null) { //Don't overwrite a structure if(WorldManager.GetStructureAt((int)OverTile.x, (int)OverTile.y) == null) { //Make sure the placement is valid if(WorldManager.isValidPlacement(GuiManager.SelectedStructure, (int)OverTile.x, (int)OverTile.y)) { Component newStructure = (Component)Instantiate(GuiManager.SelectedStructure); Vector2 structSize = ((Structure)newStructure.GetComponent("Structure")).Size; newStructure.transform.position = new Vector3(OverTile.x, 0f, OverTile.y) * GlobalConstants.TileSize + new Vector3(GlobalConstants.TileSize, 0, GlobalConstants.TileSize) / 2; //TODO: Do this smoother. Create and destroy seems inefficient WorldManager.AddStructure(newStructure, (int)OverTile.x, (int)OverTile.y); } } } lastMouse = Input.GetMouseButtonDown(0); }
/// <summary>Gets the component, including checking children if specified</summary> /// <typeparam name="TComponent">Component type</typeparam> /// <param name="this">The UnityEngine Component</param> /// <param name="includeChildren">Whether to check children if the component is not found on the Component</param> /// <returns>The component, if found; otherwise, null.</returns> public static TComponent GetComponent <TComponent>(this UnityEngine.Component @this, bool includeChildren) where TComponent : UnityEngine.Component { var component = @this.GetComponent <TComponent>(); if (component == null) { component = @this.GetComponentInChildren <TComponent>(); } return(component); }
public static UnityEngine.Component GetComponent(UnityEngine.Component com, string type, ref string msg) { Type T = GetType(type); if (T == null) { msg = "Not a Type"; return(null); } var v = com.GetComponent(T); return(v); }
static public int GetComponent(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif int argc = LuaDLL.lua_gettop(l); if (matchType(l, argc, 2, typeof(string))) { UnityEngine.Component self = (UnityEngine.Component)checkSelf(l); System.String a1; checkType(l, 2, out a1); var ret = self.GetComponent(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (matchType(l, argc, 2, typeof(System.Type))) { UnityEngine.Component self = (UnityEngine.Component)checkSelf(l); System.Type a1; checkType(l, 2, out a1); var ret = self.GetComponent(a1); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function GetComponent to call"); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
public void AddComponent(Component component) { Rigidbody2D rb = component.GetComponent<Rigidbody2D>(); FixedJoint2D newJoint = gameObject.AddComponent<FixedJoint2D>(); //RelativeJoint2D newJoint = gameObject.AddComponent<RelativeJoint2D>(); newJoint.connectedBody = rb; if (components == null) components = new List<Component>(); components.Add(component); component.Ship = this; transform.position = GetCenter(); //print("woop " + component.GetInstanceID() + " #:" + components.Count); }
static public int GetComponent__String(IntPtr l) { try { UnityEngine.Component self = (UnityEngine.Component)checkSelf(l); System.String a1; checkType(l, 2, out a1); var ret = self.GetComponent(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
public GLexMaterial(Material material, Component meshRenderer) { mMaterial = material; mMaterialSettings = meshRenderer.GetComponent<GLexMaterialSettings>(); mUniqueName = mMaterial.name; while (UniqueNameExists( mUniqueName )) { mUniqueName = mMaterial.name + (mUniqueId++).ToString(); } mMaterials.Add(this); AddTextures(); AddShader(); }
public static IList <T> GetInterfaceComponents <T>(this Component component, bool firstOnly = false) where T : class { var types = _interfaceToComponentMapping[typeof(T)]; if (null == types || types.Count <= 0) { Debug.LogError("No descendants found for type " + typeof(T)); return(null); } var resList = new List <T>(); foreach (var curType in types) { Component[] components = firstOnly ? new [] { component.GetComponent(curType) } : component.GetComponents(curType); if (null == components || components.Length <= 0) { continue; } var tList = new List <T>(); foreach (var curComp in components) { if (curComp == null) { continue; } var curCompAsT = curComp as T; if (null == curCompAsT) { Debug.LogError("Unable to cast '" + curComp.GetType() + "' to '" + typeof(T) + "'"); continue; } tList.Add(curCompAsT); } resList.AddRange(tList); } return(resList); }
/// <summary> /// 自动 脚本 控制 /// Gets or add a component. Usage example: /// BoxCollider boxCollider = transform.GetOrAddComponent<BoxCollider>(); /// </summary> public static T GetOrAddComponent <T>(this Component child) where T : Component { T result = child.GetComponent <T>(); if (result == null) { try { result = child.gameObject.AddComponent <T>(); } catch (Exception exception) { Debug.LogWarning("GetOrAddComponent=" + exception); } } return(result); }
public static int GetComponent2_wrap(long L) { try { long nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L); UnityEngine.Component obj = get_obj(nThisPtr); string arg0 = FCLibHelper.fc_get_string_a(L, 0); UnityEngine.Component ret = obj.GetComponent(arg0); long ret_ptr = FCLibHelper.fc_get_return_ptr(L); long v = FCGetObj.PushObj(ret); FCLibHelper.fc_set_value_wrap_objptr(ret_ptr, v); } catch (Exception e) { Debug.LogException(e); } return(0); }
public void UpdateOrderGivenComponent(Component component) { if (Application.isPlaying) { return; } Camera camera = component.GetComponent<Camera>(); if (camera == null) { camera = component.gameObject.AddComponent<Camera>(); } SerializedObject obj = new SerializedObject(camera); SerializedProperty targetEyeProp = obj.FindProperty(TARGET_EYE_PROPERTY_NAME); OrderType newOrder = (OrderType)targetEyeProp.intValue; if (_orderType != newOrder) { _orderType = newOrder; EditorUtility.SetDirty(component); } }
// NOTE (darren): we want to validate and check MeshFilters, but // TextMeshPro dynamically adds a mesh. As a requirement to validation, // MeshFilter must not have a TextMeshPro component as well private static bool DontValidateIfTextMeshPro(object obj) { UnityEngine.Component component = obj as UnityEngine.Component; if (component == null) { return(true); } Type textMeshProType = kTextMeshProType ?? kTextMeshProFirstPassType; if (textMeshProType == null) { return(true); } UnityEngine.Component textMeshProComponent = component.GetComponent(textMeshProType); // valid (true) when textMeshProComponent does not exist return(textMeshProComponent == null); }
public static T[] GetComponentsInChildrenExcludeSelf <T>(this Component component) { var childrenAndSelf = component.GetComponentsInChildren <T>(); if (childrenAndSelf.Length == 0) { return(childrenAndSelf); } var hasT = component.GetComponent <T>(); if (hasT == null) { return(childrenAndSelf); } var list = childrenAndSelf.ToList(); list.RemoveAt(0); return(list.ToArray()); }
public WeenusUI(Component unityComponent) { var buttons = new List<WeenusFieldButton>(); var views = new List<WeenusFieldView>(); var inputs = new List<WeenusInputField>(); RectTransform rect = unityComponent.GetComponent<RectTransform>(); GameObjectUtilities.GetAllComponentsInChildTree<WeenusFieldButton>(rect, buttons); GameObjectUtilities.GetAllComponentsInChildTree<WeenusFieldView>(rect, views); GameObjectUtilities.GetAllComponentsInChildTree<WeenusInputField>(rect, inputs); foreach (var b in buttons) Button.Add(b.gameObject.name, b); foreach (var b in views) FieldView.Add(b.gameObject.name, b); foreach (var b in inputs) FieldInput.Add(b.gameObject.name, b); }
private static void AddToCanvas(Component gobject) { var canvases = FindObjectsOfType<Canvas>(); // Get the first screen overlay canvas we can find, // If one is not found get the first canvas of any type, // If no canvas is found, create a new one var canvas = canvases.FirstOrDefault(c => c.renderMode == RenderMode.ScreenSpaceOverlay) ?? canvases.FirstOrDefault() ?? new GameObject("Canvas").AddComponent<Canvas>(); if (canvas) { var rect = gobject.GetComponent<RectTransform>(); rect.SetParent(canvas.transform); rect.localScale = Vector3.one; rect.anchorMin = Vector2.zero; rect.anchorMax = Vector2.one; rect.pivot = Vector2.one * .5f; rect.sizeDelta = Vector2.zero; rect.anchoredPosition = Vector3.zero; } }
/// <summary> /// Adds a structure at coordinates x, y /// </summary> /// <param name='structure'> /// The structure to add /// </param> /// <param name='x'> /// X coordinate /// </param> /// <param name='y'> /// Y coordinate /// </param> public static void AddStructure(Component structure, int x, int y) { Structure structCast = (Structure)(structure.GetComponent("Structure")); //Sanity Check if(structCast.needsAir && Tiles[x, y].state == TileStatus.State.Unpressurized) return; Tiles[x, y].structure = structure; Tiles[x, y].groundType = TileStatus.GroundType.Blocked; //marked tileStatus as sealed if(structCast.sealedBuilding) { for(int i = x - structCast.DomeRadius; i <= x + structCast.DomeRadius; i++) for(int j = y - structCast.DomeRadius; j <= y + structCast.DomeRadius; j++) { if(Vector2.Distance(new Vector2(x, y), new Vector2(i, j)) <= structCast.DomeRadius) { Tiles[i,j].state = TileStatus.State.Pressurized; } } } }
public void UpdateOrderGivenComponent(Component component) { if (Application.isPlaying) { return; } //Allow the user to specify themselves if VR is disabled if (!VRSettings.enabled || !PlayerSettings.virtualRealitySupported) { return; } Camera camera = component.GetComponent<Camera>(); if (camera == null) { camera = component.gameObject.AddComponent<Camera>(); } SerializedObject obj = new SerializedObject(camera); SerializedProperty targetEyeProp = obj.FindProperty(TARGET_EYE_PROPERTY_NAME); OrderType newOrder = (OrderType)targetEyeProp.intValue; if (_orderType != newOrder) { _orderType = newOrder; EditorUtility.SetDirty(component); } }
public static int GetComponent1_wrap(long L) { try { long nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L); UnityEngine.Component obj = get_obj(nThisPtr); string arg0 = FCLibHelper.fc_get_string_a(L, 0); long nRetPtr = 0; switch (arg0) { case "SkinnedMeshRenderer": { SkinnedMeshRenderer ret_obj = obj.GetComponent <SkinnedMeshRenderer>(); nRetPtr = FCGetObj.PushObj <SkinnedMeshRenderer>(ret_obj); } break; case "Renderer": { Renderer ret_obj = obj.GetComponent <Renderer>(); nRetPtr = FCGetObj.PushObj <Renderer>(ret_obj); } break; case "MeshRenderer": { MeshRenderer ret_obj = obj.GetComponent <MeshRenderer>(); nRetPtr = FCGetObj.PushObj <MeshRenderer>(ret_obj); } break; case "Animation": { Animation ret_obj = obj.GetComponent <Animation>(); nRetPtr = FCGetObj.PushObj <Animation>(ret_obj); } break; case "Collider": { Collider ret_obj = obj.GetComponent <Collider>(); nRetPtr = FCGetObj.PushObj <Collider>(ret_obj); } break; case "BoxCollider": { BoxCollider ret_obj = obj.GetComponent <BoxCollider>(); nRetPtr = FCGetObj.PushObj <BoxCollider>(ret_obj); } break; case "BoxCollider2D": { BoxCollider2D ret_obj = obj.GetComponent <BoxCollider2D>(); nRetPtr = FCGetObj.PushObj <BoxCollider2D>(ret_obj); } break; case "MeshCollider": { MeshCollider ret_obj = obj.GetComponent <MeshCollider>(); nRetPtr = FCGetObj.PushObj <MeshCollider>(ret_obj); } break; case "SphereCollider": { SphereCollider ret_obj = obj.GetComponent <SphereCollider>(); nRetPtr = FCGetObj.PushObj <SphereCollider>(ret_obj); } break; case "Rigidbody": { Rigidbody ret_obj = obj.GetComponent <Rigidbody>(); nRetPtr = FCGetObj.PushObj <Rigidbody>(ret_obj); } break; case "Camera": { Camera ret_obj = obj.GetComponent <Camera>(); nRetPtr = FCGetObj.PushObj <Camera>(ret_obj); } break; case "AudioSource": { AudioSource ret_obj = obj.GetComponent <AudioSource>(); nRetPtr = FCGetObj.PushObj <AudioSource>(ret_obj); } break; case "Transform": { Transform ret_obj = obj.GetComponent <Transform>(); nRetPtr = FCGetObj.PushObj <Transform>(ret_obj); } break; case "Component": { Component ret_obj = obj.GetComponent <Component>(); nRetPtr = FCGetObj.PushObj <Component>(ret_obj); } break; case "ParticleSystem": { ParticleSystem ret_obj = obj.GetComponent <ParticleSystem>(); nRetPtr = FCGetObj.PushObj <ParticleSystem>(ret_obj); } break; case "Light": { Light ret_obj = obj.GetComponent <Light>(); nRetPtr = FCGetObj.PushObj <Light>(ret_obj); } break; case "Button": { Button ret_obj = obj.GetComponent <Button>(); nRetPtr = FCGetObj.PushObj <Button>(ret_obj); } break; case "Text": { Text ret_obj = obj.GetComponent <Text>(); nRetPtr = FCGetObj.PushObj <Text>(ret_obj); } break; default: break; } long ret_ptr = FCLibHelper.fc_get_return_ptr(L); FCLibHelper.fc_set_value_wrap_objptr(ret_ptr, nRetPtr); } catch (Exception e) { Debug.LogException(e); } return(0); }
public static void SetTint(this Component component, Color color) { component.GetComponent <Renderer>().material.SetColor("_TintColor", color); }
public static PhotonView Get(Component component) { return component.GetComponent<PhotonView>(); }
//------------------------------------------------------------------------- void EnsureOTTilesSpriteHasUpdateComponent(Component otTilesSprite) { AlphaMeshColliderUpdateOTTilesSpriteColliders updateComponent = otTilesSprite.GetComponent<AlphaMeshColliderUpdateOTTilesSpriteColliders>(); if (updateComponent == null) { updateComponent = otTilesSprite.gameObject.AddComponent<AlphaMeshColliderUpdateOTTilesSpriteColliders>(); updateComponent.SetOTTilesSprite(otTilesSprite); } }
//------------------------------------------------------------------------- void EnsureSmoothMovesBoneAnimHasRestoreComponent(Component smoothMovesBoneAnimation) { AlphaMeshColliderSmoothMovesRestore restoreComponent = smoothMovesBoneAnimation.GetComponent<AlphaMeshColliderSmoothMovesRestore>(); if (restoreComponent == null) { smoothMovesBoneAnimation.gameObject.AddComponent<AlphaMeshColliderSmoothMovesRestore>(); } }
public static Color GetTint(this Component component) { return(component.GetComponent <Renderer>().material.GetColor("_TintColor")); }
public static float GetMaxHealth(Component entity) { return entity.GetComponent<HealthHandler>().maxHealth; }
public static void LerpColor(this Component component, Color target, float amount) { var current = component.GetComponent <Renderer>().material.color; component.GetComponent <Renderer>().material.color = Color.Lerp(current, target, amount); }
public UIButton(Component but, Color mouseOver, Color selected, Color selectedOver) { button = but; butImage = but.GetComponent<Image>(); origColor = butImage.color; mouseOvercolor = mouseOver; selectedColor = selected; selectedOverColor = selectedOver; }
public void OnEnableComponent(Component tarCom, bool bChangedEnable) { if (tarCom is NcParticleSystem) { if (tarCom.GetComponent<ParticleEmitter>() != null && NgSerialized.IsMeshParticleEmitter(tarCom.GetComponent<ParticleEmitter>())) { NcParticleSystem ncParticleScale = (tarCom as NcParticleSystem); float fSetMinValue; float fSetMaxValue; NgSerialized.GetMeshNormalVelocity(tarCom.GetComponent<ParticleEmitter>(), out fSetMinValue, out fSetMaxValue); if (bChangedEnable == true) { ncParticleScale.m_fLegacyMinMeshNormalVelocity = fSetMinValue; ncParticleScale.m_fLegacyMaxMeshNormalVelocity = fSetMaxValue; } else { if (fSetMinValue != ncParticleScale.m_fLegacyMinMeshNormalVelocity || fSetMaxValue != ncParticleScale.m_fLegacyMaxMeshNormalVelocity) NgSerialized.SetMeshNormalVelocity(tarCom.GetComponent<ParticleEmitter>(), ncParticleScale.m_fLegacyMinMeshNormalVelocity, ncParticleScale.m_fLegacyMaxMeshNormalVelocity); } } } }
public CGShapeResourceGUI(Component resource) : base(resource) { mCurrentShape=resource.GetComponent<CurvyShape2D>(); mMenuNames = CurvyShape.GetShapesMenuNames((mCurrentShape) ? mCurrentShape.GetType() : null, out mSelection,true).ToArray(); mFreeform = (mCurrentShape == null); }
public static Component GetComponent0T(this UnityEngine.Component self, System.Type T) { return(self.GetComponent(T)); }
void OnTriggerEnter(Component component) { if (component.CompareTag("CheckPoint")) { LastCheckPoint = component.gameObject; component.gameObject.SetActive(false); } if (component.CompareTag("ActionPoint")) { component.gameObject.SetActive(false); } if (component.CompareTag("BadTouch") || (component.CompareTag("Enemy") && !Attacking)) { Kill(); } if (component.CompareTag("Fallable")) { GetComponent<Collider>().isTrigger = false; component.GetComponent<Fallable>().Fall(); } if (component.CompareTag("Breakable")) { component.GetComponent<Breakable>().Break(); } }
/** * empty slot constructor */ public UIItem(Component itemElem) { Text TG = null, TK = null, TT = null, TN = null; foreach (Text t in itemElem.GetComponentsInChildren<Text>()) { if (t.name.Equals("Text_G")) TG = t; else if (t.name.Equals("Text_K")) TK = t; else if (t.name.Equals("Text_T")) TT = t; else if (t.name.Equals("Text_N")) TN = t; } _itemElem = itemElem; _itemElemBorderImage = itemElem.GetComponent<Image>(); _origColor = _itemElemBorderImage.color; _but = itemElem.GetComponent<Button>(); _value = new UICurrency(TG, TK, TT, TN); }
public static void SetEmissionColor(this Component component, Color color) { component.GetComponent <Renderer>().material.SetColor("_EmissionColor", color); }
/// <summary> /// First and second block are compatable and can be killed off. Use this /// to kill the block and the one stored in memory. It also provides /// animation to the move counter. /// </summary> /// <param name="block">Second block. First block is pulled from memory</param> private void BlockSelectionPass(Component block) { block.GetComponent<Block>().Killed = true; _swap.GridBlocks[_blockMemoryInt].GetComponent<Block>().Killed = true; _blockMemoryInt = -1; block.GetComponent<Block>().AudioPass(); _movesCountInt--; _movesLeftTextColourGreen = 0.75f; _fontSizeTemp = _movesLeftFontSize; _movesLeftFontSize = _movesLeftFontSize * 2; _blockMemoryInt = -1; BlockSelectedCount = 0; }