Subversion Repository Public Repository

Nextrek

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
 *
 *	Adventure Creator
 *	by Chris Burton, 2013-2014
 *	
 *	"SortingArea.cs"
 * 
 *	This script is a container class for individual regions of a SortingMap.
 * 
 */

using UnityEngine;

[System.Serializable]
public class SortingArea
{

	public float z;
	public int order;
	public string layer;
	public Color color;
	public int scale = 100;


	public SortingArea (SortingArea lastArea)
	{
		z = lastArea.z + 1f;
		order = lastArea.order + 1;
		layer = "";
		scale = lastArea.scale;
		color = GetRandomColor ();
	}


	public SortingArea (SortingArea area1, SortingArea area2)
	{
		z = (area1.z + area2.z) / 2f;

		float _avOrder = (float) area1.order + (float) area2.order;
		order = (int) (_avOrder / 2f);

		float _avScale = (float) area1.scale + (float) 	area2.scale;
		scale = (int) (_avScale / 2f);

		layer = "";
		color = GetRandomColor ();
	}


	public SortingArea (float _z, int _order)
	{
		z = _z;
		order = _order;
		layer = "";
		scale = 100;
		color = GetRandomColor ();
	}


	private Color GetRandomColor ()
	{
		return new Color (Random.Range (0f, 1f),Random.Range (0f, 1f), Random.Range (0f, 1f));
	}

}

Commits for Nextrek/SpaceCrew/SpaceCrew/Assets/AdventureCreator/Scripts/Navigation/SortingArea.cs

Diff revisions: vs.
Revision Author Commited Message
83 FMMortaroli picture FMMortaroli Tue 13 May, 2014 11:32:51 +0000