public void OnUnitDestroyed(CUnit unit) { switch (unit.GetUnitType()) { case UNIT_TYPE.PLAYER: { mPlayer = null; Debug.Log("on player destroyed"); CUIManager.GetInstance().OnUnitDestroyed(unit); } break; case UNIT_TYPE.ENEMY: { mEnemy = null; Debug.Log("on enemy destroyed"); CUIManager.GetInstance().OnUnitDestroyed(unit); } break; } }
protected override void OnTriggerEntered(CUnit target) { //대상이 없거나, 데미지 무시 기간중이면 if (target == null || mDamageSkipTime > 0.0f) { return; } switch (target.GetUnitType()) { case UNIT_TYPE.PLAYER: { if (GetUnitType() != UNIT_TYPE.BULLET_ENEMY) { return; } } break; case UNIT_TYPE.ENEMY: { if (GetUnitType() != UNIT_TYPE.BULLET_PLAYER) { return; } } break; default: return; } //대상에게 데미지 주기 target.SetDamage(GetDamage()); if ((Random.value * 100.0f) <= mKnockbackRate) { target.SetKnockback(GetPos(), mKnockbackForce, mKnockbackTime); } mDamageSkipTime = 0.3f; EnableCollider(false); SetStatus(UNIT_STATUS.US_MOVE); Vector3 pos = GetPos(); CGameManager.GetInstance().CreateEffect(pos.x, pos.y); if (mPenetrationRate < (Random.value * 100.0f)) { DestroyBullet(); return; } mPenetrationRate -= 40.0f; }
public void OnUnitDestroyed(CUnit unit) { switch (unit.GetUnitType()) { case UNIT_TYPE.PLAYER: case UNIT_TYPE.ENEMY: mExitButton.SetActive(true); break; } }
//unit의 적에 해당하는 캐릭터 얻기 public CUnit GetEnemy(CUnit unit) { switch (unit.GetUnitType()) { case UNIT_TYPE.PLAYER: case UNIT_TYPE.BULLET_PLAYER: return(GetEnemy()); case UNIT_TYPE.ENEMY: case UNIT_TYPE.BULLET_ENEMY: return(GetPlayer()); } return(null); }
public void OnUnitCreated(CUnit unit) { switch (unit.GetUnitType()) { case UNIT_TYPE.PLAYER: { OnPlayerCreated(unit); } break; case UNIT_TYPE.ENEMY: { OnEnemyCreated(unit); } break; } }
public void OnUnitCreated(CUnit unit) { GameObject prefabBase = null; switch (unit.GetUnitType()) { case UNIT_TYPE.PLAYER: prefabBase = mPlayerPrefab; break; default: prefabBase = mEnemyPrefab; break; } GameObject obj = Instantiate(prefabBase); CMinimapUnit minimapUnit = obj.GetComponent <CMinimapUnit>(); minimapUnit.Init(unit, mTransform); }