public GetComponent ( |
||
type | ||
return |
void OnGUI() { GUILayout.Box("Legacy Effect Scale Editor", GUILayout.Width(295)); EditorGUILayout.Space(); Effect = (GameObject)EditorGUILayout.ObjectField("Legacy Effect", Effect, typeof(GameObject), true); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); Scale = float.Parse(EditorGUILayout.TextField("Scale Change Value", Scale.ToString())); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); if (GUILayout.Button("Scale Apply", GUILayout.Height(70))) { if (Effect.GetComponent<csLegacyEffectChanger>() != null) Effect.GetComponent<csLegacyEffectChanger>().LegacyEffectScaleChange(Scale); else { Effect.AddComponent<csLegacyEffectChanger>(); Effect.GetComponent<csLegacyEffectChanger>().LegacyEffectScaleChange(Scale); } DestroyImmediate(Effect.GetComponent<csLegacyEffectChanger>()); } }
public void OnMouseDown() { //pego a unidade selecionada atravez do controlador de jogo GameObject selecionado = gameObject.transform.parent.parent.parent.GetComponent<ControladorDeJogo>().objetoSelecionado; //Se tiver algum objeto selecionado, mando a unidade selecionada se mover para o objeto clicado if(selecionado != null) {//Se tiver alguma unidade selecionada if(tropaJogador == null) {//E se nao tiver nem uma unidade nesse alvo (unidade do jogador) //Defino que tem uma unidade vindo pra ca tropaJogador = selecionado; //Se a unidade que esta vindo estiver vindo de um outro alvo, limpo o alvo antigo if(tropaJogador.GetComponent<ComportamentoDeUnidade>().alvoAtual != null) tropaJogador.GetComponent<ComportamentoDeUnidade>().alvoAtual.GetComponent<AcoesJogadorAlvo>().tropaJogador = null; //Mando a unidade se mover para o alvo atual tropaJogador.GetComponent<ComportamentoDeUnidade>().moverSoldados(gameObject); //E digo que esse alvo e o novo destino dele tropaJogador.GetComponent<ComportamentoDeUnidade>().alvoAtual = gameObject; //atualizar as cores do alvo atualizarCores(); } else gameObject.transform.parent.parent.parent.GetComponent<ControladorDeJogo>().hud.GetComponent<ControladorDeInterface>().escreverMensagem("Nao pode haver dois grupos em um mesmo alvo"); } }
private void Move(GameObject prefab) { //move object upwards over time * speed Vector2 pos = prefab.GetComponent<RectTransform>().anchoredPosition; pos.y += 1 * speed * Time.deltaTime; prefab.GetComponent<RectTransform>().anchoredPosition = pos; }
void Start() { levelClock = GameObject.Find("gameBase").GetComponent<levelClock>(); spaceship = GameObject.Find("spaceship"); rb = spaceship.GetComponent<Rigidbody2D>(); body = spaceship.GetComponent<Transform>(); }
void Fire() { // 프리팹 동적 생성 target_projectile = (GameObject)Instantiate(projectile, new Vector3(firePos.x,firePos.y), fireAngle); target_projectile.GetComponent<BazookaCtrl>().globalId = GetComponentInParent<NetPlayerCtrl>().globalId; target_projectile.GetComponent<BazookaCtrl>().shotPower = fireForce; }
// Update is called once per frame void Update() { timerText = GameObject.Find("dynamic timer text"); monster = GameObject.Find("Player"); timer += Time.deltaTime; gameOver += Time.deltaTime; if (timer > 1.0f) { transform.Rotate((float)180/levelTime, 0.0f, 0.0f); timer = 0.0f; } if (levelTime - gameOver >= 0) { timerText.GetComponent<Timer>().timer = levelTime - gameOver; } if (gameOver > levelTime && GameObject.Find("Plant") != null) { //gameOverText.active = true; nextLevelBut.transform.Translate(1,0,0); gameOverText.GetComponent<GUIText>().text = "You Survived The Day Victory Is Yours!"; monster.GetComponent<AIFollow>().Stop(); if (monster.GetComponent<AIFollow>().speed <= 0) { Destroy(monster); } gameOver = 0.0f; } }
void AddClusterScripts(GameObject iObject, bool iChildren) { //MiddleVRTools.Log("AddCluster to " + iObject); //print("AddCluster to " + iObject); { if (iObject.GetComponent<VRShareTransform>() == null) { VRShareTransform script = iObject.AddComponent<VRShareTransform>() as VRShareTransform; script.Start(); } if (iObject.GetComponent<VRApplySharedTransform>() == null) { VRApplySharedTransform script = iObject.AddComponent<VRApplySharedTransform>() as VRApplySharedTransform; script.Start(); } } if( iChildren == true ) { foreach (Transform child in iObject.transform) { GameObject childObject = child.gameObject; //print("Child : " + childObject); AddClusterScripts(childObject, true); } } }
void Update() { if (ritualStart) { GetComponent<EllipsoidParticleEmitter>().emit = true; GetComponent<ParticleAnimator>().damping = timeAndDumbing; timeAndDumbing += 0.01f; if (isTriggered & !isCreated) { GetComponent<EllipsoidParticleEmitter>().emit = true; enemy = Instantiate(enemyPrefab, transform.position, Quaternion.identity) as GameObject; monkGroup.GetComponent<InputHandler>().enemy = enemy; enemy.GetComponent<Enemy>().canvasPlane = plane; enemy.GetComponent<Enemy>().canvasText = text; isCreated = true; monkGroup.GetComponent<GroupMovement>().StopMovement(); } if (timeAndDumbing >= 1) { GetComponent<EllipsoidParticleEmitter>().emit = false; enemy.GetComponent<EnemyMovement>().StartMovement(); monkGroup.GetComponent<GroupMovement>().StartMovement(); monkGroup.GetComponent<GroupMovement>().movementSpeed = 5.0f; Destroy(this.gameObject, 2.0f); } } }
public static void PlaySounds(GameObject obj, AudioClip[] clips) { if(clips == null || clips.Length == 0) return; obj.GetComponent<AudioSource>().clip = clips[Random.Range(0, clips.Length)]; obj.GetComponent<AudioSource>().Play(); }
public static GameObject CreateDecal(Material mat, Rect uvCoords, float scale) { GameObject decal = new GameObject(); decal.name = "Decal" + decal.GetInstanceID(); decal.AddComponent<MeshFilter>().sharedMesh = DecalMesh("DecalMesh" + decal.GetInstanceID(), mat, uvCoords, scale); decal.AddComponent<MeshRenderer>().sharedMaterial = mat; #if UNITY_5 decal.GetComponent<MeshRenderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; #else decal.GetComponent<MeshRenderer>().castShadows = false; #endif qd_Decal decalComponent = decal.AddComponent<qd_Decal>(); decalComponent.SetScale(scale); decalComponent.SetTexture( (Texture2D)mat.mainTexture ); decalComponent.SetUVRect(uvCoords); #if DEBUG decal.AddComponent<qd_DecalDebug>(); #endif return decal; }
IEnumerator PlayerDeath(GameObject temp) { //player.GetComponent<PlatformerAnimation>().PlayerDied(); temp = this.player; if(temp.name=="Player"){ temp.GetComponent<PlayerController>().RemoveControl(); AudioSource.PlayClipAtPoint(deathSound, temp.transform.position); yield return new WaitForSeconds(2.0f); temp.GetComponent<PlayerPhysics>().Reset(); //player.GetComponent<PlatformerAnimation>().PlayerLives(); temp.GetComponent<PlayerController>().GiveControl(); } else { BoxController control = temp.GetComponent<BoxController>(); if(control.velCheck()){ AudioSource.PlayClipAtPoint(boxPop, temp.transform.position); //yield return new WaitForSeconds(2.0f); temp.GetComponent<PlayerPhysics>().Reset(); } } }
// Use this for initialization void Start() { rend = GetComponent<Renderer>(); pl = GameObject.FindGameObjectWithTag("Player"); Physics2D.IgnoreCollision(GetComponent<Collider2D>(), pl.GetComponent<Collider2D>()); Physics2D.IgnoreCollision(GetComponent<Collider2D>(), pl.GetComponent<CircleCollider2D>()); }
public static Bone Create() { GameObject b = new GameObject("Bone"); Undo.RegisterCreatedObjectUndo(b, "Add child bone"); b.AddComponent<Bone>(); if (Selection.activeGameObject != null) { GameObject sel = Selection.activeGameObject; b.transform.parent = sel.transform; if (sel.GetComponent<Bone>() != null) { Bone p = sel.GetComponent<Bone>(); b.transform.position = p.Head; b.transform.localRotation = Quaternion.Euler(0, 0, 0); } } Skeleton skel = b.transform.root.GetComponentInChildren<Skeleton>(); if (skel != null) { Bone[] bones = skel.GetComponentsInChildren<Bone>(); int index = bones.Max(bn => bn.index) + 1; b.GetComponent<Bone>().index = index; skel.CalculateWeights(); } Selection.activeGameObject = b; return b.GetComponent<Bone>(); }
private static EffectStop respawnCharacter(GameObject character) { return () => { var manager = GameObject.Find("GameManager").GetComponent<GameManager>(); var combatData = character.GetComponent<Combat>(); var characterData = character.GetComponent<Character>(); // Consider character to be alive combatData.dead = false; combatData.selectable = true; // Restore health combatData.health = combatData.maxHealth; combatData.mana = combatData.maxMana(); // Move Character to correct position var spawn = character.tag == "TeamA" ? manager.bluespawn[UnityEngine.Random.Range(0, manager.bluespawn.Length)] : manager.redspawn[UnityEngine.Random.Range(0, manager.redspawn.Length)]; character.transform.position = spawn.transform.position; // Set animation state to alive characterData.setAnimation_State(characterData.dead_State, false); // Enable movement character.GetComponent<NavMeshAgent>().enabled = true; character.GetComponent<Rigidbody>().useGravity = true; }; }
public void SetAttacker(GameObject g) { attacker = g; if (attacker.gameObject.tag == "Player") { direction = attacker.GetComponent<CharacterMovementScript>().Direction; aimMode = attacker.GetComponent<CharacterMovementScript>().AimMode; if (aimMode) { testIKScript = GameObject.FindGameObjectWithTag("Player").GetComponent<TestIKScript>(); position = testIKScript.lookObj.position; this.transform.LookAt(position); } else { //Debug.Log("Tossed Grenade"); position = GameObject.FindGameObjectWithTag("LookAtObj").transform.position; this.transform.LookAt(position); } } else if (attacker.GetComponent<GuardController>()) { if (attacker.GetComponent<GuardController>().movingSpeed < 0) direction = true; else direction = false; } else { position = GameObject.FindGameObjectWithTag("Player").transform.position; this.transform.LookAt(position); } }
// Use this for initialization void Start () { string a=GameObject.Find("UIRoot").GetComponent<NETSAVE>().thisname; inin = false; inin2 = true; inin3 = true; if (a != master) { target=GameObject.Find(a).gameObject; inin=true; bool targetjk=target.GetComponent<NETBS>().jk; if(targetjk!=jk) { GameObject.Find(a).GetComponent<NETBS>().CmdJKctrlboom(this.gameObject); boomflag=true; CmdBoom(); } target.GetComponent<NETBS>().JkCtrled(jk); target.GetComponent<NETBS>().isjk=true; } this.transform.parent = GameObject.Find ("other").transform; }
static void AddJoystick(){ ETCInput.instance.Create(); GameObject canvas = SetupUI(); Object[] sprites = Resources.LoadAll("ETCDefaultSprite"); GameObject joystick = new GameObject("New Joystick", typeof(ETCJoystick),typeof(RectTransform), typeof( CanvasGroup), typeof(Image) ); joystick.transform.SetParent( canvas.transform,false); joystick.GetComponent<Image>().preserveAspect = true; joystick.GetComponent<Image>().sprite = GetSpriteByName("ETCArea",sprites); joystick.GetComponent<Image>().rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal,130); joystick.GetComponent<Image>().rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical,130); joystick.GetComponent<CanvasGroup>().hideFlags = HideFlags.HideInInspector; joystick.GetComponent<CanvasRenderer>().hideFlags = HideFlags.HideInInspector; GameObject thumb = new GameObject("Thumb",typeof(RectTransform), typeof(CanvasRenderer), typeof(Image)); thumb.transform.SetParent(joystick.transform,false); thumb.GetComponent<Image>().preserveAspect = true; thumb.GetComponent<Image>().sprite = GetSpriteByName("ETCThumb",sprites); thumb.GetComponent<Image>().rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal,80); thumb.GetComponent<Image>().rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical,80); joystick.GetComponent<ETCJoystick>().thumb = thumb.transform as RectTransform; Selection.activeGameObject = joystick; }
public override void Use(GameObject owner, GameObject target) { //TODO: get weapon damages, etc //get item parent skill level var OwnSc = owner.GetComponent<BaseCharacter> (); var TargetSc = target.GetComponent<BaseCharacter> (); var ps = OwnSc.GetSkill(ParentSkill); /*Debug.Log("Parent skill is "+ps.Name); Debug.Log(ps.baseValue);*/ //calculate hit roll: determines if target is actually hit or evades attack int AttackRoll = ps + OwnSc.GetAttribute( (int)Attributes.Str) + OwnSc.GetAttribute((int)Attributes.Dext); int DodgeRoll = TargetSc.GetSkill("dodge") + TargetSc.GetAttribute((int)Attributes.Dext); int roll = Random.Range (0, AttackRoll + DodgeRoll + 1); if (roll > AttackRoll) { //Debug.Log("Attack missed!!"); GameObject.Find("MessageBox").GetComponent<MsgList>().SetText(OwnSc.Name+" hits the air causing a lot of damege to nobody"); } ///weapon does damage: get all damage properties foreach (Property p in props) { if (p.type=="damage") { Debug.Log("Dmg type: "+p.name); Debug.Log("Dmg value: "+p.value); float dmg = p.value+OwnSc.GetAttribute((int)Attributes.Str)*ps; Debug.Log("Effective damage is "+dmg); target.GetComponent<BaseCharacter> ().HitPoints [0]-= dmg; var bar = GameObject.Find("blood-bar").GetComponent<Image>(); float percent = TargetSc.HitPoints [0]/TargetSc.HitPoints [1]; bar.transform.localScale = new Vector3(percent, 1.0f,1.0f); //Debug.Log("Dmg value: "+p.value); GameObject.Find("MessageBox").GetComponent<MsgList>().SetText(OwnSc.Name+" hits "+TargetSc.Name+" inflicting "+dmg.ToString() +" damage"); } } }
void Awake() { carCamera = GameObject.FindObjectOfType<RCCCarCamera>().gameObject; carCamera.GetComponent<Camera>().enabled = false; carCamera.GetComponent<AudioListener>().enabled = false; GetComponent<RCCCarControllerV2>().runEngineAtAwake = false; GetComponent<RCCCarControllerV2>().canControl = false; GetComponent<RCCCarControllerV2>().engineRunning = false; if(carCamera.GetComponent<RCCCarCamera>()) carCamera.GetComponent<RCCCarCamera>().enabled = true; if(GameObject.FindObjectOfType<RCCDashboardInputs>()) dashboard = GameObject.FindObjectOfType<RCCDashboardInputs>().gameObject; if(!getOutPosition){ GameObject getOutPos = new GameObject("Get Out Position"); getOutPos.transform.SetParent(transform); getOutPos.transform.localPosition = new Vector3(-3f, 0f, 0f); getOutPos.transform.localRotation = Quaternion.identity; getOutPosition = getOutPos.transform; } if(GetComponent<RCCCarCameraConfig>()) GetComponent<RCCCarCameraConfig>().enabled = false; }
public void selection(GameObject g) { if ((srcHex != null && dstHex != null) || (srcHex == null && dstHex == null)) { clear(); srcHex = g; srcHexController = srcHex.GetComponent<HexController>(); srcSelected = true; srcHexController.setSelected(true); } else if (srcHex != null && dstHex == null) { dstHex = g; dstHexController = dstHex.GetComponent<HexController>(); dstSelected = true; //Debug.Log (src + " - " + dst); // action here! Coordinate src = new Coordinate(srcHex.GetComponent<ObjectInfo>().line,srcHex.GetComponent<ObjectInfo>().column); Coordinate dst = new Coordinate(dstHex.GetComponent<ObjectInfo>().line,dstHex.GetComponent<ObjectInfo>().column); //clear(); if ( gameState.moveStone(src,dst,gameState.getTurn()) ) { refresh = true; } } //Debug.Log ( src + " - " + dst ); }
void fire() { currentAmmo--; Vector3 mousePos = Camera.main.ScreenToWorldPoint (Input.mousePosition); AudioSource.PlayClipAtPoint (sound, transform.position); GameObject zombini = GameObject.Find ("Zombini"); bool temp = zombini.GetComponent<ZombiniController>().facingRight; Vector3 spawnLocation = GameObject.Find("sphere_missile").transform.position; missile = ((GameObject)Instantiate (Resources.Load ("prefab_missile"), spawnLocation, transform.rotation)); Vector3 flip = new Vector3(-4, 4, 1); Vector3 temp2 = new Vector3(1,0,2); Vector3 temp3 = new Vector3(-1,0,2); if(mousePos.x > transform.position.x) { missile.transform.localScale = flip; missile.GetComponent<Missile> ().velocity = temp2; } else missile.GetComponent<Missile> ().velocity = temp3; mousePos.z = 1; // missile.GetComponent<Missile> ().velocity = (mousePos - transform.position).normalized; // missile.GetComponent<Missile> ().velocity = temp2; }
public static IEnumerator PlayGameStartAnimation(GameObject cleaver) { // Display a random tip System.Random tipIndex = new System.Random(); string tipToShow = SwipeballConstants.UIText.TipText[tipIndex.Next(0, SwipeballConstants.UIText.TipText.Length)]; GameObject.Find(SwipeballConstants.GameObjectNames.MainMenu.Tip).GetComponent<Image>().enabled = true; GameObject.Find(SwipeballConstants.GameObjectNames.MainMenu.TipText).GetComponent<Text>().enabled = true; GameObject.Find(SwipeballConstants.GameObjectNames.MainMenu.TipText).GetComponent<Outline>().enabled = true; GameObject.Find(SwipeballConstants.GameObjectNames.MainMenu.TipText).GetComponent<Text>().text = tipToShow; GameObject.Find(SwipeballConstants.GameObjectNames.MainMenu.ProfilePicture).GetComponent<Image>().CrossFadeAlpha(0.0f, SwipeballConstants.Effects.GameStartGraphicFadeDuration, false); foreach (GameObject textGameObject in GameObject.FindGameObjectsWithTag(SwipeballConstants.GameObjectNames.GameObjectTags.TextTag)) { textGameObject.GetComponent<Text>().CrossFadeAlpha(0.0f, SwipeballConstants.Effects.GameStartGraphicFadeDuration, false); } // Make the cleaver turn green and rotate faster cleaver.GetComponent<Rigidbody2D>().angularVelocity = 20; cleaver.GetComponent<Light>().color = SwipeballConstants.Colors.Cleaver.HighPower; if(SaveDataHandler.GetLoadedSaveData().soundEnabled && GameObject.Find(SwipeballConstants.GameObjectNames.MainMenu.MenuEffects).GetComponent<AudioSource>() != null) { GameObject.Find(SwipeballConstants.GameObjectNames.MainMenu.MenuEffects).GetComponent<AudioSource>().PlayOneShot(GameObject.Find(SwipeballConstants.GameObjectNames.MainMenu.MenuEffects).GetComponent<AudioSource>().clip); } // Provides enough time for the above animation to play yield return new WaitForSeconds(SwipeballConstants.Effects.GameStartAnimationDuration); GameObject.Find(SwipeballConstants.GameObjectNames.MainMenu.MenuEffects).GetComponent<MainMenuBehaviour>().StartGame(); }
public void Decorate(GameObject go, CustomSceneryV1 customScenery) { if (go.GetComponent<Deco>() != null) { go.GetComponent<Deco>().defaultGridSubdivision = customScenery.GridSubdivision; } }
// Use this for initialization void Start () { _AmbientMainSource = Instantiate(_audioSourcePrefab, transform.position, Quaternion.identity) as GameObject; _AmbientMainSource.transform.parent = this.transform; _AmbientMainSource.GetComponent<AudioSource>().clip = _music; _AmbientMainSource.GetComponent<AudioSource>().loop = true; _AmbientMainSource.GetComponent<AudioSource>().Play(); }
public void ShowPart(GameObject _pt) { foreach(GameObject _obj in _parts){ _obj.GetComponent<ObjControll>()._info.SetActive(false); } FsmVariables.GlobalVariables.GameObjectVariables[0] = _pt; _pt.GetComponent<ObjControll>()._info.SetActive(true); if (_pt.GetComponent<Animator>() != null){ _pt.GetComponent<Animator>().Play("action"); } _SOUND.StopMusic(true); //string sndName = "whisp1"; switch(_pt.name){ case "Obj1": _SOUND.Play("whisp1", 0.4f, 1f); rotangle = 335; break; case "Obj2": _SOUND.Play("whisp1", 0.4f, 1f); rotangle = 164; break; case "Obj3": _SOUND.Play("whisp1", 0.4f, 1f); rotangle = 287; break; case "Obj4": _SOUND.Play("swish", 0.4f, 1f); rotangle = 113; break; case "Obj5": _SOUND.Play("water", 0.4f, 1f); rotangle = 224; break; case "Obj6": _SOUND.Play("swish", 0.4f, 1f); rotangle = 76; break; //case "Obj7": _SOUND.Play("swish", 0.4f, 1f); break; default: break; } PlayMakerGlobals.Instance.Variables.Vector3Variables[0].Value = new Vector3(0, rotangle, 0); }
void addNpcAndAssignHome(GameObject room) { if(this.npcCount <= this.npcCountMax){ UnityEngine.Object npcObject = Resources.Load (Utils.PREFAB_CHARACTER_FOLDER + "npc"); GameObject sofa = null; foreach (GameObject roomItemIn in Utils.getChildrenWithTag(room, "object")){ if(roomItemIn.name == "sofa") { sofa = roomItemIn; } } if(sofa != null) { newNpc = Instantiate(npcObject, transform.position= sofa.transform.position, transform.rotation) as GameObject; newNpc.name = "npc" + this.npcCount; newNpc.GetComponent<characterValues>().currentRoom = room; newNpc.transform.parent = room.transform; newNpc.renderer.sortingOrder = 1; newNpc.GetComponent<characterValues>().home = room.transform.parent.gameObject; newNpc.GetComponent<characterValues>().homeCheckPoint = sofa; this.npcCount++; } } }
public void ProcessClickedCube(GameObject clickedCube, int x, int y) { print (x + ", " + y); if (x == airplane.x && y == airplane.y && airplane.activeAirplane == false) { airplane.activeAirplane = true; allCubes [8, 0].GetComponent<Renderer> ().material.color = Color.black; clickedCube.GetComponent<Renderer> ().material.color = Color.yellow; print ("Active Airplane"); } //activate airplane else if (x == airplane.x && y == airplane.y && airplane.activeAirplane) { airplane.activeAirplane = false; allCubes [8, 0].GetComponent<Renderer> ().material.color = Color.black; clickedCube.GetComponent<Renderer> ().material.color = Color.red; print ("Inactive airplane"); }//deactivate airplane /*else if (airplane.activeAirplane && (x != airplane.x || y != airplane.y)) { allCubes[airplane.x, airplane.y].GetComponent<Renderer>().material.color = Color.white; allCubes[8,0].GetComponent<Renderer>().material.color = Color.black; allCubes[x,y].GetComponent<Renderer>().material.color = Color.yellow; airplane.x = x; airplane.y = y; print ("Teleport!") }*/ }
public void AddInlineGraphicsChild() { if (m_inlineGraphic != null) { //Debug.LogWarning("A child Inline Graphics object already exists."); return; } GameObject inlineGraphicObj = new GameObject("Inline Graphic"); m_inlineGraphic = inlineGraphicObj.AddComponent<InlineGraphic>(); m_inlineGraphicRectTransform = inlineGraphicObj.GetComponent<RectTransform>(); m_inlineGraphicCanvasRenderer = inlineGraphicObj.GetComponent<CanvasRenderer>(); m_inlineGraphicRectTransform.SetParent(transform, false); m_inlineGraphicRectTransform.localPosition = Vector3.zero; m_inlineGraphicRectTransform.anchoredPosition3D = Vector3.zero; m_inlineGraphicRectTransform.sizeDelta = Vector2.zero; m_inlineGraphicRectTransform.anchorMin = Vector2.zero; m_inlineGraphicRectTransform.anchorMax = Vector2.one; m_TextMeshPro = gameObject.GetComponent<TextMeshPro>(); m_TextMeshProUI = gameObject.GetComponent<TextMeshProUGUI>(); }
public void NewTarget(GameObject targ) { if ( target != targ ) { target = targ; t = 0.0f; if ( target ) { filter = (MeshFilter)target.GetComponent(typeof(MeshFilter)); if ( filter != null ) center = filter.mesh.bounds.center; else { render = (MeshRenderer)target.GetComponent(typeof(MeshRenderer)); if ( render != null ) center = render.bounds.center; else { srender = (SkinnedMeshRenderer)target.GetComponent(typeof(SkinnedMeshRenderer)); if ( srender != null ) center = srender.bounds.center; } } } } }
public void Decorate(GameObject go, Dictionary<string, object> options, AssetBundle assetBundle) { if (go.GetComponent<Deco>() != null && _grid) { go.GetComponent<Deco>().buildOnGrid = _grid; } }