21403人加入学习
(187人评价)
Unity2D 官方入门案例 - Ruby's Adventure

制作完成于2020年5月5日,基于Unity2019.3

价格 免费

為社麽collision不能直接調用getcomponent?
怎麽解決?

爲什麽if對象就是gameobject;

[展开全文]

草莓动画的实现给动画编辑器添加一个缩放并设置三个关键帧来实现q版草莓的动画

 

[展开全文]

1.定义一个布尔变量控制,用来控制胜利的音效的一次性的播放。

2.定义一个3向量用来存储主角初始的位置,创建一个函数用来初始化主角的位置并把生命值设置成0。当主角生命为0就要让主调用初始化函数。

[展开全文]

audiosource组件可以存放audioclip音频文件

 

[展开全文]

GeNa Pro is a sophisticated level design system that enables you to rapidly and intuitively populate your scenes. Born from years of commercial work, GeNa Pro can populate and shape terrains, spawn anything that can be added to a Unity scene, determine the best places to create and spawn villages and connect them with roads, and can also create roads and rivers and other sophisticated structures along splines. GeNa Pro is at ease at runtime as it is at design time, and was designed with API control and extensibility in mind, so you can both extend GeNa Pro and embed it into your own solutions. GeNa Pro is integrated with Gaia Pro, so that it is simple and fast to create environments that 'just work', and comes with sample spawner content packs for Gaia Pro and the free Flooded Grounds asset, so you can be up and running around in your own levels within minutes.

[展开全文]

Time.deltatime:每一帧占用的时间长度增量(秒)
1s 60帧/59帧/61帧。

update每秒调用60次

[展开全文]

单纯的使用transform组件进行角色的移动控制,当角色身上的RigidyBody组件和别的碰撞器检测碰撞  和  角色本身的通过Transform组件进行移动的脚本会发生冲突,导致角色发生碰撞时闪动

解决方法:直接通过RigidyBody组件提供的MovePosition方法进行移动

[展开全文]

属性不会被暴露在inspector面板

[展开全文]

属性:可以访问但不可修改方法

Ctrl+R+E=自动写属性

public int health{ get{return currentHealth;}}
PS:return 末尾加分号

[展开全文]

来学编程的,直接不画,多简单。

[展开全文]

(gameObject)指代当前脚本挂载对象

!=为不等,==为等于,=为赋值,

[展开全文]

collision(被调用的组件对象).GetComponent<RubyController//>();

[展开全文]

触发检测条件:
1.双方均有(boxcollider)
2.一方为动态且有刚体组件
3.一方为触发器
 

(collider2D collision):collider类型的参数叫做collision

[展开全文]

这岂不是攻击时,碰到敌人,不显示受伤动画?一看就是unity官方游戏玩的少。

[展开全文]

變量設在在public可以在inspector面板看到。

[展开全文]