private Cardinal(BoundCheck chk, int x, int y) { this.chk = chk; this.x = x; this.y = y; }
void Awake() { S = this; //Set utils.camBounds bndCheck = GetComponent <BoundCheck>(); Invoke("SpawnEnemy", 1f / enemySpawnPerSecond); }
void Awake() { bndCheck = GetComponent <BoundCheck>(); materials = Utils.GetAllMaterials(gameObject); OriginalColors = new Color[materials.Length]; for (int i = 0; i < materials.Length; i++) { OriginalColors[i] = materials[i].color; } }
private void Awake() { S = this; bndCheck = GetComponent <BoundCheck>(); Invoke(nameof(SpawnEnemy), 1f / enemySpawnPerSecond); weaponDict = new Dictionary <WeaponType, WeaponDefinition>(); foreach (WeaponDefinition definition in weaponDefinitions) { weaponDict[definition.type] = definition; } }
void Awake() { S = this; //Set utils.camBounds bndCheck = GetComponent <BoundCheck>(); Invoke("SpawnEnemy", 1f / enemySpawnPerSecond); WEAP_DICT = new Dictionary <WeaponType, WeaponDefinition>(); foreach (WeaponDefinition def in weaponDefinitions) { WEAP_DICT[def.type] = def; } }
private void Awake() { cube = transform.Find("Cube").gameObject; letter = GetComponent <TextMesh>(); rb = GetComponent <Rigidbody>(); bndCheck = GetComponent <BoundCheck>(); cubeRenderer = GetComponent <Renderer>(); Vector3 vel = Random.onUnitSphere; vel.z = 0; vel.Normalize(); vel *= Random.Range(driftMinMax.x, driftMinMax.y); rb.velocity = vel; transform.rotation = Quaternion.identity; rotPerSecond = new Vector3(Random.Range(rotMinMax.x, rotMinMax.y), Random.Range(rotMinMax.x, rotMinMax.y), Random.Range(rotMinMax.x, rotMinMax.y)); }
void Awake() { //find the cube reference cube = transform.Find("Cube").gameObject; //fidn the TextMEsh letter = GetComponent <TextMesh>(); rigid = GetComponent <Rigidbody>(); bndCheck = GetComponent <BoundCheck>(); cubeRend = cube.GetComponent <Renderer>(); //set a random velocity Vector3 vel = Random.onUnitSphere; //get random XYZ velocity //Random.onUnitSphere gives you a vector point that is somewhere //on the surface of the sphere with a radius of 1m around the origin vel.z = 0; //flatten the vel to the XY plane vel.Normalize(); //make the length of the vel 1 //normalizing a vector3 makes it length 1m vel *= Random.Range(driftMinMax.x, driftMinMax.y); rigid.velocity = vel; //set the rotiation of this GameObject to R:[0,0,0] transform.rotation = Quaternion.identity; //Quaternion.identity is equal to no rotation //set up the rotPerSecond for the cube child using rotMinMax x and y rotPerSecond = new Vector3(Random.Range(rotMinMax.x, rotMinMax.y), Random.Range(rotMinMax.x, rotMinMax.y), Random.Range(rotMinMax.x, rotMinMax.y)); birthTime = Time.time; }
void Awake() { bndCheck = GetComponent <BoundCheck>(); }
void Awake() { bndCheck = GetComponent <BoundCheck>(); rend = GetComponent <Renderer>(); //d rigid = GetComponent <Rigidbody>(); }
// Use this for initialization void Awake() { maxDistance = (sizeX + sizeZ) * 2; //graphHasBeenBuild = false; roomListIsSet = false; minX = -sizeX; maxX = sizeX; minZ = -sizeZ; maxZ = sizeZ; neighbours = new List <Edge>(); spanningTree = new List <GameObject>(); weightGraph = new List <List <float> >(); //testEdge = new Edge(); graph = new List <Edge>(); roomList = new List <GameObject>(); GameObject dungeon = new GameObject("DungeonContainer"); int x, z; for (int i = 0; i < cubeAmount; i++) { x = Random.Range(minX, maxX); z = Random.Range(minZ, maxZ); Vector3 pos = new Vector3((float)x, (float)0, (float)z); GameObject obj = (GameObject.CreatePrimitive(PrimitiveType.Cube)); obj.transform.position = pos; obj.name = "v" + i; int objWidth = Random.Range(minRoomSize, maxRoomSize); int objHeight = Random.Range(minRoomSize, maxRoomSize); obj.transform.localScale = new Vector3(objWidth, 1, objHeight); //int maxSize = objWidth>objHeight?objWidth:objHeight; //Collider objCol = obj.GetComponent<Collider>(); //objCol.transform.localScale = new Vector3(maxSize,0,maxSize); BoundCheck bc = obj.AddComponent <BoundCheck>(); bc.setSize(sizeX, sizeZ); Rigidbody rb = obj.AddComponent <Rigidbody>(); rb.useGravity = false; rb.isKinematic = false; Collider col = obj.GetComponent <Collider>(); col.isTrigger = true; if (obj.transform.position.x >= maxX || obj.transform.position.x <= minX || obj.transform.position.z >= maxZ || obj.transform.position.z <= minZ) { //Debug.Log("Obj deleted"); //Destroy(obj); } obj.transform.parent = dungeon.transform; roomList.Add(obj); } //testEdge.setEdge(roomList[0], roomList[1]); //createGraph for (int i = 0; i < roomList.Count; i++) { for (int j = i; j < roomList.Count; j++) { if (i != j) { Edge e = new Edge(roomList[i], roomList[j]); e.setEdge(roomList[i], roomList[j]); graph.Add(e); } } } // Debug.Log("Graph primGraphSize:" + weightGraph.Count + "TestRow:" + weightGraph[0][0]); //size graph Debug.Log("Graph size:" + graph.Count); roomListIsSet = true; }