Пример #1
0
 private void LateUpdate()
 {
     if (canPlayFireEffect)//发射
     {
         ColdDownTime = 0;
         ShotNum++;
         canPlayFireEffect = false;
         m_Audio.PlayOneShot(audioClips[Random.Range(1, audioClips.Length)]);//播放射出音效
         Arrow_Anim.GetComponent <Renderer>().enabled = false;
         Transform newArrow = Instantiate(Arrow_Prefab, Arrow_Anim.transform.position, this.transform.rotation);
         //newArrow.localScale = this.transform.localScale + Vector3.one * (Force - Force_Min) / (Force_Max - Force_Min);
         newArrow.GetComponent <Arrow>().m_Rigidbody.AddForce(this.transform.forward * Force);
         newArrow.name += ShotNum + "_" + Force.ToString("F2");
         Force          = Force_Min;
         BoresightTime  = 1f;
     }
     if (Holding)
     {
         if (!m_Audio.isPlaying)
         {
             m_Audio.PlayOneShot(audioClips[0]);//播放拉弦音效
         }
         Arrow_Anim.GetComponent <Renderer>().enabled = true;
     }
     if (canShowBoresight)
     {
         boresight.material.color = ColorAdjust.ColorAlphaChange(boresight.material.color, ValueAdjust.Lerp(boresight.material.color.a, 0.6f, Time.deltaTime, 5f));
     }
     else
     {
         boresight.material.color = ColorAdjust.ColorAlphaChange(boresight.material.color, ValueAdjust.Lerp(boresight.material.color.a, 0f, Time.deltaTime, 2f));
     }
 }
Пример #2
0
 void Start()
 {
     Arrow_Anim.GetComponent <Renderer>().enabled = false;
     boresight.material.color = ColorAdjust.ColorAlphaChange(boresight.material.color, 0);
 }