unity之怪物生出
2015-01-17 23:09
106 查看
public GameObject mouse;//声明老鼠
public GameObject gold;//声明金币
public GameObject HP;//声明血瓶
int i = 9;
void start()
{
mouse = GameObject.FindGameObjectWithTag("mouse");
}
void Update()
{
}
void OnTriggerEnter(Collider other)
{
if (other.tag == "mouse")
{
Slave.life--;
print(Slave.life);
if (Slave.life == 0)
{
Player.experience += 5;
Destroy(other.gameObject ,1.2f);
GameObject go= Instantiate(mouse, new Vector3(Random.Range(54, 72), 0.8677917f, Random.Range(78, 90)), Quaternion.identity) as GameObject ;
Instantiate(gold, other.gameObject.transform.position+new Vector3 (0,0,2), Quaternion.identity);//掉落金币
Instantiate(HP, other.gameObject.transform.position+new Vector3 (2,0,0), Quaternion.identity);//掉落血瓶
Slave.life = 10;
}
}
}
}
public GameObject gold;//声明金币
public GameObject HP;//声明血瓶
int i = 9;
void start()
{
mouse = GameObject.FindGameObjectWithTag("mouse");
}
void Update()
{
}
void OnTriggerEnter(Collider other)
{
if (other.tag == "mouse")
{
Slave.life--;
print(Slave.life);
if (Slave.life == 0)
{
Player.experience += 5;
Destroy(other.gameObject ,1.2f);
GameObject go= Instantiate(mouse, new Vector3(Random.Range(54, 72), 0.8677917f, Random.Range(78, 90)), Quaternion.identity) as GameObject ;
Instantiate(gold, other.gameObject.transform.position+new Vector3 (0,0,2), Quaternion.identity);//掉落金币
Instantiate(HP, other.gameObject.transform.position+new Vector3 (2,0,0), Quaternion.identity);//掉落血瓶
Slave.life = 10;
}
}
}
}
相关文章推荐
- < Unity 3D专栏 >游戏中 - 怪物AI基础篇
- Unity 怪物巡逻并攻击玩家C#代码笔记
- unity射击游戏:超萌射手(3)怪物生成和射击逻辑
- unity小项目主角打击怪物
- unity--怪物打主角
- unity生成怪物
- Unity游戏开发 怪物巡逻AI
- unity学习之怪物名称血条
- unity射击游戏:超萌射手(3)怪物生成和射击逻辑
- Unity学习之不同的怪物自动生成到自己的初始位置
- 【Unity开发】A星算法(怪物终点反复改变的解决办法)
- Unity插件之TDTK的学习之超萌怪物(四)
- Unity UGUI HUD 怪物血条实现
- unity怪物的状态机
- unity手游<少侠历险记>(2)人物攻击动画判定和怪物AI
- unity 自我学习 怪物AI 【转】
- unity初写游戏(四)怪物产生方式
- Unity Application Block 1.0系列(7): Lifetime Managers
- 台北Unity开发者研讨会 笔记
- Unity中根据角度和距离生成物体