国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(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ó)家法律
蒙城县| 乌鲁木齐市| 密云县| 晋城| 大关县| 吴江市| 北川| 酉阳| 久治县| 常州市| 杭锦旗| 阳城县| 琼结县| 博兴县| 吐鲁番市| 威宁| 英吉沙县| 澜沧| 西乌| 长宁县| 宜黄县| 阿勒泰市| 香格里拉县| 南丹县| 讷河市| 合江县| 巴彦淖尔市| 莒南县| 余庆县| 凤冈县| 唐海县| 永和县| 无极县| 昌平区| 东辽县| 辽阳市| 房产| 永平县| 旺苍县| 江安县| 从江县|