// Update is called once per frame void Update() { if (!InRoundLight)//如果没有受到圆台光照射,就判断平行光 { Inlight = IsLight(); } else { Inlight = true; } //Debug.Log(Inlight); if (!Inlight) { //增光 stateQuan += transformSpeed * Time.deltaTime; if (stateQuan >= 1) { stateQuan = 1; if (PhotoOrMirk == PlayerBulletManager.bulletstype.Mirk) { NotificationCenter.DefaultCenter().PostNotification(this, "whenBWChange"); } PhotoOrMirk = PlayerBulletManager.bulletstype.Photo; } for (int i = 0; i < T.Count; i++) { T[i].SetFloat("_bw", stateQuan); } } else { //减光 stateQuan -= transformSpeed * Time.deltaTime; if (stateQuan <= 0) { stateQuan = 0; if (PhotoOrMirk == PlayerBulletManager.bulletstype.Photo) { NotificationCenter.DefaultCenter().PostNotification(this, "whenBWChange"); } PhotoOrMirk = PlayerBulletManager.bulletstype.Mirk; } for (int i = 0; i < T.Count; i++) { T[i].SetFloat("_bw", stateQuan); } } }
void Start() { Inlight = false; HP = 100; HPLimited = 120; AddAttack = 0; transformSpeed = 3f; NotificationCenter.DefaultCenter().AddObserver(this, "GetFortune"); NotificationCenter.DefaultCenter().AddObserver(this, "BrainBeAttacked"); PhotoOrMirk = PlayerBulletManager.bulletstype.Mirk; for (int i = 0; i < T.Count; i++) { T[i].SetFloat("_bw", stateQuan); } }