Browse Source

Seamless sceneloading

master
Joshua Reason 8 years ago
parent
commit
fb0fdae521
17 changed files with 182 additions and 39 deletions
  1. BIN
      singleTap/SingleTap/Assets/Animations/SpawnAnimator.controller
  2. BIN
      singleTap/SingleTap/Assets/Animations/Spawn_SpinAnimation.anim
  3. BIN
      singleTap/SingleTap/Assets/Materials/BackGround.mat
  4. BIN
      singleTap/SingleTap/Assets/Materials/SpawnMaterial.mat
  5. +4
    -1
      singleTap/SingleTap/Assets/Scripts/BackgroundController.cs
  6. +5
    -4
      singleTap/SingleTap/Assets/Scripts/EnemyController.cs
  7. +87
    -0
      singleTap/SingleTap/Assets/Scripts/GameMemory.cs
  8. +6
    -4
      singleTap/SingleTap/Assets/Scripts/MissileController.cs
  9. +25
    -20
      singleTap/SingleTap/Assets/Scripts/PlayerController.cs
  10. +44
    -0
      singleTap/SingleTap/Assets/Scripts/SpawnController.cs
  11. +5
    -4
      singleTap/SingleTap/Assets/Scripts/TapDetector.cs
  12. +6
    -6
      singleTap/SingleTap/Assets/Shaders/BackGroundEffect.shader
  13. BIN
      singleTap/SingleTap/Assets/_Scenes/Level2.unity
  14. BIN
      singleTap/SingleTap/Assets/_Scenes/TestScene.unity
  15. BIN
      singleTap/SingleTap/ProjectSettings/EditorBuildSettings.asset
  16. BIN
      singleTap/SingleTap/ProjectSettings/QualitySettings.asset
  17. BIN
      singleTap/SingleTap/ProjectSettings/TagManager.asset

BIN
singleTap/SingleTap/Assets/Animations/SpawnAnimator.controller View File


BIN
singleTap/SingleTap/Assets/Animations/Spawn_SpinAnimation.anim View File


BIN
singleTap/SingleTap/Assets/Materials/BackGround.mat View File


BIN
singleTap/SingleTap/Assets/Materials/SpawnMaterial.mat View File


+ 4
- 1
singleTap/SingleTap/Assets/Scripts/BackgroundController.cs View File

