void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Enemy") { CB_Enemy enemy = collision.GetComponent <CB_Enemy>(); //颜色比它更深可以吃 if (enemy.GetGrayLevel() > grayLevel) { playerData.ChangeHP(-1); enemy.DestroyThis(); } else { fishCatchCnt++; GrayLevelUP(); enemy.DestroyThis(); playerSc.monsterData.ChangeHP(-1); } } }
protected override void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Enemy") { CB_Enemy enemy = collision.GetComponent <CB_Enemy>(); if (enemy.GetGrayLevel() != grayLevel) { playerData.ChangeHP(-1); } else { enemy.DestroyThis(); playerSc.monsterData.ChangeHP(-1); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Enemy") { CB_Enemy enemy = collision.GetComponent <CB_Enemy>(); //修补子物体让父物体的trigger扩大 //妈的到底为什么要这样设计,到底怎么分开 playerSc.playerData.ChangeHP(1);//修复,加血抵消 if (enemy.GetGrayLevel() == grayLevel) { enemy.DestroyThis(); playerSc.monsterData.ChangeHP(-1); } } }