Beispiel #1
0
  public void Awake()
  {
    playArea = new Plane(new Vector3(0, 0, -1), 0);
    cutter = GetComponent<Cutter>();
    cut = false;
    hp = GameObject.FindGameObjectWithTag("hp").GetComponent<Text>().GetComponent<live>();
    //gascloud = (GameObject)Instantiate(gas, gameObject.transform.position, gameObject.transform.rotation);
    //Destroy(gascloud, 10);

    }
        public HttpResponseMessage getLiveList()
        {
            DataTable dt = new BLL.handleHealth().GetLiveList();
            Object    data;

            if (dt.Rows.Count >= 0)
            {
                List <live> list = new List <live>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    live live = new live();
                    live.id           = dt.Rows[i]["id"].ToString();
                    live.companyId    = dt.Rows[i]["companyId"].ToString();
                    live.live_cover   = dt.Rows[i]["live_cover"].ToString();
                    live.live_title   = dt.Rows[i]["live_title"].ToString();
                    live.live_desc    = dt.Rows[i]["live_desc"].ToString();
                    live.live_content = dt.Rows[i]["live_content"].ToString();
                    live.create_time  = dt.Rows[i]["create_time"].ToString();

                    list.Add(live);
                }


                data = new
                {
                    success  = true,
                    backData = list
                };
            }
            else
            {
                data = new
                {
                    success = false,
                    backMsg = "数据异常"
                };
            }

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string json = serializer.Serialize(data);

            return(new HttpResponseMessage
            {
                Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
            });
        }
        public HttpResponseMessage getLiveDetail(string id)
        {
            DataTable dt = new BLL.handleHealth().GetLiveDetail(id);
            Object    data;

            if (dt.Rows.Count == 1)
            {
                live live = new live();
                live.id           = dt.Rows[0]["id"].ToString();
                live.companyId    = dt.Rows[0]["companyId"].ToString();
                live.live_cover   = dt.Rows[0]["live_cover"].ToString();
                live.live_title   = dt.Rows[0]["live_title"].ToString();
                live.live_desc    = dt.Rows[0]["live_desc"].ToString();
                live.live_content = dt.Rows[0]["live_content"].ToString();
                live.create_time  = dt.Rows[0]["create_time"].ToString();

                data = new
                {
                    success  = true,
                    backData = live
                };
            }
            else
            {
                data = new
                {
                    success = false,
                    backMsg = "数据异常"
                };
            }

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string json = serializer.Serialize(data);

            return(new HttpResponseMessage
            {
                Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
            });
        }
Beispiel #4
0
 void switchStates()
 {
     if (myLife == live.wonder)
     {
         currentEnergy -= drain;
         if (currentEnergy <= 0)
         {
             myLife = live.sleep;
         }
     }
     if (myLife == live.sleep)
     {
         if (currentEnergy >= maxEnergy)
         {
             myLife = live.wonder;
         }
     }
     if (myLife == live.wonder && myLife != live.sleep)
     {
         currentHunger -= starvation;
         if (currentHunger <= 0)
         {
             myLife = live.eat;
         }
     }
     if (myLife == live.eat)
     {
         if (currentHunger >= maxHunger)
         {
             myLife = live.wonder;
         }
     }
     if (currentLife <= 0)
     {
         myLife = live.die;
     }
 }
Beispiel #5
0
 void  Start ()
 {
     hp = GameObject.FindGameObjectWithTag("hp").GetComponent<Text>().GetComponent<live>();
 }