// Update is called once per frame void Update() { if (Input.GetButtonDown("Fire1")) { Debug.Log("Fired Pressed"); Debug.Log(Input.mousePosition); Vector3 mp = Input.mousePosition; //get Screen Position Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { if (hit.collider.gameObject.tag.Contains("UFO")) //plane tag { Debug.Log("hit " + hit.collider.gameObject.name + "!"); } UFO ufo = hit.transform.gameObject.GetComponent <UFO>(); ufo.isClicked = true; judgement.addScore(ufo.score); UFOFactory.getInstance().recycle(hit.transform.gameObject); } } }
public void SSActionEvent(SSAction source, SSActionEventType events = SSActionEventType.Competeted, int intParam = 0, string strParam = null) { Debug.Log("callback 0"); source.destroy = false; this.start++; UFO ufo = source.gameobject.GetComponent <UFO>(); if (!ufo.isClicked) { Judge.getInstance().subScore(ufo.score); } UFOFactory.getInstance().free(source.gameobject); if (this.start >= sequence.Count) { this.start = 0; if (repeat > 0) { repeat--; } if (repeat == 0) { destroy = true; Debug.Log("callback 1"); this.callback.SSActionEvent(this); } } }
public GameObject getUFO(int round) { GameObject need; if (isFree.Count <= 0) { need = UnityEngine.Object.Instantiate(Resources.Load <GameObject>("Prefabs/UFO"), ruler.getStart(), Quaternion.identity) as GameObject; need.AddComponent <UFO>(); Rigidbody rigidbody = need.AddComponent <Rigidbody>(); rigidbody.useGravity = false; } else { need = isFree[0]; isFree.Remove(need); } isInuse.Add(need); int index = ruler.getColor(); Material material = UnityEngine.Object.Instantiate(Resources.Load <Material>("Materials/" + Enum.GetName(typeof(Ruler.Color), index))); need.GetComponent <MeshRenderer>().material = material; UFO ufo = need.GetComponent <UFO>(); ufo.setScale(ruler.getScale(Judge.getInstance().getRound())); need.transform.position = ruler.getStart(); ufo.setDespos(ruler.getDes(need.transform.position)); ufo.setScore(index + 1); return(need); }
public void SSActionEvent(SSAction source, SSActionEventType events = SSActionEventType.Competeted, int intParam = 0, string strParam = null) { UFO ufo = source.gameobject.GetComponent <UFO>(); if (!ufo.isClicked) { Judge.getInstance().subScore(ufo.score); } UFOFactory.getInstance().free(source.gameobject); }
public void SSActionEvent(SSAction source, SSActionEventType events = SSActionEventType.Competeted, int intParam = 0, string strParam = null) { UFO ufo = source.gameobject.GetComponent <UFO>(); if (!ufo.isClicked) { Judge.getInstance().subScore(ufo.score); } UFOFactory.getInstance().free(source.gameobject); runSequence.Remove(source); if (runSequence.Count <= 0) { if (this.callback != null) { this.callback.SSActionEvent(source); } } }