@ -6,6 +6,8 @@ public class BackgroundController : MonoBehaviour {
public float transistionSpeed = 1f; public float transistionSpeed = 1f;
public float waitTime = 10f; public float waitTime = 10f;
public bool forceChange = false;
private Material mat; private Material mat;
private float lastTransition = 0.0f; private float lastTransition = 0.0f;
@ -20,8 +22,9 @@ public class BackgroundController : MonoBehaviour {
// Update is called once per frame // Update is called once per frame
void FixedUpdate () { void FixedUpdate () {
if (Time.time - lastTransition >= waitTime) {
if (Time.time - lastTransition >= waitTime || forceChange) {
lastTransition = Time.time; lastTransition = Time.time;
forceChange = false;
StartCoroutine(transition(transistionSpeed)); StartCoroutine(transition(transistionSpeed));
} }

+ 5
- 4
singleTap/SingleTap/Assets/Scripts/EnemyController.cs View File

@ -13,14 +13,14 @@ public class EnemyController : InteractableObject {
public float shotCoolDown = 0.5f; public float shotCoolDown = 0.5f;
public float initShotWait = 0.0f; public float initShotWait = 0.0f;
protected float lastShotTime = 0.0f; protected float lastShotTime = 0.0f;
private GameObject healthDisp;
public GameObject healthDisp;
// Use this for initialization // Use this for initialization
protected virtual void Start () { protected virtual void Start () {
lastShotTime += initShotWait;
healthDisp = GetComponentInChildren<ParticleSystem>().gameObject;
lastShotTime = Time.time + initShotWait;
player = GameObject.FindGameObjectWithTag("Player"); player = GameObject.FindGameObjectWithTag("Player");
playerRigid = player.GetComponent<Rigidbody2D>(); playerRigid = player.GetComponent<Rigidbody2D>();
healthDisp.SetActive(true);
} }
// Update is called once per frame // Update is called once per frame
@ -59,11 +59,12 @@ public class EnemyController : InteractableObject {
health--; health--;
//Debug.Log("I got hit, health: " + health); //Debug.Log("I got hit, health: " + health);
if (health <= 0) { if (health <= 0) {
GameMemory.control.enemyDeath();
Destroy(gameObject); Destroy(gameObject);
} }
Vector3 newScale = new Vector3(health / 10f, health / 10f, health / 10f); Vector3 newScale = new Vector3(health / 10f, health / 10f, health / 10f);
Debug.Log("new scale = " + newScale);
//Debug.Log("new scale = " + newScale);
if (healthDisp != null) { if (healthDisp != null) {
healthDisp.transform.localScale = newScale; healthDisp.transform.localScale = newScale;

+ 87
- 0
singleTap/SingleTap/Assets/Scripts/GameMemory.cs View File

@ -0,0 +1,87 @@
using UnityEngine;
using System.Collections;
public class GameMemory : MonoBehaviour {
public static GameMemory control;
public bool reloadScene = false;
public Color transitionColor;
public GameObject playerPrefab;
public PlayerController playerScript;
private GameObject backGround;
private int SceneLoaded;
public TapDetector tapScript;
// Use this for initialization
void Awake () {
if (control == null) {
DontDestroyOnLoad(gameObject);
control = this;
}else if (control != this) {
Destroy(gameObject);
}
//playerScript = GetComponentInChildren<PlayerController>();
tapScript = GetComponent<TapDetector>();
backGround = GameObject.FindGameObjectWithTag("BackGround");
SceneLoaded = UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex;
}
void Start() {
startLevel();
}
void OnLevelWasLoaded() {
Debug.Log("New Scene");
startLevel();
}
// Update is called once per frame
void Update () {
if (reloadScene) {
reloadScene = false;
UnityEngine.SceneManagement.SceneManager.LoadScene(SceneLoaded);
}
}
public void startLevel() {
if (playerScript != null) {
playerScript.setHealth(3);
} else {
GameObject respawn = GameObject.FindGameObjectWithTag("Respawn");
GameObject player = (GameObject) Instantiate(playerPrefab, respawn.transform.position, respawn.transform.rotation);
DontDestroyOnLoad(player);
player.transform.parent = transform;
playerScript = player.GetComponent<PlayerController>();
tapScript.playerScript = playerScript;
}
}
public void enemyDeath() {
int enemyCount = GameObject.FindGameObjectsWithTag("Enemy").Length;
Debug.Log("EnemyDown. Enemies Left: " + enemyCount);
if (enemyCount -1 == 0) {
SceneLoaded++;
UnityEngine.SceneManagement.SceneManager.LoadScene(SceneLoaded);
}
}
public void playerDeath() {
playerScript = null;
UnityEngine.SceneManagement.SceneManager.LoadScene(SceneLoaded);
}
}

+ 6
- 4
singleTap/SingleTap/Assets/Scripts/MissileController.cs View File

@ -33,6 +33,7 @@ public class MissileController : MonoBehaviour {
// Use this for initialization // Use this for initialization
void Start () { void Start () {
DontDestroyOnLoad(gameObject);
startTime = Time.time; startTime = Time.time;
Collider2D thisCollider = GetComponent<Collider2D>(); Collider2D thisCollider = GetComponent<Collider2D>();
@ -69,7 +70,6 @@ public class MissileController : MonoBehaviour {
private void moveTorwards(Vector3 pos) { private void moveTorwards(Vector3 pos) {
if (boostEffect != null) { if (boostEffect != null) {
Debug.Log("Playing Boost");
boostEffect.startRotation = transform.rotation.eulerAngles.z * Mathf.Deg2Rad; boostEffect.startRotation = transform.rotation.eulerAngles.z * Mathf.Deg2Rad;
boostEffect.Play(); boostEffect.Play();
} }
@ -105,11 +105,13 @@ public class MissileController : MonoBehaviour {
return; return;
} }
Debug.Log("I hit " + coll.gameObject.name);
//Debug.Log("I hit " + coll.gameObject.name);
colScript.shot(); colScript.shot();
if (Explosion != null)
Instantiate(Explosion, transform.position,transform.rotation);
if (Explosion != null) {
GameObject explosion = (GameObject)Instantiate(Explosion, transform.position, transform.rotation);
Destroy(explosion, 2.0f);
}
Destroy(this.gameObject); Destroy(this.gameObject);

+ 25
- 20
singleTap/SingleTap/Assets/Scripts/PlayerController.cs View File

@ -7,6 +7,7 @@ public class PlayerController : InteractableObject {
public GameObject bullet; public GameObject bullet;
public float speed; public float speed;
public float spinSpeed = 5f;
public int health; public int health;
public Renderer healthMat; public Renderer healthMat;
public Color[] healthColor; public Color[] healthColor;
@ -16,12 +17,12 @@ public class PlayerController : InteractableObject {
private int bulletDirection = -1; private int bulletDirection = -1;
private Rigidbody2D rigid; private Rigidbody2D rigid;
private float lastHit = 0.0f; private float lastHit = 0.0f;
private bool isDead = false;
private bool isImmobilized = false;
// Use this for initialization // Use this for initialization
void Start() { void Start() {
rigid = GetComponent<Rigidbody2D>(); rigid = GetComponent<Rigidbody2D>();
rigid.AddForce(Vector2.right * 200);
rigid.AddForce(transform.right * 200);
} }
@ -34,17 +35,17 @@ public class PlayerController : InteractableObject {
public void rotatePlayer() { public void rotatePlayer() {
if (isDead)
if (isImmobilized)
return; return;
rigid.velocity = Vector3.zero; rigid.velocity = Vector3.zero;
transform.Rotate(new Vector3(0, 0, 5f));
transform.Rotate(new Vector3(0, 0, spinSpeed) * 50 * Time.deltaTime);
} }
public void movePlayer() { public void movePlayer() {
if (isDead)
if (isImmobilized)
return; return;
//Debug.Log(transform.rotation.eulerAngles.z * Mathf.Deg2Rad); //Debug.Log(transform.rotation.eulerAngles.z * Mathf.Deg2Rad);
@ -75,7 +76,7 @@ public class PlayerController : InteractableObject {
} }
public void shoot() { public void shoot() {
if (isDead)
if (isImmobilized)
return; return;
GameObject bulletClone = (GameObject)Instantiate(bullet, transform.position + (transform.up * bulletDirection * 0.1f), transform.rotation); GameObject bulletClone = (GameObject)Instantiate(bullet, transform.position + (transform.up * bulletDirection * 0.1f), transform.rotation);
@ -89,38 +90,42 @@ public class PlayerController : InteractableObject {
} }
private void setDead() {
private void ImmobilizePlayer() {
isImmobilized = true;
rigid.angularDrag = 0; rigid.angularDrag = 0;
rigid.drag = 1; rigid.drag = 1;
rigid.constraints = RigidbodyConstraints2D.None; rigid.constraints = RigidbodyConstraints2D.None;
} }
public override void shot() { public override void shot() {
if (Time.time - lastHit < 1) { if (Time.time - lastHit < 1) {
return; return;
} }
health--; health--;
if (isDead) {
if (Explosion != null)
Instantiate(Explosion, transform.position, transform.rotation);
Destroy(this.gameObject, 0.1f);
if (isImmobilized) {
killPlayer();
} }
if (health <= 0) { if (health <= 0) {
isDead = true;
setDead();
ImmobilizePlayer();
health = 0; health = 0;
} }
healthMat.material.color = healthColor[3-health]; healthMat.material.color = healthColor[3-health];
lastHit = Time.time;
lastHit = Time.time;
}
private void killPlayer() {
if (Explosion != null)
DontDestroyOnLoad(Instantiate(Explosion, transform.position, transform.rotation));
GameMemory.control.playerDeath();
Destroy(this.gameObject, 0.1f);
}
public void setHealth(int input) {
health = input;
healthMat.material.color = healthColor[3 - health];
} }
} }

+ 44
- 0
singleTap/SingleTap/Assets/Scripts/SpawnController.cs View File

@ -0,0 +1,44 @@
using UnityEngine;
using System.Collections;
public class SpawnController : MonoBehaviour {
private EnemyController controller;
private CircleCollider2D boxCollider;
public Material mat;
public float animationTime = 5f;
public Color startColor;
public Color endColor;
// Use this for initialization
void Start () {
controller = GetComponentInParent<EnemyController>();
boxCollider = GetComponentInParent<CircleCollider2D>();
mat = new Material(GetComponentInChildren<Renderer>().material);
transform.Find("SpawnCube").GetComponentInChildren<Renderer>().material = mat;
StartCoroutine(spawn(animationTime));
}
private IEnumerator spawn(float time) {
float elapsedTime = 0;
Color transitionColor = startColor;
while ((elapsedTime / time) <= 1) {
transitionColor = Color.Lerp(startColor, endColor, (elapsedTime / time));
mat.color = transitionColor;
elapsedTime += Time.deltaTime;
yield return new WaitForEndOfFrame();
}
controller.enabled = true;
boxCollider.enabled = true;
Destroy(gameObject);
}
}

+ 5
- 4
singleTap/SingleTap/Assets/Scripts/TapDetector.cs View File

@ -12,10 +12,11 @@ public class TapDetector : MonoBehaviour {
private bool isLongDown = false; private bool isLongDown = false;
// Use this for initialization
void Start () {
playerScript = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>();
}
// Use this for initialization
void Start() {
//playerScript = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>();
}
// Update is called once per frame // Update is called once per frame
void Update () { void Update () {

+ 6
- 6
singleTap/SingleTap/Assets/Shaders/BackGroundEffect.shader View File

@ -1,15 +1,15 @@
// Shader created with Shader Forge v1.26 // Shader created with Shader Forge v1.26
// Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/ // Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
// Note: Manually altering this data may prevent you from opening it in Shader Forge // Note: Manually altering this data may prevent you from opening it in Shader Forge
/*SF_DATA;ver:1.26;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,lico:1,lgpr:1,limd:0,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:False,enco:False,rmgx:True,rpth:0,vtps:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:0,bsrc:0,bdst:1,dpts:2,wrdp:True,dith:0,rfrpo:True,rfrpn:Refraction,coma:15,ufog:True,aust:True,igpj:False,qofs:0,qpre:1,rntp:1,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.5,fgcg:0.5,fgcb:0.5,fgca:1,fgde:0.01,fgrn:0,fgrf:300,stcl:False,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False;n:type:ShaderForge.SFN_Final,id:9361,x:33209,y:32712,varname:node_9361,prsc:2|custl-6614-OUT;n:type:ShaderForge.SFN_Color,id:2943,x:32587,y:32901,ptovrint:False,ptlb:HighLight,ptin:_HighLight,varname:_HighLight,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.3602941,c2:0.3602941,c3:0.3602941,c4:1;n:type:ShaderForge.SFN_Color,id:5129,x:32576,y:32684,ptovrint:False,ptlb:LowLight,ptin:_LowLight,varname:_LowLight,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.7132353,c2:0.7132353,c3:0.7132353,c4:1;n:type:ShaderForge.SFN_Lerp,id:6614,x:32890,y:32938,varname:node_6614,prsc:2|A-5129-RGB,B-2943-RGB,T-1023-OUT;n:type:ShaderForge.SFN_Tex2d,id:7481,x:31875,y:33749,ptovrint:False,ptlb:GradienceMap,ptin:_GradienceMap,varname:_Gradience,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:cb89da7e1100944499f9783f8a750859,ntxv:0,isnm:False|UVIN-2380-UVOUT;n:type:ShaderForge.SFN_TexCoord,id:2380,x:31564,y:33766,varname:node_2380,prsc:2,uv:0;n:type:ShaderForge.SFN_Add,id:4392,x:32094,y:33110,varname:node_4392,prsc:2|A-4708-OUT,B-8125-OUT;n:type:ShaderForge.SFN_Lerp,id:8125,x:31852,y:33157,varname:node_8125,prsc:2|A-8573-RGB,B-714-OUT,T-288-OUT;n:type:ShaderForge.SFN_RemapRange,id:714,x:31618,y:33221,varname:node_714,prsc:2,frmn:0,frmx:1,tomn:1,tomx:0|IN-8573-RGB;n:type:ShaderForge.SFN_Tex2d,id:8573,x:31147,y:33174,ptovrint:False,ptlb:TimeMap,ptin:_TimeMap,varname:_TimeNode,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:b8f1d2aab7a1ed0478705fbbbbffde97,ntxv:0,isnm:False|UVIN-1982-UVOUT;n:type:ShaderForge.SFN_TexCoord,id:1982,x:30920,y:33087,varname:node_1982,prsc:2,uv:0;n:type:ShaderForge.SFN_ComponentMask,id:4482,x:32305,y:33086,varname:node_4482,prsc:2,cc1:0,cc2:-1,cc3:-1,cc4:-1|IN-4392-OUT;n:type:ShaderForge.SFN_Code,id:1023,x:32714,y:33346,varname:node_1023,prsc:2,code:IABmAGwAbwBhAHQAIAByAGUAdABWAGEAbAA7AA0ACgAgACAAIAAgACAAIAAgACAAIAAgAA0ACgAgAGYAbABvAGEAdAAgAHQAIAA9ACAAKAAoAEkAbgBwAHUAdAAgACsAIABTAGwAaQBkAGUAcgApAC8AKAAyACoAUwBsAGkAZABlAHIAKQApADsADQAKACAAcgBlAHQAVgBhAGwAIAA9ACAAbABlAHIAcAAgACgAMAAsADEALAB0ACkAOwANAAoAIAAgACAAIAAgACAAIAAgACAAIAAgACAADQAKACAAcgBlAHQAdQByAG4AIABjAGwAYQBtAHAAIAAoAHIAZQB0AFYAYQBsACwAIAAwAC4AMAAsACAAMQAuADAAKQA7AA==,output:0,fname:CieltoGrad,width:384,height:187,input:0,input:0,input_1_label:Input,input_2_label:Slider|A-5345-OUT,B-3076-OUT;n:type:ShaderForge.SFN_Slider,id:4708,x:31020,y:32871,ptovrint:False,ptlb:TimeNode,ptin:_TimeNode,varname:node_4708,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:-1,cur:-0.6582282,max:1;n:type:ShaderForge.SFN_ToggleProperty,id:288,x:31690,y:33410,ptovrint:False,ptlb:InvertMap,ptin:_InvertMap,varname:node_288,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,on:True;n:type:ShaderForge.SFN_Clamp01,id:5345,x:32503,y:33211,varname:node_5345,prsc:2|IN-4482-OUT;n:type:ShaderForge.SFN_Clamp01,id:5374,x:32066,y:33749,varname:node_5374,prsc:2|IN-7481-R;n:type:ShaderForge.SFN_RemapRange,id:3076,x:32297,y:33684,varname:node_3076,prsc:2,frmn:0,frmx:1,tomn:0.001,tomx:1|IN-5374-OUT;proporder:2943-5129-7481-8573-4708-288;pass:END;sub:END;*/
/*SF_DATA;ver:1.26;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,lico:1,lgpr:1,limd:0,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:False,enco:False,rmgx:True,rpth:0,vtps:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:0,bsrc:0,bdst:1,dpts:2,wrdp:True,dith:0,rfrpo:True,rfrpn:Refraction,coma:15,ufog:True,aust:True,igpj:False,qofs:0,qpre:1,rntp:1,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.5,fgcg:0.5,fgcb:0.5,fgca:1,fgde:0.01,fgrn:0,fgrf:300,stcl:False,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False;n:type:ShaderForge.SFN_Final,id:9361,x:33209,y:32712,varname:node_9361,prsc:2|custl-6614-OUT;n:type:ShaderForge.SFN_Color,id:2943,x:32587,y:32901,ptovrint:False,ptlb:HighLight,ptin:_HighLight,varname:_HighLight,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.8676471,c2:0.03827853,c3:0.03827853,c4:1;n:type:ShaderForge.SFN_Color,id:5129,x:32576,y:32684,ptovrint:False,ptlb:LowLight,ptin:_LowLight,varname:_LowLight,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.3823529,c2:0.3823529,c3:0.3823529,c4:1;n:type:ShaderForge.SFN_Lerp,id:6614,x:32890,y:32938,varname:node_6614,prsc:2|A-5129-RGB,B-2943-RGB,T-7325-OUT;n:type:ShaderForge.SFN_Tex2d,id:7481,x:31875,y:33749,ptovrint:False,ptlb:GradienceMap,ptin:_GradienceMap,varname:_Gradience,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:cb89da7e1100944499f9783f8a750859,ntxv:0,isnm:False|UVIN-2380-UVOUT;n:type:ShaderForge.SFN_TexCoord,id:2380,x:31564,y:33766,varname:node_2380,prsc:2,uv:0;n:type:ShaderForge.SFN_Add,id:4392,x:32094,y:33110,varname:node_4392,prsc:2|A-4708-OUT,B-8125-OUT;n:type:ShaderForge.SFN_Lerp,id:8125,x:31852,y:33157,varname:node_8125,prsc:2|A-8573-RGB,B-714-OUT,T-288-OUT;n:type:ShaderForge.SFN_RemapRange,id:714,x:31618,y:33221,varname:node_714,prsc:2,frmn:0,frmx:1,tomn:1,tomx:0|IN-8573-RGB;n:type:ShaderForge.SFN_Tex2d,id:8573,x:31147,y:33174,ptovrint:False,ptlb:TimeMap,ptin:_TimeMap,varname:_TimeNode,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:b8f1d2aab7a1ed0478705fbbbbffde97,ntxv:0,isnm:False|UVIN-1982-UVOUT;n:type:ShaderForge.SFN_TexCoord,id:1982,x:30920,y:33087,varname:node_1982,prsc:2,uv:0;n:type:ShaderForge.SFN_ComponentMask,id:4482,x:32305,y:33086,varname:node_4482,prsc:2,cc1:0,cc2:-1,cc3:-1,cc4:-1|IN-4392-OUT;n:type:ShaderForge.SFN_Code,id:1023,x:32714,y:33346,varname:node_1023,prsc:2,code:IABmAGwAbwBhAHQAIAByAGUAdABWAGEAbAA7AA0ACgAgACAAIAAgACAAIAAgACAAIAAgAA0ACgAgAGYAbABvAGEAdAAgAHQAIAA9ACAAKAAoAEkAbgBwAHUAdAAgACsAIABTAGwAaQBkAGUAcgApAC8AKAAyACoAUwBsAGkAZABlAHIAKQApADsADQAKACAAcgBlAHQAVgBhAGwAIAA9ACAAbABlAHIAcAAgACgAMAAsADEALAB0ACkAOwANAAoAIAAgACAAIAAgACAAIAAgACAAIAAgACAADQAKACAAcgBlAHQAdQByAG4AIABjAGwAYQBtAHAAIAAoAHIAZQB0AFYAYQBsACwAIAAwAC4AMAAsACAAMQAuADAAKQA7AA==,output:0,fname:CieltoGrad,width:384,height:187,input:0,input:0,input_1_label:Input,input_2_label:Slider|A-5345-OUT,B-3076-OUT;n:type:ShaderForge.SFN_Slider,id:4708,x:31020,y:32871,ptovrint:False,ptlb:TimeNode,ptin:_TimeNode,varname:node_4708,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:-1,cur:-0.007141635,max:1;n:type:ShaderForge.SFN_ToggleProperty,id:288,x:31690,y:33410,ptovrint:False,ptlb:InvertMap,ptin:_InvertMap,varname:node_288,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,on:True;n:type:ShaderForge.SFN_Clamp01,id:5345,x:32503,y:33211,varname:node_5345,prsc:2|IN-4482-OUT;n:type:ShaderForge.SFN_Clamp01,id:5374,x:32066,y:33749,varname:node_5374,prsc:2|IN-7481-R;n:type:ShaderForge.SFN_RemapRange,id:3076,x:32297,y:33684,varname:node_3076,prsc:2,frmn:0,frmx:1,tomn:0.0001,tomx:1|IN-5374-OUT;n:type:ShaderForge.SFN_RemapRange,id:7325,x:32955,y:33142,varname:node_7325,prsc:2,frmn:0,frmx:1,tomn:-1,tomx:1|IN-1023-OUT;proporder:2943-5129-7481-8573-4708-288;pass:END;sub:END;*/
Shader "Shader Forge/BackGroundEffect" { Shader "Shader Forge/BackGroundEffect" {
Properties { Properties {
_HighLight ("HighLight", Color) = (0.3602941,0.3602941,0.3602941,1)
_LowLight ("LowLight", Color) = (0.7132353,0.7132353,0.7132353,1)
_HighLight ("HighLight", Color) = (0.8676471,0.03827853,0.03827853,1)
_LowLight ("LowLight", Color) = (0.3823529,0.3823529,0.3823529,1)
_GradienceMap ("GradienceMap", 2D) = "white" {} _GradienceMap ("GradienceMap", 2D) = "white" {}
_TimeMap ("TimeMap", 2D) = "white" {} _TimeMap ("TimeMap", 2D) = "white" {}
_TimeNode ("TimeNode", Range(-1, 1)) = -0.6582282
_TimeNode ("TimeNode", Range(-1, 1)) = -0.007141635
[MaterialToggle] _InvertMap ("InvertMap", Float ) = 1 [MaterialToggle] _InvertMap ("InvertMap", Float ) = 1
} }
SubShader { SubShader {
@ -66,9 +66,9 @@ Shader "Shader Forge/BackGroundEffect" {
float4 frag(VertexOutput i) : COLOR { float4 frag(VertexOutput i) : COLOR {
////// Lighting: ////// Lighting:
float4 _TimeMap_var = tex2D(_TimeMap,TRANSFORM_TEX(i.uv0, _TimeMap)); float4 _TimeMap_var = tex2D(_TimeMap,TRANSFORM_TEX(i.uv0, _TimeMap));
float node_5345 = saturate((_TimeNode+lerp(_TimeMap_var.rgb,(_TimeMap_var.rgb*-1.0+1.0),_InvertMap)).r);
float4 _GradienceMap_var = tex2D(_GradienceMap,TRANSFORM_TEX(i.uv0, _GradienceMap)); float4 _GradienceMap_var = tex2D(_GradienceMap,TRANSFORM_TEX(i.uv0, _GradienceMap));
float3 finalColor = lerp(_LowLight.rgb,_HighLight.rgb,CieltoGrad( node_5345 , (saturate(_GradienceMap_var.r)*0.999+0.001) ));
float node_1023 = CieltoGrad( saturate((_TimeNode+lerp(_TimeMap_var.rgb,(_TimeMap_var.rgb*-1.0+1.0),_InvertMap)).r) , (saturate(_GradienceMap_var.r)*0.9999+0.0001) );
float3 finalColor = lerp(_LowLight.rgb,_HighLight.rgb,(node_1023*2.0+-1.0));
fixed4 finalRGBA = fixed4(finalColor,1); fixed4 finalRGBA = fixed4(finalColor,1);
UNITY_APPLY_FOG(i.fogCoord, finalRGBA); UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
return finalRGBA; return finalRGBA;

BIN
singleTap/SingleTap/Assets/_Scenes/Level2.unity View File


BIN
singleTap/SingleTap/Assets/_Scenes/TestScene.unity View File


BIN
singleTap/SingleTap/ProjectSettings/EditorBuildSettings.asset View File


BIN
singleTap/SingleTap/ProjectSettings/QualitySettings.asset View File


BIN
singleTap/SingleTap/ProjectSettings/TagManager.asset View File


Loading…
Cancel
Save