// Use this for initialization void Start() { cubeRigidBody = GetComponent <Rigidbody>(); bc = blink.GetComponent <BlinkController> (); canJump = false; canDoubleJump = false; }
void Awake() { blinkController = GetComponent <BlinkController>(); rend = GetComponentInChildren <Renderer>(); col = GetComponent <BoxCollider>(); voxelization = GetComponentInChildren <VoxelizationClient>(); bodyState = BodySubState.NORMAL; bodyDeactivate = new ParticleSystem[bodyDeactivatePrefabs.Length]; Transform fx = transform.FindDeepChild("FX"); GameObject temp; for (int i = 0; i < bodyDeactivatePrefabs.Length; ++i) { temp = Instantiate(bodyDeactivatePrefabs[i]); temp.transform.SetParent(fx); temp.transform.localPosition = Vector3.zero; bodyDeactivate[i] = temp.GetComponent <ParticleSystem>(); } temp = Instantiate(bodyDestructionPrefab); temp.transform.SetParent(fx); temp.transform.localPosition = Vector3.zero; bodyDestruction = temp.GetComponent <ParticleSystem>(); overground = false; invulnerable = false; }
void Awake() { active = false; blinkController = GetComponent <BlinkController>(); currentInfection = 0f; infectionLevel = InfectionLevel.LEVEL0; infectionNumberMat = infectionNumberTxt.material; currentBrightness = 1f; currentColor = Color.white; infectionNumberTxt.text = "0%"; infectionBar.value = 0; if (brightnessCicleDuration > 0) { brightnessSpeed = 1 / brightnessCicleDuration; } else { brightnessSpeed = 1; } tutorialTriggered = false; SetColor(); }
protected virtual void Awake() { voxelization = GetComponentInChildren <VoxelizationClient>(); rend = GetComponentInChildren <Renderer>(); mainCollider = GetComponent <Collider>(); dyingCollider = transform.FindDeepChild("DyingCollider").gameObject; blinkController = GetComponent <BlinkController>(); }
// Use this for initialization void Awake() { player1 = null; player2 = null; blinkController = GetComponent <BlinkController>(); knockedOutYOffset = knockedOutFx.transform.localPosition.y; currentColor = ChromaColor.RED; }
public void Start() { blinkMat = new Material(Shader.Find("Custom/BlinkShader")); anim = GetComponent <Animator> (); OnBlink += RandomBlinkStuff; OnBlinkEnd += RandomBLinkStuffEnd; Singleton = this; }
private static void FixSceneTextures(Scene arg1) { GameObject[] gameObjects = arg1.GetRootGameObjects(); foreach (GameObject obj in gameObjects) { FixOneTexture(obj); } if (Module <Player> .Self != null && Module <Player> .Self.actor != null) { FixOneTexture(Module <Player> .Self.actor.gameObject); BlinkController bc = (BlinkController)typeof(Actor).GetField("blinkController", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Module <Player> .Self.actor); if (bc != null) { SkinnedMeshRenderer mr = (SkinnedMeshRenderer)typeof(BlinkController).GetField("_mesh", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(bc); if (mr != null) { Dbgl($"Blink controller name: {mr.name} - use 'Blink_{mr.name}'"); string name = $"Blink_{mr.name}"; if (customTexturesMisc.ContainsKey(name) && mr.material && mr.material.HasProperty("_MainTex") && mr.material.mainTexture != null) { Dbgl($"Changing _MainTex texture for {name}"); Texture2D tex = customTexturesMisc[name]; tex.name = $"{name}.png"; mr.material.mainTexture = tex; } if (customTexturesMisc.ContainsKey($"{name}_Brightness") && mr.material && mr.material.HasProperty("_Brightness") && mr.material.mainTexture != null) { Dbgl($"Changing _Brightness texture for {name}"); Texture2D tex = customTexturesMisc[$"{name}_Brightness"]; tex.name = $"{name}_Brightness.png"; mr.material.SetTexture($"{name}_Brightness", tex); } if (customTexturesMisc.ContainsKey($"{name}_Mask") && mr.material && mr.material.HasProperty("_Mask") && mr.material.mainTexture != null) { Dbgl($"Changing _Mask texture for {name}"); Texture2D tex = customTexturesMisc[$"{name}_Mask"]; tex.name = $"{name}_Mask.png"; mr.material.SetTexture($"{name}_Mask", tex); } } } } if (arg1.name == "Main") { FixWorkshopTextures(); } else if (arg1.name == "PlayerHome") { FixHomeTextures(); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); BlinkController action = (BlinkController)target; if (GUILayout.Button("Blink")) { action.Action(); } }
public void Start() { blinkMat = new Material(Shader.Find("Custom/BlinkShader")); anim = GetComponent <Animator> (); OnBlink += RandomBlinkStuff; OnBlinkEnd += RandomBLinkStuffEnd; Singleton = this; crosshair = GameObject.Find("CrossHair").GetComponent <Image>(); }
// Use this for initialization void Awake() { agent = GetComponent <UnityEngine.AI.NavMeshAgent>(); audioSource = GetComponent <AudioSource>(); blinkController = GetComponent <BlinkController>(); rend = GetComponentInChildren <Renderer>(); voxelization = GetComponentInChildren <VoxelizationClient>(); headState = HeadSubState.DEACTIVATED; overground = false; invulnerable = false; }
void Awake() { attractingCollider.radius = attractingColliderRange; damageCollider.radius = damageColliderRange; state = State.NOT_STARTED; currentCharge = 0; elapsedTime = 0f; charge33 = maxCharge / 100 * 33; charge66 = maxCharge / 100 * 66; enemiesInRange = new HashSet <EnemyBaseAIBehaviour>(); blinkController = GetComponent <BlinkController>(); model = transform.Find("Model").gameObject; active = false; }
// Use this for initialization void Awake() { blinkController = GetComponent <BlinkController>(); rigid = GetComponent <Rigidbody>(); }
private static void DumpObjectNames() { Scene scene = SceneManager.GetActiveScene(); if (scene == null) { Dbgl("scene is null"); return; } string names = ""; List <string> meshTextures = new List <string>(); if (Module <Player> .Self != null && Module <Player> .Self.actor != null) { GameObject player = Module <Player> .Self.actor.gameObject; names += $"Player actor mesh and texture names:\r\n\r\n\t"; MeshRenderer[] mrs = player.GetComponentsInChildren <MeshRenderer>(); foreach (MeshRenderer mr in mrs) { if (mr.materials?.Length > 1) { for (int i = 0; i < mr.materials.Length; i++) { if (mr.materials[i] && mr.material.HasProperty("_MainTex") && mr.material.mainTexture != null) { string mt = $"mesh name: {mr.name} material {i} texture name: {mr.materials[i].mainTexture.name}"; if (!meshTextures.Contains(mt)) { meshTextures.Add(mt); } } } } else if (mr.material && mr.material.HasProperty("_MainTex") && mr.material.mainTexture != null) { string mt = $"mesh name: {mr.name} texture name: {mr.material.mainTexture.name}"; if (!meshTextures.Contains(mt)) { meshTextures.Add(mt); } } } SkinnedMeshRenderer[] smrs = player.GetComponentsInChildren <SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer mr in smrs) { if (mr.materials?.Length > 1) { for (int i = 0; i < mr.materials.Length; i++) { if (mr.materials[i] && mr.material.HasProperty("_MainTex") && mr.material.mainTexture != null) { string mt = $"mesh name: {mr.name} material {i} texture name: {mr.materials[i].mainTexture.name}"; if (!meshTextures.Contains(mt)) { meshTextures.Add(mt); } } } } else if (mr.material && mr.material.HasProperty("_MainTex") && mr.material.mainTexture != null) { string mt = $"smesh name: {mr.name} texture name: {mr.material.mainTexture.name}"; if (!meshTextures.Contains(mt)) { meshTextures.Add(mt); } } } BlinkController bc = (BlinkController)typeof(Actor).GetField("blinkController", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Module <Player> .Self.actor); if (bc != null) { SkinnedMeshRenderer smr = (SkinnedMeshRenderer)typeof(BlinkController).GetField("_mesh", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(bc); if (smr != null && smr.material && smr.material.HasProperty("_MainTex") && smr.material.mainTexture != null) { string mt = $"blink mesh name: {smr.name} texture name: {smr.material.mainTexture.name}"; if (!meshTextures.Contains(mt)) { meshTextures.Add(mt); } } } names += string.Join("\r\n\t", meshTextures.ToArray()) + "\r\n\r\n"; meshTextures.Clear(); } names += $"DLC actor mesh and texture names:\r\n\r\n\t"; List <AppearDBData> list = DbReader.Read <AppearDBData>(LocalDb.cur.ReadFullTable("NPCAppear_List"), 20); foreach (AppearDBData data in list) { string path = data.appearPath; NpcAppearUnit unit = Singleton <ResMgr> .Instance.LoadSyncByType <NpcAppearUnit>(AssetType.NpcAppear, path); foreach (SkinnedMeshRenderer mr in unit.smrs) { if (mr.material && mr.material.HasProperty("_MainTex") && mr.material.mainTexture != null) { string mt = $"mesh name: {mr.name} texture name: {mr.material.mainTexture.name}"; if (!meshTextures.Contains(mt)) { meshTextures.Add(mt); } } } } names += string.Join("\r\n\t", meshTextures.ToArray()) + "\r\n\r\n"; meshTextures.Clear(); Dbgl("got dlc actor meshes"); /* * names += $"Non-DLC actor mesh and texture names for scene {scene.name}:\r\n\r\n"; * * Module<ActorMgr>.Self.Foreach(delegate (Actor actor) { * if (actor.SceneName == scene.name && actor.GetComponent<NpcAppear>() == null) * { * GameObject go = actor.modelRoot.transform.parent.gameObject; * SkinnedMeshRenderer[] smrs = go.GetComponentsInChildren<SkinnedMeshRenderer>(); * foreach (SkinnedMeshRenderer mr in smrs) * { * if (mr.material && mr.material.HasProperty("_MainTex")) * { * names += $"\tmesh name: {mr.name} texture name: {mr.material.mainTexture.name}\r\n"; * } * } * } * }); * names += $"\r\n\r\n"; */ GameObject[] gameObjects = scene.GetRootGameObjects(); foreach (GameObject obj in gameObjects) { MeshRenderer[] mrs = obj.GetComponentsInChildren <MeshRenderer>(); foreach (MeshRenderer mr in mrs) { if (mr.material && mr.material.HasProperty("_MainTex") && mr.material.mainTexture != null) { string mt = $"mesh name: {mr.name} texture name: {mr.material.mainTexture.name}"; if (!meshTextures.Contains(mt)) { meshTextures.Add(mt); } } } } Dbgl("got scene objects"); if (scene.name == "Main") { LayeredRegion layeredRegion = (LayeredRegion)typeof(FarmModule).GetField("layeredRegion", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Module <FarmModule> .Self); Region itemLayer = (Region)typeof(LayeredRegion).GetField("itemLayer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(layeredRegion); List <object> slots = AccessTools.FieldRefAccess <Region, List <object> >(itemLayer, "slots"); foreach (object slot in slots) { UnitObjInfo unitObjInfo = (UnitObjInfo)slot.GetType().GetField("unitObjInfo").GetValue(slot); GameObject go = unitObjInfo.go; if (go == null) { break; } MeshRenderer[] mrs = go.GetComponentsInChildren <MeshRenderer>(); foreach (MeshRenderer mr in mrs) { if (mr.material && mr.material.HasProperty("_MainTex") && mr.material.mainTexture != null) { string mt = $"mesh name: {mr.name} texture name: {mr.material.mainTexture.name}"; if (!meshTextures.Contains(mt)) { meshTextures.Add(mt); } } } } } else if (scene.name == "PlayerHome") { Dictionary <string, LayeredRegion> layeredRegions = (Dictionary <string, LayeredRegion>) typeof(WallModule).GetField("walls", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Module <WallModule> .Self); foreach (LayeredRegion layeredRegion in layeredRegions.Values) { Region itemLayer = (Region)typeof(LayeredRegion).GetField("itemLayer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(layeredRegion); List <object> slots = AccessTools.FieldRefAccess <Region, List <object> >(itemLayer, "slots"); foreach (object slot in slots) { UnitObjInfo unitObjInfo = (UnitObjInfo)slot.GetType().GetField("unitObjInfo").GetValue(slot); GameObject go = unitObjInfo.go; if (go == null) { break; } MeshRenderer[] mrs = go.GetComponentsInChildren <MeshRenderer>(); foreach (MeshRenderer mr in mrs) { if (mr.material && mr.material.HasProperty("_MainTex") && mr.material.mainTexture != null) { string mt = $"mesh name: {mr.name} texture name: {mr.material.mainTexture.name}"; if (!meshTextures.Contains(mt)) { meshTextures.Add(mt); } } } } } } names += $"Scene mesh and texture names for scene {scene.name}:\r\n\r\n\t" + string.Join("\r\n\t", meshTextures.ToArray()); Debug.Log(names); }
public void Init(PlayerController pl) { player = pl; blinkController = player.GetComponent <BlinkController>(); animator = player.GetComponent <Animator>(); hexagons = new List <HexagonController>(); specialAttackDetector = player.specialDetector; specialAttackDetector.GetComponent <PlayerSpecialAttackDetector>().Blackboard = this; specialAttackDetector.GetComponent <SphereCollider>().radius = player.specialAttackAffectationRadius; dashPSRotator = player.transform.Find("ParticleSystems/DashPSRotation"); if (InputManager.Devices.Count >= player.Id) { controller = InputManager.Devices[player.Id - 1]; } spawningState = new PlayerSpawningState(); idleState = new PlayerIdleState(); longIdleState = new PlayerLongIdleState(); movingState = new PlayerMovingState(); dashingState = new PlayerDashingState(); speedBumpState = new PlayerSpeedBumpState(); specialState = new PlayerSpecialState(); receivingDamageState = new PlayerReceivingDamageState(); pushedState = new PlayerPushedState(); fallingState = new PlayerFallingState(); dyingState = new PlayerDyingState(); blockedState = new PlayerBlockedState(); invisibleState = new PlayerInvisibleState(); levelClearedState = new PlayerLevelClearedState(); spawningState.Init(this); idleState.Init(this); longIdleState.Init(this); movingState.Init(this); dashingState.Init(this); speedBumpState.Init(this); specialState.Init(this); receivingDamageState.Init(this); pushedState.Init(this); fallingState.Init(this); dyingState.Init(this); blockedState.Init(this); invisibleState.Init(this); levelClearedState.Init(this); string playerStr = ""; switch (player.Id) { case 1: playerStr = "P1"; break; case 2: playerStr = "P2"; break; } moveHorizontal = playerStr + "_Horizontal"; moveVertical = playerStr + "_Vertical"; aimHorizontal = playerStr + "_AimHorizontal"; aimVertical = playerStr + "_AimVertical"; fire = playerStr + "_Fire"; dash = playerStr + "_Dash"; special = playerStr + "_Special"; greenButton = playerStr + "_Green"; redButton = playerStr + "_Red"; blueButton = playerStr + "_Blue"; yellowButton = playerStr + "_Yellow"; playerRayCastMask = LayerMask.GetMask(playerStr + "RayCast"); playerPhysicsLayer = LayerMask.NameToLayer("Player"); enemyPhysicsPlayer = LayerMask.NameToLayer("Enemy"); ResetLifeVariables(); }
void Awake() { blinkController = GetComponent <BlinkController>(); anim = GetComponent <Animator>(); audioSource = GetComponent <AudioSource>(); }
void Start() { blinkController = GetComponent <BlinkController>(); SetEmissionColor(Color.grey); }