public void Setup() { comun = new Comun(2); red = new Red(10); bomb = new Bomb(3); chuck = new Chuck(4); terence = new Terence(3, 2); matilda = new Matilda(4, new List <Huevo>() { new Huevo(2), new Huevo(3), new Huevo(1), new Huevo(4) }); madera = new Madera(3); vidrio = new Vidrio(1); piedra = new Piedra(2); obrero = new Obrero(); armadoEscudo = new Armado(new Escudo(2)); armadoCasco = new Armado(new Casco(4)); isla = new Isla(new List <Pajaro>() { comun, red, bomb, chuck, terence, matilda }); islaCerditos = new Isla_Cerdo(new List <Obstaculo>() { madera, vidrio, piedra, obrero, armadoCasco, armadoEscudo }); }
/*void OnTriggerEnter(Collider other) * { * Debug.Log ("onTriggerEnter"); * switch (other.tag) * { * case "Rule1": * case "Rule2": * case "Rule3": * * // Execute Rule1 * Chuck chuck = ChuckManager.Instance.Get (other.tag); * if (chuck != null){ * Debug.Log("isExe = false"); * isExe = false; * chuck.Execute (); * } * Debug.Log (other.tag); * break; * } * }*/ void OnTriggerEnter2D(Collider2D other) { Debug.Log("OnTriggerEnter2D:" + other.name); switch (other.gameObject.tag) { case "Rule1": case "Rule2": case "Rule3": // Execute Rule1 Chuck chuck = ChuckManager.Instance.Get(other.gameObject.tag); if (chuck != null) { chuck.Execute(); } Destroy(other.gameObject); Debug.Log("other.gameObject.tag : " + other.gameObject.tag); break; case "Feather": Destroy(other.gameObject); currentFeather++; Debug.Log(other.gameObject.tag); if (_totalFeather == currentFeather) { Application.LoadLevel("03_stage"); } break; } }
void Awake() { // create a chuck myChuckId = Chuck.Manager.InitializeFilter(); // initialize my buffer int numBuffers; AudioSettings.GetDSPBufferSize(out myBufferLength, out numBuffers); myOutBuffer = new float[myBufferLength * myNumChannels]; // setup group for reliable ordering mySource = GetComponent <AudioSource>(); mySource.outputAudioMixerGroup = Chuck.FindAudioMixerGroup("ChuckMainInstanceDestination"); // setup mic if (useMicrophone) { SetupMic(); } // has init hasInit = true; // when scene is unloaded, check whether we need to clear the chuck SceneManager.sceneUnloaded += OnSceneUnloaded; // don't delete me? if (persistToNextScene) { DontDestroyOnLoad(this.gameObject); } }
public void Create() { GameObject instantiatedGameObject = NGUITools.AddChild(this.transform.parent.gameObject, prefab); instantiatedGameObject.transform.localPosition = _lastPosition; UIButton button = instantiatedGameObject.GetComponentInChildren <UIButton> () as UIButton; Chuck chuck = instantiatedGameObject.GetComponentInChildren <Chuck> () as Chuck; switch (positionOfPrefab.name) { case "ChuckGo": chuck.actionGuid = 100; button.normalSprite = "kiwii_chuck_go"; break; case "ChuckBack": chuck.actionGuid = 200; button.normalSprite = "kiwii_chuck_back"; break; case "ChuckJump": chuck.actionGuid = 300; button.normalSprite = "kiwii_chuck_jump"; break; case "ChuckSlide": chuck.actionGuid = 400; button.normalSprite = "kiwii_chuck_slide"; break; } }
// Use this for initialization void Start() { myChuck = GetComponent <ChuckSubInstance>(); // for no logs: you will probably use this setting 99% of the time. Debug.Log("no chuck logs:"); Chuck.SetLogLevel(Chuck.LogLevel.None); RunAChuckProgram(); // for warnings /* * Debug.Log( "warning chuck logs:" ); * Chuck.SetLogLevel( Chuck.LogLevel.Warning ); * RunAChuckProgram(); */ // for all possible logs. /* * Debug.Log( "'crazy' chuck logs:" ); * Chuck.SetLogLevel( Chuck.LogLevel.Crazy ); * RunAChuckProgram(); */ // see other levels between the above in Chuck.cs }
public void Setup() { red = new Red(10); bomb = new Bomb(10); chuck = new Chuck(10, 50); matilda = new Matilda(10); terence = new Terence(10); comunes = new PajarosComunes(10); pajaros = new List <Pajaros> { red, bomb, chuck, matilda, comunes, terence }; huevo = new Huevos(1000); obreros = new CerditosObreros(); madera = new Madera(20); piedra = new Piedra(5); obstaculos = new List <Obstaculo> { obreros, madera, piedra }; isla = new IslaPajaro(pajaros, obstaculos); }
public Block(Chuck parent, BlockInfo info, Vector3 Pos) { blockid = info.id; pos = Pos; IsTransparent = info.IsTransparent; chuck = parent; map = parent.map; }
public void LoadChuck(Vector2 Index) { GameObject g = Instantiate(Resources.Load <GameObject>("Chuck"), new Vector3(Index.x * 16, 0, Index.y * 16), Quaternion.identity); Chuck chuck = g.GetComponent <Chuck>(); chuck.Load(this, Index, material); ChuckStream.Add(Index, chuck); }
public Block(Chuck parent, BlockInfo.BlockID ID, bool Transparent, Vector3 Pos) { blockid = ID; pos = Pos; IsTransparent = Transparent; chuck = parent; map = parent.map; }
public async Task <List <Search> > Search(string query) { dynamic content_chuck = string.Empty; dynamic content_swapi = string.Empty; var chuck = new Chuck(); var people = new People(); HttpClient client = new HttpClient(); client.BaseAddress = new Uri(base_chuck_URL); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage chuck_response = await client.GetAsync(string.Format(api_chuck, query)); if (chuck_response.IsSuccessStatusCode) { content_chuck = await chuck_response.Content.ReadAsStringAsync(); chuck = JsonConvert.DeserializeObject <Chuck>(content_chuck); } else { content_chuck = string.Format("{0} ({1})", (int)chuck_response.StatusCode, chuck_response.ReasonPhrase); } HttpClient swapi_client = new HttpClient(); swapi_client.BaseAddress = new Uri(base_swapi_URL); swapi_client.DefaultRequestHeaders.Accept.Clear(); swapi_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage swapi_response = await swapi_client.GetAsync(string.Format(api_swapi, query)); if (swapi_response.IsSuccessStatusCode) { content_swapi = await swapi_response.Content.ReadAsStringAsync(); people = JsonConvert.DeserializeObject <People>(content_swapi); } else { content_swapi = string.Format("{0} ({1})", (int)swapi_response.StatusCode, swapi_response.ReasonPhrase); } List <Search> s = new List <Search>(); s.Add(new Search { api_name = base_chuck_URL, chuck = chuck }); s.Add(new Search { api_name = base_swapi_URL, swapi = people }); return(s); }
// ================= PUBLIC FACING ================== // // ---------------------------------------------------- // name: SyncString // desc: start checking chuck for stringToSync so that // later, you can get it whenever you want // ---------------------------------------------------- public void SyncString(ChuckSubInstance chuck, string stringToSync) { // cancel existing if it's happening StopSyncing(); // start up again myChuck = chuck; myStringName = stringToSync; myStringCallback = Chuck.CreateGetStringCallback(MyCallback); }
public void KickSortTest() { int[] vetor = { 1, 7, 1, 5, 20, 11 }; Chuck.KickSort(vetor); foreach (var elemento in vetor) { Console.Write("{0} ", elemento); } }
// ================= PUBLIC FACING ================== // // ---------------------------------------------------- // name: SyncInt // desc: start checking chuck for intToSync so that // later, you can get it whenever you want // ---------------------------------------------------- public void SyncInt(ChuckSubInstance chuck, string intToSync) { // cancel existing if it's happening StopSyncing(); // start up again myChuck = chuck; myIntName = intToSync; myIntCallback = Chuck.CreateGetIntCallback(MyCallback); }
// ================= PUBLIC FACING ================== // // ---------------------------------------------------- // name: ListenForEvent // desc: start checking chuck for eventToListenFor so // that callback will be called when the event // broadcasts (or signals, if it's its turn) // ---------------------------------------------------- public void ListenForEvent(ChuckSubInstance chuck, string eventToListenFor, Action callback) { // cancel existing if it's happening StopListening(); // start up again myVoidCallback = Chuck.CreateVoidCallback(MyCallback); userCallback = callback; myChuck = chuck; myEventName = eventToListenFor; myChuck.StartListeningForChuckEvent(myEventName, myVoidCallback); }
// Use this for initialization void Awake() { // if I don't have a ChuckMainInstance at Awake, see if I can // find one in TheChuck if (chuckMainInstance == null) { chuckMainInstance = TheChuck.instance; } // unity getting stuff int numBuffers; AudioSettings.GetDSPBufferSize(out myBufferLength, out numBuffers); myMonoBuffer = new float[myBufferLength]; // setup group for reliable ordering mySource = GetComponent <AudioSource>(); mySource.outputAudioMixerGroup = Chuck.FindAudioMixerGroup("ChuckSubInstanceDestination"); // other settings mySource.loop = true; mySource.playOnAwake = true; // medium priority mySource.priority = 128; spatialClip = (AudioClip)Resources.Load("Audio/1"); mySource.clip = spatialClip; mySource.Play(); // opposite to have first UpdateSpatialize() take effect prevSpatialize = !spatialize; UpdateSpatialize(); // setup chuck myOutputUgen = chuckMainInstance.GetUniqueVariableName("__dac__"); // replacement dac is initted and constructed here! // so it shouldn't have to be anywhere else. chuckMainInstance.RunCode(string.Format(@" global Gain {0} => blackhole; true => {0}.buffered; " , myOutputUgen)); running = true; // don't delete me? if (persistToNextScene) { DontDestroyOnLoad(this.gameObject); } }
// Use this for initialization void Start() { newRound = true; otherReady = false; startTheTicker = false; sent1000 = false; goToNextStep = false; instructionMesh = (TextMesh)instructionText.GetComponent(typeof(TextMesh)); prevBeat = 0; beat = 0; timeOfLastBeat = 0; beatBufferTime = .09f; prevBeatLength = 0; currLetter = 0; linePos = 0.0f; topColor = new Color32(255, 56, 129, 255); bottomColor = new Color32(63, 56, 255, 255); correctColor = new Color32(56, 224, 101, 255); myChuck = GetComponent <ChuckInstance> (); myGetIntCallback = Chuck.CreateGetIntCallback(GetIntCallback); myCallback = Chuck.CreateVoidCallback(NewMessageReceived); message = -1; newMessage = false; mainScript = main.GetComponent <MainController> (); initialTickerX = ticker.transform.position.x; for (int i = 0; i < acceptableKeys.GetLength(0); i++) { acceptableKeys[i, 2] = (i + 72).ToString(); } //set space to none acceptableKeys[acceptableKeys.GetLength(0) - 1, 2] = "0"; //create container to have new keys added currKeysTop = new GameObject("currKeysTop"); currKeysTop.AddComponent <MeshFilter>(); currKeysTop.AddComponent <MeshRenderer>(); currKeysBottom = new GameObject("currKeysBottom"); currKeysBottom.AddComponent <MeshFilter>(); currKeysBottom.AddComponent <MeshRenderer>(); }
// Use this for initialization void Start() { myChuck = GetComponent <ChuckSubInstance>(); myGetPosCallback = Chuck.CreateGetFloatCallback(GetPosCallback); myTimeStepCallback = Chuck.CreateVoidCallback(BeNotified1); myPos = 0; myChuck.RunCode(@" 1 => global float timeStep; global float pos; global Event notifier; fun void updatePos() { timeStep::second => dur currentTimeStep; currentTimeStep / 1000 => dur deltaTime; now => time startTime; pos => float originalPos; while( now < startTime + currentTimeStep ) { deltaTime / currentTimeStep +=> pos; deltaTime => now; } } fun void playNote() { SinOsc foo => dac; 0.2::second => now; foo =< dac; } while( true ) { spork ~ playNote(); spork ~ updatePos(); notifier.broadcast(); timeStep::second => now; } " ); myChuck.StartListeningForChuckEvent("notifier", myTimeStepCallback); }
public void Setup() { pajarosComunes = new PajarosComunes(10); red = new Red(10); bomb = new Bomb(10); chuck = new Chuck(95, 10); terence = new Terence(10); matilda = new Matilda(10); pajaros = new List <Pajaros> { pajarosComunes, red, bomb, chuck, terence, matilda }; huevo = new Huevo(1000); paredDeVidrio = new ParedVidrio(20); obreros = new CerditosObreros(); paredDeMadera = new ParedMadera(20); obstaculos = new List <Obstaculo> { paredDeVidrio, obreros, paredDeMadera }; islaPajaros = new IslaPajaros(pajaros, obstaculos); }
void Start() { // get reference to chuck instance myChuck = GetComponent <ChuckSubInstance>(); // create the callback we will pass myCallback = Chuck.CreateVoidCallback(CallbackFunction); // run code: make a global event, and every 250 ms, broadcast it to all listeners myChuck.RunCode(@" global Event notifier; while( true ) { notifier.broadcast(); 250::ms => now; } " ); // register myCallback as a listener of Event "notifier" until I tell it to stop myChuck.StartListeningForChuckEvent("notifier", myCallback); }
public static void StaticVsDynamicTyping() { Chuck chuck = new Chuck(); // Zur compile-time steht fest, dass GetWisdom() // am Objekt chuck verfügbar ist chuck.GetWisdom(); // Durch die Zuweisung auf object gehen die // Typinformationen von chuck "verloren" object chuckObj = chuck; // der Compiler sieht nur object und dessen Member // folgendes führt zu einem compile-time error //chuckObj.GetWisdom(); // dynamic sagt dem Compiler, dass das typechecking // erst zur Laufzeit stattfinden soll dynamic chuckDynamic = chuckObj; chuckDynamic.GetWisdom(); }
void Awake() { // create a chuck myChuckId = Chuck.Manager.InitializeFilter(); // initialize my buffer int numBuffers; AudioSettings.GetDSPBufferSize(out myBufferLength, out numBuffers); myOutBuffer = new float[myBufferLength * myNumChannels]; // setup group for reliable ordering mySource = GetComponent <AudioSource>(); mySource.outputAudioMixerGroup = Chuck.FindAudioMixerGroup("ChuckMainInstanceDestination"); // setup mic SetupMic(); // has init hasInit = true; }
// Use this for initialization void Awake() { // unity getting stuff int numBuffers; AudioSettings.GetDSPBufferSize(out myBufferLength, out numBuffers); myOutBuffer = new float[myBufferLength * myNumChannels]; myMonoBuffer = new float[myBufferLength]; // setup group for reliable ordering mySource = GetComponent <AudioSource>(); mySource.outputAudioMixerGroup = Chuck.FindAudioMixerGroup("ChuckSubInstanceDestination"); // other settings mySource.loop = true; mySource.playOnAwake = true; // medium priority mySource.priority = 128; spatialClip = (AudioClip)Resources.Load("1"); mySource.clip = spatialClip; mySource.Play(); // opposite to have first UpdateSpatialize() take effect prevSpatialize = !spatialize; UpdateSpatialize(); // setup chuck myOutputUgen = chuckMainInstance.GetUniqueVariableName("__dac__"); // replacement dac is initted and constructed here! // so it shouldn't have to be anywhere else. chuckMainInstance.RunCode(string.Format(@" external Gain {0} => blackhole; true => {0}.buffered; " , myOutputUgen)); running = true; }
void OnTriggerEnter(Collider other) { if (other.tag == "Chuck") { Vector3 srcPos = getGlobalPosition(this.transform); Vector3 dstPos = getGlobalPosition(other.transform); if (isRightEdge(srcPos, dstPos)) { this.transform.parent = other.transform; this.transform.localPosition = new Vector3(CHUCK_WIDTH, 0); Chuck rootChuck = other.GetComponentInChildren <Chuck> () as Chuck; if (rootChuck != null) { rootChuck._children[0] = this; } } } else if (other.tag == "Destroy") { Debug.Log("Destroy " + gameObject.name); ChuckManager.Instance.Remove(this); Destroy(this.gameObject); } }
// ---------------------------------------------------- // name: CreateGetFloatArrayCallback // desc: create a callback for getting a float array // ---------------------------------------------------- public Chuck.FloatArrayCallback CreateGetFloatArrayCallback(Action <double[], ulong> callbackFunction) { return(Chuck.CreateGetFloatArrayCallback(callbackFunction)); }
// ---------------------------------------------------- // name: CreateGetIntCallback // desc: construct the callback necessary for GetInt // ---------------------------------------------------- public Chuck.IntCallback CreateGetIntCallback(Action <System.Int64> callbackFunction) { return(Chuck.CreateGetIntCallback(callbackFunction)); }
// ---------------------------------------------------- // name: CreateGetIntArrayCallback // desc: create a callback for getting an int array // ---------------------------------------------------- public Chuck.IntArrayCallback CreateGetIntArrayCallback(Action <long[], ulong> callbackFunction) { return(Chuck.CreateGetIntArrayCallback(callbackFunction)); }
// ---------------------------------------------------- // name: CreateVoidCallback // desc: create the callback necessary for waiting on // chuck events // ---------------------------------------------------- public Chuck.VoidCallback CreateVoidCallback(Action callbackFunction) { return(Chuck.CreateVoidCallback(callbackFunction)); }
// ---------------------------------------------------- // name: CreateGetStringCallback // desc: construct the callback necessary for GetString // ---------------------------------------------------- public Chuck.StringCallback CreateGetStringCallback(Action <System.String> callbackFunction) { return(Chuck.CreateGetStringCallback(callbackFunction)); }
// ---------------------------------------------------- // name: CreateGetFloatCallback // desc: construct the callback necessary for GetFloat // ---------------------------------------------------- public Chuck.FloatCallback CreateGetFloatCallback(Action <double> callbackFunction) { return(Chuck.CreateGetFloatCallback(callbackFunction)); }
public void Remove(Chuck chuck) { _chucks.Remove(chuck); }