void buyCookies1() { int checkShop = PlayerPrefs.GetInt("shop1"); if (GameManager.cookiesTotal >= 100 && checkShop == 0) { Debug.Log("Buy"); GameManager.currentColorMiniCookies = 1; mainCookiesSprite.SetSprite("mainCookies_" + GameManager.currentColorMiniCookies.ToString()); mainCookiesSprite.ForceBuild(); MainCookie.currentAnimation = "Down_" + GameManager.currentColorMiniCookies.ToString(); GameManager.cookiesTotal -= 100; PlayerPrefs.SetInt("shop1", 1); } }
// Use this for initialization void Start() { int currentColorMiniCookies = PlayerPrefs.GetInt("CookiesColor"); if (currentColorMiniCookies == 0) { currentColorMiniCookies = 1; } currentSprite = "mainCookies_" + currentColorMiniCookies.ToString(); currentAnimation = "Down_" + currentColorMiniCookies.ToString(); mainCookiesSprite.SetSprite(currentSprite); mainCookiesSprite.ForceBuild(); }
private void HandleMirrorEffect(TableTechChaosEffectIdentifier identifier, FlippableCover obj) { if (identifier == TableTechChaosEffectIdentifier.MIRROR) { AkSoundEngine.PostEvent("Play_WPN_kthulu_soul_01", obj.gameObject); obj.sprite.usesOverrideMaterial = true; tk2dSprite tk2dSprite = obj.sprite as tk2dSprite; tk2dSprite.GenerateUV2 = true; Material material = Instantiate <Material>(obj.sprite.renderer.material); material.DisableKeyword("TINTING_OFF"); material.EnableKeyword("TINTING_ON"); material.SetColor("_OverrideColor", new Color(0f, 1f, 1f)); material.DisableKeyword("EMISSIVE_OFF"); material.EnableKeyword("EMISSIVE_ON"); material.SetFloat("_EmissivePower", 1.75f); material.SetFloat("_EmissiveColorPower", 1f); obj.sprite.renderer.material = material; Shader shader = Shader.Find("Brave/ItemSpecific/MetalSkinLayerShader"); MeshRenderer component = obj.sprite.GetComponent <MeshRenderer>(); Material[] sharedMaterials = component.sharedMaterials; for (int i = 0; i < sharedMaterials.Length; i++) { if (sharedMaterials[i].shader == shader) { return; } } Array.Resize <Material>(ref sharedMaterials, sharedMaterials.Length + 1); Material material2 = new Material(shader); material2.SetTexture("_MainTex", sharedMaterials[0].GetTexture("_MainTex")); sharedMaterials[sharedMaterials.Length - 1] = material2; component.sharedMaterials = sharedMaterials; tk2dSprite.ForceBuild(); obj.specRigidbody.OnPreRigidbodyCollision += new SpeculativeRigidbody.OnPreRigidbodyCollisionDelegate( delegate(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (otherRigidbody.projectile != null && !(otherRigidbody.projectile.Owner is PlayerController) && base.Owner != null) { PassiveReflectItem.ReflectBullet(otherRigidbody.projectile, true, base.Owner, 10f, 1f, 1f, 0f); otherRigidbody.RegisterSpecificCollisionException(obj.specRigidbody); PhysicsEngine.SkipCollision = true; } } ); if (base.Owner.PlayerHasActiveSynergy("#HIDDEN_TECH_SUPER_CHAOS")) { obj.gameObject.AddComponent <MirrorBreakSynergyProcessor>().Initialize(); } } }
public void OnProjectileHitEnemy(Projectile proj, SpeculativeRigidbody enemy, bool fatal) { if (enemy != null) { if (enemy.aiActor != null) { AIActor aiactor = enemy.aiActor; aiactor.sprite.usesOverrideMaterial = true; tk2dSprite tk2dSprite = aiactor.sprite as tk2dSprite; tk2dSprite.GenerateUV2 = true; Material material = UnityEngine.Object.Instantiate <Material>(aiactor.sprite.renderer.material); material.DisableKeyword("TINTING_OFF"); material.EnableKeyword("TINTING_ON"); material.SetColor("_OverrideColor", new Color(0.87f, 0.56f, 0f)); material.DisableKeyword("EMISSIVE_OFF"); material.EnableKeyword("EMISSIVE_ON"); material.SetFloat("_EmissivePower", 1.75f); material.SetFloat("_EmissiveColorPower", 1f); material.SetFloat("_AllColorsToggle", 1f); aiactor.sprite.renderer.material = material; Shader shader = Shader.Find("Brave/ItemSpecific/MetalSkinLayerShader"); MeshRenderer component = aiactor.sprite.GetComponent <MeshRenderer>(); Material[] sharedMaterials = component.sharedMaterials; for (int i = 0; i < sharedMaterials.Length; i++) { if (sharedMaterials[i].shader == shader) { return; } } Array.Resize <Material>(ref sharedMaterials, sharedMaterials.Length + 1); Material material2 = new Material(shader); material2.SetTexture("_MainTex", sharedMaterials[0].GetTexture("_MainTex")); sharedMaterials[sharedMaterials.Length - 1] = material2; component.sharedMaterials = sharedMaterials; tk2dSprite.ForceBuild(); } } }
private void HandleParentRoomEntered(PlayerController p) { if (this.m_hasRoomEnteredProcessed) { return; } this.m_hasRoomEnteredProcessed = true; if (p && p.PlayerHasActiveSynergy("#HIDDEN_TECH_SUPER_CHAOS") && UnityEngine.Random.value < 0.15f && (bool)info.GetValue(base.GetComponent <FlippableCover>()) == false) { info.SetValue(base.GetComponent <FlippableCover>(), true); base.sprite.usesOverrideMaterial = true; tk2dSprite tk2dSprite = base.sprite as tk2dSprite; tk2dSprite.GenerateUV2 = true; Material material = UnityEngine.Object.Instantiate <Material>(base.sprite.renderer.material); material.DisableKeyword("TINTING_OFF"); material.EnableKeyword("TINTING_ON"); material.SetColor("_OverrideColor", new Color(1f, 0.77f, 0f)); material.DisableKeyword("EMISSIVE_OFF"); material.EnableKeyword("EMISSIVE_ON"); material.SetFloat("_EmissivePower", 1.75f); material.SetFloat("_EmissiveColorPower", 1f); base.sprite.renderer.material = material; Shader shader = Shader.Find("Brave/ItemSpecific/MetalSkinLayerShader"); MeshRenderer component = base.sprite.GetComponent <MeshRenderer>(); Material[] sharedMaterials = component.sharedMaterials; for (int i = 0; i < sharedMaterials.Length; i++) { if (sharedMaterials[i].shader == shader) { return; } } Array.Resize <Material>(ref sharedMaterials, sharedMaterials.Length + 1); Material material2 = new Material(shader); material2.SetTexture("_MainTex", sharedMaterials[0].GetTexture("_MainTex")); sharedMaterials[sharedMaterials.Length - 1] = material2; component.sharedMaterials = sharedMaterials; tk2dSprite.ForceBuild(); } }
void SetColorByStatus() { if (GameState.StunTimer > 0) { sprite.color = ColorStun; } else if (GameState.ActivePower.HasValue) { switch (GameState.ActivePower.Value) { case GameState.Power.AlternatePath: sprite.color = ColorAltPath; break; case GameState.Power.Coin2x: sprite.color = ColorCoins2x; break; case GameState.Power.HalvePenalty: sprite.color = ColorHalveLosses; break; case GameState.Power.Invincible: sprite.color = ColorInvincible; break; case GameState.Power.Speed2x: sprite.color = ColorSpeed2x; break; } } else { sprite.color = ColorNormal; } sprite.ForceBuild(); lastPower = GameState.ActivePower; }
public void setColor(int colorIndex) { miniCookiesSprite.SetSprite("mainCookies_" + colorIndex.ToString()); miniCookiesSprite.ForceBuild(); }