Compare mycom; //检测当前手势为哪种手势的组件 void Awake() { a10 = GameObject.Find("1_index_0").GetComponent <Transform>(); a11 = GameObject.Find("1_index_1").GetComponent <Transform>(); a12 = GameObject.Find("1_index_2").GetComponent <Transform>(); mycollider = GameObject.Find("1_index_2").GetComponent <Collider1>(); mycom = GameObject.Find("Main Camera").GetComponent <Compare>(); }
Compare mycom; //确定当前为哪种手势 void Awake() { myfin1 = GameObject.Find("1_index_2").GetComponent <Collider1>(); myfin2 = GameObject.Find("2_middle_2").GetComponent <Collider2>(); myfin3 = GameObject.Find("3_ring_2").GetComponent <Collider3>(); myfin4 = GameObject.Find("4_pinky_2").GetComponent <Collider4>(); parent = GameObject.Find("Hand_right_2").GetComponent <Transform>(); dongjie = RigidbodyConstraints.FreezeAll; mycom = GameObject.Find("Main Camera").GetComponent <Compare>(); }
//Awake is always called before any Start functions void Awake() { // grab each component trigger1 = triggerObject1.GetComponent <Collider1>(); trigger2 = triggerObject2.GetComponent <Collider2>(); trigger3 = triggerObject3.GetComponent <Collider3>(); playerx = player.GetComponent <PartyGoer>(); moveSprite = player.GetComponent <MoveSprite>(); for (int num = 0; num < enemies.Count; num++) { enemix.Add(enemies[num].GetComponent <PartyGoer>()); enemovement.Add(enemies[num].GetComponent <MoveSprite>()); } //Check if instance already exists if (instance == null) { //if not, set instance to this instance = this; } //If instance already exists and it's not this: else if (instance != this) { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); } //Sets this to not be destroyed when reloading scene //DontDestroyOnLoad(gameObject); //Get a component reference to the attached BoardManager script //boardScript = GetComponent<BoardManager2>(); //Call the InitGame function to initialize the first level InitGame(); stress_visual.value = stress; time_count.text = "Time:" + hours + ": 0" + minutes + " pm"; }
private void checkforDamage(Collider1 trig1, Collider2 trig2, Collider3 trig3) { if (trig1.entered) { int addedstress = trig1.count * 3; stress += addedstress; //Debug.Log("Entered Zone 1," + "Count: " + trig1.count + "Added stress: " + addedstress + "Total Stress: " + stress); } if (trig2.entered) { int addedstress = trig2.count * 2; stress += addedstress; //Debug.Log("Entered Zone 2," + "Count: " + trig2.count + "Added stress: " + addedstress + "Total Stress: " + stress); } if (trig3.entered) { int addedstress = trig3.count * 1; stress += addedstress; //Debug.Log("Entered Zone 3," + "Count: " + trig3.count + "Added stress: " + addedstress + "Total Stress: " + stress); } stress_visual.value = stress; }