public void ParallelCursorArrayTest() { DenseVector v1 = DenseVector.Zero(1); DenseVector v2 = DenseVector.Zero(2); VectorArray va1 = new VectorArray(v1, 3, 2); VectorArray va2 = new VectorArray(v2, 3, 2); VectorPair cursor = new VectorPair(v1, v2); VectorArray[] arrays = new VectorArray[] { va1, va2 }; ParallelCursorArray <VectorPair, VectorArray> pa = new ParallelCursorArray <VectorPair, VectorArray>(cursor, arrays); int i; for (i = 0; i < pa.Count; i++) { pa[i].a.SetAllElementsTo(i); pa[i].b.SetAllElementsTo(-i); } i = 0; foreach (VectorPair p in pa) { Console.WriteLine("pa[{0}].shape = {1}, b = {2}", i++, p.a, p.b); } i = 0; foreach (Vector v in va2) { Console.WriteLine("va2[{0}] = {1}", i++, v); } }
public bool comparePairs(VectorPair otherPair) { Vector3 otherV1 = otherPair.vector1; Vector3 otherV2 = otherPair.vector2; return(((vector1.x == otherV1.x && vector1.y == otherV1.y) && (vector2.x == otherV2.x && vector2.y == otherV2.y)) || ((vector1.x == otherV2.x && vector1.y == otherV2.y) && (vector2.x == otherV1.x && vector2.y == otherV1.y))); }
void Start() { // start audio stuff correctPlaySoundMusicSource.clip = correctPlaySound; incorrectPlaySoundMusicSource.clip = incorrectPlaySound; trackMusicMusicSource.clip = trackMusic; trackMusicMusicSource.Play(); //instance variables and arrays keySettings = new InputKeys[4]; currentTilesToDo = new VectorPair[4]; pointerInArray = 0; isInKeyCanvas = false; //generate which letter is destined to each body part // Check there is no repeated values and if there is, correct it Dictionary <char, byte> hash = new Dictionary <char, byte>(); // Check the rest of the hash map for (int index = 0; index < 4; ++index) { keySettings[index] = new InputKeys(); currentTilesToDo[index] = new VectorPair(); _boxes[index].SetPendingState(true); _boxes[index].SetBodyPart(currentTilesToDo[index].GetBodyPart()); //Set the body part value keySettings[index].setBodyPart((BodyParts)(index)); //While it is a key that is in the hash map, get another one while (hash.ContainsKey(keySettings[index].getLetter())) { keySettings[index].generateLetter(); } hash.Add(keySettings[index].getLetter(), 0); } //Set variables for the beggining of the game setValues(); // Save the text for the KeysMenu printKeyText.text = keySettings[0].getLetter().ToString() + "\t\t\t " + keySettings[1].getLetter().ToString() + "\t\t\t " + keySettings[2].getLetter().ToString() + "\t\t\t " + keySettings[3].getLetter().ToString(); //Show key screen for some seconds StartCoroutine(ShowSubMenu(timeTextKeysFirstTime)); }
ContainmentType ICullPrimitive.IntersectWorldSphere(float radius, Vector3 position) { lock (this) { VectorPair pair = new VectorPair(); pair.Camera = cameras.GetCamera(); if (pair.Camera == null) return ContainmentType.Contains; pair.Position = position; pair.Radius = radius; spheres.Add(pair); return ContainmentType.Contains; } }
bool ICullPrimitive.TestWorldSphere(float radius, Vector3 position) { lock (this) { VectorPair pair = new VectorPair(); pair.Camera = cameras.GetCamera(); if (pair.Camera == null) return true; pair.Position = position; pair.Radius = radius; spheres.Add(pair); return true; } }