void init() //initialize { t1 = gameObject.AddComponent <Timer>(); t2 = gameObject.AddComponent <Timer> (); t3 = gameObject.AddComponent <Timer> (); t4 = gameObject.AddComponent <Timer> (); animator = GetComponent <Animator> (); body = GetComponent <Rigidbody> (); nowHp = hp; PlayerSkill1Obj.SetActive(false); fakeSummonObj.SetActive(false); PlayerSkill2Obj.SetActive(false); r = gameObject.GetComponent <SpriteRenderer>(); //绑定到SpriteRenderer上 //skill3 //exp&level level = 1; setExperience(); isAtt = false; agent = GetComponent <NavMeshAgent> (); skill3_isOnce = true; gamestate = GameState.start; fairy = GameObject.FindObjectOfType <Fairy> (); fairy.changeTalkState((int)gamestate); tSkill1 = gameObject.AddComponent <Timer> (); isOpen = false; }
void FallProps() //掉落 算機率 { for (int i = 0; i < items.Length; i++) { Instantiate(items [i], transform.position + new Vector3(0, 3, 0), transform.rotation); } if (isSpecial) { Fairy fairy = GameObject.FindObjectOfType <Fairy> (); fairy.changeTalkState((int)gamestate); } Destroy(this.gameObject); }
public void change(int i) { fairy = GameObject.FindObjectOfType <Fairy> (); fairy.changeTalkState(i); }