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

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

代碼優(yōu)化(1)

2020-05-26 10:37 作者:unity_某某師_高錦錦  | 我要投稿

Before

void TakeDamage() {

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

GetComponent<Rigidbody>().detectCollisions = false;

GetComponent<Collider>().enabled = false;

GetComponent<AIControllerComponent>().enabled = false;

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

}

}


After

// 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");

}

}


代碼優(yōu)化(1)的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
民权县| 剑阁县| 平远县| 三原县| 迭部县| 太康县| 镇平县| 迭部县| 通州区| 雷波县| 阜阳市| 平阳县| 韶山市| 临海市| 团风县| 鸡东县| 泰来县| 婺源县| 花莲县| 商城县| 永福县| 南岸区| 休宁县| 平顺县| 定州市| 青龙| 新干县| 贵南县| 土默特右旗| 曲周县| 四会市| 洞口县| 徐州市| 阳原县| 义马市| 昭通市| 鄂尔多斯市| 遂平县| 盐池县| 民权县| 虞城县|