游戏获取分数
来源:互联网 发布:解压 mac 编辑:程序博客网 时间:2024/06/08 05:58
using UnityEngine;using System.Collections;public class Scoredemo: MonoBehaviour { string score = "分数:"; public float scores=0; // Use this for initialization void Start () { } // Update is called once per frame void Update () { score = "分数:" + scores; } void OnGUI() { GUI.Label(new Rect(0, 0, 60, 40), score); }}上方为单独分数脚本 放在空物体即可***************************************************using UnityEngine;using System.Collections;public class BulletShoot : MonoBehaviour { public GameObject boomprefabs; // Use this for initialization void Start () { } // Update is called once per frame void Update () { transform.Translate(Vector3.forward * Time.deltaTime * 20); } void OnTriggerEnter( Collider other) { if (other.gameObject.CompareTag("stone")) { Destroy(other.gameObject); Destroy(gameObject); GameObject.Instantiate(boomprefabs, transform.position, transform.rotation);//下方为调用sccores 销毁敌人获取分数 GameObject.Find("GameScore").GetComponent<Scoredemo>().scores+= 10; } }}
阅读全文
0 0
- 游戏获取分数
- 获取分数
- 2048 游戏中添加分数
- 手机游戏 cat physics 分数记录
- bzoj3232: 圈地游戏 0-1分数规划
- bzoj 3232: 圈地游戏 01分数规划
- Unity给游戏添加倒计时和分数
- 支付宝授权获取芝麻信用分数
- 分数
- 分数
- 分数
- 分数
- 分数
- 分数
- 分数
- 分数
- 喵星战争(七):游戏分数的实现
- 【2048强势来袭】第七期:添加游戏分数模块
- Csharp进阶:DataTimeDemo,MathDemo,path类
- eclipse+maven生成web项目的war包的操作方法
- webpack3如何正确引用并使用jQuery库
- Uncaught Error: Bootstrap's JavaScript requires jQuery at bootstrap.min.js:6
- 服务器性能优化的正确姿势
- 游戏获取分数
- eclipse启动tomcat卡在Building new Hibernate SessionFactory
- 异步刷新加载
- LoadRunner常用用语
- C#集成rabbitmq发消息
- Android Studio学习基础篇二
- 打印字号转换(字号-px-磅)
- UVA
- ALV GRID中实现RadioButton单选按钮