Exemplo n.º 1
0
 /// <summary>
 /// 更新分数呈现
 /// </summary>
 /// <param name="code"></param>
 private void UpdateData(int code)
 {
     //ToolsFunction.Log(this.gameObject, "接受到的业务代码:" + code);
     if (code == CODE.UPDATE_SCORE)
     {
         SetLabelValue(lScoreTotal, DataConst.SCORE_TOTAL);  //更新显示分数
     }
     if (code == CODE.UPDATE_BLOCK)
     {
         MainTipControl.StartAnim(MainTip, BlockHead);
         lBlockNum.text = DataConst.BLOCK_COUNT.ToString();
     }
     if (code == CODE.UPDATE_PROCESS)
     {
         sRunProcess.value = ((float)State.PROCESS_PERCENT / (float)24);
     }
 }
Exemplo n.º 2
0
    /// <summary>
    /// 检测前方是否即将有障碍物出现,给出提示
    /// </summary>
    public void UpdateRockCheck()
    {
        if ("1" == SettingTb.Element[SettingTb.INDEX_HINT_TIP])   //表示隐藏主界面消息提示,直接不显示提示了
        {
            return;
        }
        lineStart = DataConst.MeDisplay.transform.position + 2 * ToolsFunction.Toward(DataConst.MeDisplay) + 2f * ToolsFunction.ToLeft(DataConst.MeDisplay) + new Vector3(0, 0, -2);
        lineEnd   = DataConst.MeDisplay.transform.position + 2 * ToolsFunction.Toward(DataConst.MeDisplay) - 2f * ToolsFunction.ToLeft(DataConst.MeDisplay) + new Vector3(0, 0, -2);

        Debug.DrawLine(lineStart, lineEnd);
        if (Physics.Linecast(lineStart, lineEnd, out hit, 1))
        {
            //判断是不是障碍物
            string blockName = hit.collider.gameObject.name;
            ToolsFunction.Log(this.gameObject, "line cast name: " + blockName);  //障碍物名称
            if (ToolsFunction.IsBlock(blockName))
            {
                MainTipControl.StartAnim(MainView.MainTip, MainView.BlockHead);
            }
        }
    }