Skip to content

Commit

Permalink
Miglioramento movimento automatico del flusso v2 (cambia direzione e …
Browse files Browse the repository at this point in the history
…non si sovrappone mai)
  • Loading branch information
viggio94 committed Oct 26, 2016
1 parent b324402 commit 4b7902e
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 14 deletions.
122 changes: 108 additions & 14 deletions Assets/Scripts/MovFlusso.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

public class MovFlusso : MonoBehaviour
{
public int moveOk;
public int moveNotOk = 0;
public int lastmoveOk = 0;
void Start()
{
{

InvokeRepeating("moveOn", 1, 1.0f);

Expand All @@ -16,8 +18,9 @@ void Start()
void moveOn()
{

moveOk = Random.Range(1,3);

moveOk = Random.Range(1,9);

moveNotOk = 0;
}

void moveOff()
Expand All @@ -28,22 +31,113 @@ void moveOff()
}
void Update()
{

if (moveOk == 1)
if (moveNotOk == 1)
{
moveOn();
}

if (moveOk == 1 & lastmoveOk != 4)
{
transform.Translate(Vector3.right * Time.deltaTime * Random.Range(3,10) , Space.World);
transform.Translate(Vector3.up * Time.deltaTime * Random.Range(3,10) , Space.World);
gameObject.GetComponent<ParticleSystem>().enableEmission = true;
gameObject.GetComponent<ParticleSystem>().Play();
Debug.Log(moveNotOk);
lastmoveOk = moveOk;
}
else if (moveOk == 1 & lastmoveOk == 4)
{
moveNotOk = 1;
}
if (moveOk == 2 & lastmoveOk !=3)
{
transform.Translate(Vector3.left * Time.deltaTime * Random.Range(3,10) , Space.World);
transform.Translate(Vector3.up * Time.deltaTime * Random.Range(3,10) , Space.World);
gameObject.GetComponent<ParticleSystem>().enableEmission = true;
gameObject.GetComponent<ParticleSystem>().Play();
Debug.Log(moveNotOk);
lastmoveOk = moveOk;
}
else if (moveOk == 2 & lastmoveOk ==3)
{
moveNotOk = 1;
}

if (moveOk == 3 & lastmoveOk !=2)
{
transform.Translate(Vector3.right * Time.deltaTime * Random.Range(3,10) , Space.World);
transform.Translate(Vector3.down * Time.deltaTime * Random.Range(3,10) , Space.World);
gameObject.GetComponent<ParticleSystem>().enableEmission = true;
gameObject.GetComponent<ParticleSystem>().Play();
Debug.Log(moveNotOk);
lastmoveOk = moveOk;
}
else if (moveOk == 3 & lastmoveOk ==2)
{
moveNotOk = 1;
}


transform.Translate(Vector3.right * Time.deltaTime * Random.Range(1,4) , Camera.main.transform);
if (moveOk == 4 & lastmoveOk !=1)
{
transform.Translate(Vector3.left * Time.deltaTime * Random.Range(3,10) , Space.World);
transform.Translate(Vector3.down * Time.deltaTime * Random.Range(3,10) , Space.World);
gameObject.GetComponent<ParticleSystem>().enableEmission = true;
gameObject.GetComponent<ParticleSystem>().Play();
Debug.Log(moveNotOk);
lastmoveOk = moveOk;
}
else if (moveOk == 4 & lastmoveOk ==1)
{
moveNotOk = 1;
}
if (moveOk == 5 & lastmoveOk !=6)
{
transform.Translate(Vector3.right * Time.deltaTime * Random.Range(3,10) , Space.World);
gameObject.GetComponent<ParticleSystem>().enableEmission = true;
gameObject.GetComponent<ParticleSystem>().Play();
Debug.Log("Move 1");
}
if (moveOk == 2)
Debug.Log(moveNotOk);
lastmoveOk = moveOk;
}
else if (moveOk == 5 & lastmoveOk ==6)
{
moveNotOk = 1;
}
if (moveOk == 6 & lastmoveOk !=5)
{
transform.Translate(Vector3.left * Time.deltaTime * Random.Range(1,4) , Camera.main.transform);
transform.Translate(Vector3.left * Time.deltaTime * Random.Range(3,10) , Space.World);
gameObject.GetComponent<ParticleSystem>().enableEmission = true;
gameObject.GetComponent<ParticleSystem>().Play();
Debug.Log("Move 2");
Debug.Log(moveNotOk);
lastmoveOk = moveOk;
}
else if (moveOk == 6 & lastmoveOk ==5)
{
moveNotOk = 1;
}
if (moveOk == 7 & lastmoveOk !=8)
{
transform.Translate(Vector3.up * Time.deltaTime * Random.Range(3,10) , Space.World);
gameObject.GetComponent<ParticleSystem>().enableEmission = true;
gameObject.GetComponent<ParticleSystem>().Play();
Debug.Log(moveNotOk);
lastmoveOk = moveOk;
}
else if (moveOk == 7 & lastmoveOk ==8)
{
moveNotOk = 1;
}
if (moveOk == 8 & lastmoveOk !=7)
{
transform.Translate(Vector3.down * Time.deltaTime * Random.Range(3,10) , Space.World);
gameObject.GetComponent<ParticleSystem>().enableEmission = true;
gameObject.GetComponent<ParticleSystem>().Play();
Debug.Log(moveNotOk);
lastmoveOk = moveOk;
}
else if (moveOk == 8 & lastmoveOk ==7)
{
moveNotOk = 1;
}
if (moveOk == 0)
{
Expand All @@ -55,4 +149,4 @@ void Update()


}
}
}
Binary file modified Assets/_Scenes/Level1.unity
Binary file not shown.
Binary file modified Library/CurrentLayout.dwlt
Binary file not shown.
Binary file modified Library/InspectorExpandedItems.asset
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp.dll
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp.dll.mdb
Binary file not shown.
Binary file modified Library/assetDatabase3
Binary file not shown.
Binary file modified Library/expandedItems
Binary file not shown.
Binary file modified Library/metadata/00/00000000000000004000000000000000
Binary file not shown.
Binary file modified Library/metadata/00/00000000000000006100000000000000
Binary file not shown.
Binary file modified Library/metadata/09/09b828c1ad05c9f48b2926ce94407c2e
Binary file not shown.

0 comments on commit 4b7902e

Please sign in to comment.