五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Unity腳本優(yōu)化(一)

2020-05-09 17:55 作者:unity_某某師_高錦錦  | 我要投稿

Before優(yōu)化前


void TakeDamage() {

????if (GetComponent<HealthComponent>().health < 0) {

????GetComponent<Rigidbody>().detectCollisions = false;

????GetComponent<Collider>().enabled = false;

????GetComponent<AIControllerComponent>().enabled = false;

????GetComponent<Animator>().SetTrigger("death");

????}

}


After優(yōu)化后


// private variables to store cached references

private HealthComponent _healthComponent;

private Rigidbody _rigidbody;

private Collider _collider;

private AIControllerComponent _aiController;

private Animator _animator;


// cache the references during initialization

void Awake() {

_healthComponent = GetComponent<HealthComponent>();

_rigidbody = GetComponent<Rigidbody>();

_collider = GetComponent<Collider>();

_aiController = GetComponent<AIControllerComponent>();

_animator = GetComponent<Animator>();

}


// use the cached references at runtime

void TakeDamage() {

if (_healthComponent.health < 0) {

_rigidbody.detectCollisions = false;

_collider.enabled = false;

_aiController.enabled = false;

_animator.SetTrigger("death");

}

}


Unity腳本優(yōu)化(一)的評論 (共 條)

分享到微博請遵守國家法律
贵阳市| 尚志市| 通海县| 汉阴县| 平顶山市| 察哈| 合水县| 绥棱县| 凌云县| 临海市| 阿勒泰市| 云和县| 朝阳市| 满城县| 德州市| 湟中县| 容城县| 壶关县| 屯昌县| 安丘市| 洛宁县| 六枝特区| 德昌县| 鲁山县| 阿拉善盟| 大竹县| 兴安盟| 个旧市| 宁晋县| 乐东| 洮南市| 景洪市| 宁远县| 博白县| 驻马店市| 龙山县| 枝江市| 武鸣县| 大悟县| 阿图什市| 云龙县|