技能冷却图标

using UnityEngine;
using System.Collections;

public class StopBoss : MonoBehaviour
{
  public UISprite slider;
  public UIButton stopBoss;
  public int count;
  public UILabel countNum;
//  public GameObject obj;
  private bool stopBossStatus = false;
  public GameObject Night_CorverBoss;
  public GameObject Pig_CorverBoss;
  public GameObject Rain_CorverBoss;
  public GameObject Sun_CorverBoss;

  void Start ()
  {
    UIEventListener.Get (stopBoss.gameObject).onClick = onStopBossBtn;
//    obj = GameObject.FindWithTag ("SunBoss");
    slider.fillAmount = 0f;
    count = -1;
//    countNum.text = count.ToString ();
    //使用道具时
    if (GameBuff.GetInstance ().StopBossBuffNum != 0) {
//      count++;
      count = GameBuff.GetInstance ().StopBossBuffNum;
      stopBossStatus = true;
    } else {
      count++;
      countNum.text = count.ToString ();
      stopBoss.GetComponent<BoxCollider> ().enabled = true;
    }
  }

  void Update ()
  {
    if (CarConfig.GetInstance ().isStopBoss) {
      slider.fillAmount += 1 * 0.0128f;
      CarConfig.GetInstance ().isStopBoss = false;
    }
    if (slider.fillAmount == 1f) {
      count++;
      countNum.text = count.ToString ();
      slider.fillAmount = 0f;
    }
    //设置按钮为可用
    if (count > 0) {
      stopBoss.gameObject.GetComponent<BoxCollider> ().enabled = true;
    }
    countNum.text = count.ToString ();
  }
  //使用拦截道具
  void onStopBossBtn (GameObject ob)
  {
    Debug.Log ("============================================按下拦截按钮============================================");
    //1、购买拦截道具
    //2、吃到一定玉米获得拦截道具
    if (count <= 0) {
      count = 0;
    } else {
      if (stopBossStatus) {
        StopBossType ();
        //        GameBuff.GetInstance ().StopBoss_status = false;
        GameBuff.GetInstance ().StopBossBuffNum = 0;
        stopBossStatus = false;
      }
      StopBossType ();
      stopBoss.gameObject.GetComponent<BoxCollider> ().enabled = false;
      CarConfig.GetInstance ().stopBossTimes++;
      count--;
    }
  }

  void StopBossType ()
  {
    switch (TempValue.GetInstance ().curLandType) {
    case (int)Land_type.Dusk_land:
      GameObject theGameObject = GameObject.FindWithTag ("SunBoss");
      SunBoss sun = theGameObject.GetComponent<SunBoss> ();
      //当按下拦截按钮的时候,实例化一个云,然后获取Boss的位置,将云的位置设置到Boss身上
      GameObject sunObj = (GameObject)Instantiate (Sun_CorverBoss);
      SunCloud sunCorverCloud = sunObj.GetComponent<SunCloud> ();
      sunCorverCloud.Move ();

      sun.SetBossCoveredStatus (true);
      //实例化一个云之后,在CoverCloud中

      GameObject.FindWithTag ("MainCamera").GetComponent<CameraFollowCar> ().SetCoverBoss ((int)Land_type.Dusk_land);  
      break;
    case (int)Land_type.Night_land:
      GameObject nightBoss = GameObject.FindWithTag ("NightFrost");  
      NightFrost frost = nightBoss.GetComponent<NightFrost> ();
      //当按下拦截按钮的时候,实例化一个云,然后获取Boss的位置,将云的位置设置到Boss身上
      GameObject frostObj = (GameObject)Instantiate (Night_CorverBoss);
      NightCloud nightCorverCloud = frostObj.GetComponent<NightCloud> ();
      nightCorverCloud.Move ();

      frost.SetBossCoveredStatus (true);
      GameObject.FindWithTag ("MainCamera").GetComponent<CameraFollowCar> ().SetCoverBoss ((int)Land_type.Night_land);
      break;
    case (int)Land_type.Ground_land:
      GameObject groundBoss = GameObject.FindWithTag ("GroundPig");  
      GroundPig pig = groundBoss.GetComponent<GroundPig> ();
      //当按下拦截按钮的时候,实例化一个云,然后获取Boss的位置,将云的位置设置到Boss身上
      GameObject pigObj = (GameObject)Instantiate (Pig_CorverBoss);
      Bullet bulletCorver = pigObj.GetComponent<Bullet> ();
      bulletCorver.Move ();

      pig.SetBossCoveredStatus (true);
      GameObject.FindWithTag ("MainCamera").GetComponent<CameraFollowCar> ().SetCoverBoss ((int)Land_type.Ground_land);
      break;
    case (int)Land_type.Rain_land:
      GameObject rainBoss = GameObject.FindWithTag ("RainClouds");  
      RainClouds rain = rainBoss.GetComponent<RainClouds> ();
      //当按下拦截按钮的时候,实例化一个云,然后获取Boss的位置,将云的位置设置到Boss身上
      GameObject rainObj = (GameObject)Instantiate (Rain_CorverBoss);
      RainCloud rainCorverCloud = rainObj.GetComponent<RainCloud> ();
      rainCorverCloud.Move ();

      rain.SetBossCoveredStatus (true);
      GameObject.FindWithTag ("MainCamera").GetComponent<CameraFollowCar> ().SetCoverBoss ((int)Land_type.Rain_land);
      break;
    default:
      break;
    }
  }

}




using UnityEngine;
using System.Collections;

public class BtcAcc : MonoBehaviour {

  public UISlider slider;
  private GameObject car;
  private bool isFly;
  private float startFlytime;

  void Start () {
    slider.value = 0;

    isFly = false;
    startFlytime = ClientConstantConfigParseXML.GetValueById ("increaseFlyTime");
  }

  void Update () {
    //TempValue.GetInstance().numToFlyModel 

    if (CarConfig.GetInstance ().isAccFly) {
//      Debug.Log ("****************************************:" + Time.deltaTime);
      slider.value += Time.deltaTime * 0.05f;
//      slider.value += Time.deltaTime * 0.01f;
//      slider.value += Time.time;
      if (slider.value == 1f) {
//      if (slider.value == startFlytime) {
        isFly = true;
        FlyCar (isFly);
      }
    } else {
      slider.value = 0f;
    }
  }

  void FlyCar(bool fly){
    if(fly){
      car = GameObject.FindGameObjectWithTag ("Player") as GameObject;
      car.GetComponent<CarControlor> ().FlyModel (CarConfig.GetInstance ().FlyTime ());
      Debug.Log ("*********************************************************测试飞行模式!" + GameBuff.GetInstance ().Fly_status);
      slider.value = 0;
      isFly = false;
    }
  }

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值