//处理用户点击事件 public void clickOne() { GameObject gameObj = null; if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { gameObj = hit.transform.gameObject; } } if (gameObj == null) { return; } if (gameObj.tag != "Disk") { return; } explosion.transform.position = gameObj.transform.position; explosion.GetComponent <ParticleSystem>().GetComponent <Renderer>().material = gameObj.GetComponent <MeshRenderer>().material; explosion.GetComponent <ParticleSystem>().Play(); gameStatus.setScore(gameStatus.getScore() + 10); DiskFactory.getInstance().free(gameObj); }
void Awake() { SSDirector director = SSDirector.getInstance(); director.currentScenceController = this; DF = DiskFactory.DF; }
// Use this for initialization protected void Start() { sceneController = (FirstControl)Director.getInstance().sceneCtrl; diskFactory = sceneController.factory; scoreRecorder = sceneController.scoreRecorder; sceneController.MyActionManager = this; }
// Use this for initialization protected void Start() { sceneController = (SceneController)SSDirector.getInstance().currentScenceController; diskFactory = sceneController.factory; scoreRecorder = sceneController.scoreRecorder; sceneController.actionManager = this; }
static MediaFactory CreateDiskFactory(bool changable = false) { MusicTrack[] tracks = new MusicTrack[] { new MusicTrack("Music Track 1", "Noone", new byte[1]), new MusicTrack("Music Track 2", "Someone", new byte[1]), new MusicTrack("Music Track 3", "Noone", new byte[1]) }; Photo[] photoes = new Photo[] { new Photo("Photo 1", "Some author", new System.Drawing.Bitmap(1, 1)), new Photo("Photo 2", "No author", new System.Drawing.Bitmap(1, 1)), new PhotoReference("Photo 3", "Some author", new Uri("file:///nothing.bmp")) }; MediaFactory factory; if (changable) { factory = new SelectionFactory(tracks, photoes); } else { factory = new DiskFactory(tracks, photoes); } return(factory); }
private void Update() { if (mode != ActionMode.NOTSET && actionManager != null) { time += Time.deltaTime; if (actionManager.getDiskNumber() == 0 && gameState == GameState.RUNNING) { gameState = GameState.ROUNDFINISH; } if (actionManager.getDiskNumber() == 0 && gameState == GameState.START) { currentRound = (currentRound + 1) % round; DiskFactory df = Singleton <DiskFactory> .Instance; for (int i = 0; i < diskNumber; i++) { diskQueue.Enqueue(df.GetDisk(currentRound, mode)); } actionManager.StartThrow(diskQueue); actionManager.setDiskNumber(10); gameState = GameState.RUNNING; } if (time > 1) { DiskRun(); time = 0; } } }
// Use this for initialization void Start() { uInt = gSceneController.GetInstance() as IUserInterface; query = gSceneController.GetInstance() as IGameStatus; judge = gSceneController.GetInstance() as IJudgeEvent; myFactory = DiskFactory.GetInstance(); }
void KemissionDisks() { if (scene.getRound() == 4) { scene.gameOver(); } scene.setTrial(scene.getTrial() + 1); diskIds.Add(DiskFactory.getInstance().getDiskId()); disks.Add(DiskFactory.getInstance().getDiskObject(diskIds[0])); diskScale = Random.Range(1, 3); disks[0].transform.localScale *= diskScale; int chooseColor = Random.Range(0, 7); disks[0].GetComponent <Renderer>().material.color = TotalColor[chooseColor]; disks[0].transform.position = new Vector3(Random.Range(-2.5f, 2.5f), 2.5f, Random.Range(2, 30)); disks[0].SetActive(true); emissionDirection.x = emissionDirection.x * Random.Range(-1, 1); if (scene.getTrial() == 10) { scene.nextRound(); } }
IEnumerator WaitingParticle(float wait_time, RaycastHit hit, DiskFactory disk_factory, GameObject obj) { yield return(new WaitForSeconds(wait_time)); hit.collider.gameObject.transform.position = new Vector3(0, -100, 0); disk_factory.FreeDisk(obj); }
// 发射飞碟, 这里要根据模式的不同作出不同的响应 void emitDisks() { if (state == true) { for (int i = 0; i < emitNumber; ++i) { idList.Add(DiskFactory.getInstance().getDisk()); disks.Add(DiskFactory.getInstance().getDiskObject(idList [i])); disks [i].transform.localScale *= diskScale; disks [i].GetComponent <Renderer> ().material.color = diskColor; disks [i].transform.position = new Vector3(emitPosition.x, emitPosition.y + i, emitPosition.z); disks [i].SetActive(true); disks [i].GetComponent <Rigidbody> ().AddForce(emitDirection * Random.Range(emitSpeed * 5, emitSpeed * 10 / 10), ForceMode.Impulse); } } if (state == false) { for (int i = 0; i < emitNumber; ++i) { idList.Add(DiskFactory.getInstance().getDisk()); disks.Add(DiskFactory.getInstance().getDiskObject(idList [i])); disks [i].transform.localScale *= diskScale; disks [i].GetComponent <Renderer> ().material.color = diskColor; disks [i].transform.position = new Vector3(emitPosition.x, emitPosition.y + i, emitPosition.z); disks [i].SetActive(true); //disks[i].GetComponent<Rigidbody>(). } } }
//第n轮的10次trial每一次都是发射n个飞盘,相邻两个飞盘发射时间间隔为2/n IEnumerator displayRound() { start = false; yield return(new WaitForSeconds(1)); if (DiskFactory.getInstance().isLaunching()) { yield return(new WaitForSeconds(3)); } roundChangeMessageObj.GetComponent <Text>().text = "ROUND_" + getRound(); yield return(new WaitForSeconds(0.8f)); roundChangeMessageObj.GetComponent <Text>().text = " 3 "; yield return(new WaitForSeconds(0.8f)); roundChangeMessageObj.GetComponent <Text>().text = " 2 "; yield return(new WaitForSeconds(0.8f)); roundChangeMessageObj.GetComponent <Text>().text = " 1 "; yield return(new WaitForSeconds(0.8f)); roundChangeMessageObj.GetComponent <Text>().text = " BEGIN! "; yield return(new WaitForSeconds(0.8f)); roundChangeMessageObj.GetComponent <Text>().text = ""; start = true; }
void emissionDisks() { if (scene.getRound() == 4) { scene.gameOver(); } scene.setTrial(scene.getTrial() + 1); for (int i = 0; i < emissionNumber; ++i) { diskIds.Add(DiskFactory.getInstance().getDiskId()); disks.Add(DiskFactory.getInstance().getDiskObject(diskIds[i])); diskScale = Random.Range(1, 3); disks[i].transform.localScale *= diskScale; int chooseColor = Random.Range(0, 7); disks[i].GetComponent <Renderer>().material.color = TotalColor[chooseColor]; disks[i].transform.position = new Vector3(Random.Range(-2.5f, 2.5f), emissionPosition.y + i, emissionPosition.z); disks[i].SetActive(true); emissionDirection.x = emissionDirection.x * Random.Range(-1, 1); disks[i].GetComponent <Rigidbody>().AddForce(emissionDirection * Random.Range(emissionSpeed * 5, emissionSpeed * 10) / 10, ForceMode.Impulse); } if (scene.getTrial() == 10) { scene.nextRound(); } }
// Use this for initialization protected void Start() { sceneController = (FirstSceneControl)Director.getInstance().currentSceneControl; diskFactory = sceneController.GetComponent <DiskFactory>(); scoreRecorder = sceneController.scoreRecorder; sceneController.actionManager = this;//设置动作管理器 }
//处理用户按下空格按键 public void spacePress() { if (Input.GetKeyDown(KeyCode.Space) && !DiskFactory.getInstance().isLaunching()) { StartCoroutine(launchDisks(gameStatus.getRound())); } }
// [Theory] public void RenameFile(string diskimage, string filesystem, string oldfilename, string newfilename, bool writeprotected, string exception) { var readwrite = !writeprotected; using (var srcdisk = DiskFactory.OpenDisk(testdata + diskimage, false)) { using (var dos = DiskFilesystemFactory.OpenFilesystem(ParseFilesystemID(filesystem), new MemoryDisk(srcdisk), readwrite)) { try { dos.RenameFile(oldfilename, newfilename); Assert.True(exception == null); Assert.False(dos.FileExists(oldfilename)); Assert.True(dos.FileExists(newfilename)); dos.Check(); } catch (Exception e) { if (exception == null) { Assert.True(false, e.ToString()); } else { Assert.Equal(e.GetType().FullName, exception); } } } } }
//暂停几秒后回收飞碟 IEnumerator WaitingParticle(float wait_time, RaycastHit hit, DiskFactory disk_factory, GameObject d) { yield return new WaitForSeconds(wait_time); //等待之后执行的动作 hit.collider.gameObject.transform.position = new Vector3(0, -10, 0); DF.FreeDisk(d);//释放GameObject否则血量也会减少 }
void Start() { //初始化参数 一共3级 1级10层 trial = new int[3][]; score_round = new int[3]; int tmp = 0; for (int i = 0; i < 3; i++) { trial[i] = new int[10]; for (int j = 0; j < 10; j++) { trial[i][j] = tmp; tmp += 2 * (i + 1); } score_round[i] = trial[i][0]; } SSDirector director = SSDirector.GetInstance(); director.CurrentScenceController = this; disk_factory = Singleton <DiskFactory> .Instance; score_recorder = Singleton <ScoreRecorder> .Instance; action_manager = gameObject.AddComponent <FlyActionManager>() as FlyActionManager; user_gui = gameObject.AddComponent <UserGUI>() as UserGUI; }
// 点击事件 void OnMouseDown() { //进一步改进,通过导演找到RoundController var thisRound = Director.currentRoundController as RoundController; (thisRound as IClickGUICallbackRoundController).ClickDisk(DiskFactory.GetDiskFromObject(this.gameObject)); }
public int ufoNum = 3; //每一次发射飞碟的数目 void Awake() { director = Director.getInstance();//单例类 score = ScoreRecorder.getInstance(); diskFactory = DiskFactory.getInstance(); director.setGenGameObject(this); diskList = new List <DiskData>(); }
void Awake() { setRound(); factory = Singleton <DiskFactory> .Instance; recorder = Singleton <ScoreRecorder> .Instance; countPersecond = (int)(1f / Time.deltaTime); }
void Start() { SSDirector.GetInstance().CurrentSceneController = this; diskFactory = Singleton <DiskFactory> .Instance; scoreRecorder = Singleton <ScoreRecorder> .Instance; gameObject.AddComponent <FlyActionManager>(); gameObject.AddComponent <UserGUI>(); }
void Start() { alreadyEmited = new List <GameObject> (); explosion = Instantiate(explosion) as ParticleSystem; DF = Singleton <DiskFactory> .Instance; physics = Singleton <PhysicsActionManager> .Instance; kinact = Singleton <CCActionManager> .Instance; }
// Use this for initialization protected void Start() { sceneController = (FirstControl)Director.getInstance().sceneCtrl; diskFactory = sceneController.factory; scoreRecorder = sceneController.scoreRecorder; //sceneController.MyActionManager = this; sceneController.myAdapter.SetNormalAM(this); }
void Awake() { SSDirector director = SSDirector.getInstance(); director.currentScenceController = this; DF = DiskFactory.DF; Manager = this.gameObject.AddComponent <CCPhysicActionManager>() as IActionManager; }
void Awake() { SSDirector director = SSDirector.getInstance(); director.currentScenceController = this; DF = DiskFactory.DF; Manager = GetComponent <CCActionManager>(); }
public static DiskFactory getInstance() { if (_instance == null) { _instance = new DiskFactory(); } return(_instance); }
// Use this for initialization void Start() { disk = DiskFactory.getDisk(); if (disk.onClick()) { addScore(); free(disk); } }
public void OpenDisk(string imagename, Type imagetype) { var imagepath = testdata + imagename; using (var disk = DiskFactory.OpenDisk(imagepath, false)) { disk.GetType().Should().Be(imagetype); } }
public void OpenDiskUnknownFiletype(string imagename) { var imagepath = testdata + imagename; using (var disk = DiskFactory.OpenDisk(imagepath, false)) { disk.Should().BeNull(); } }
void NextRound() { DiskFactory newfactory = Singleton <DiskFactory> .Instance; for (int i = 0; i < 10; i++) { diskQueue.Enqueue(newfactory.GetDisk(round)); } }