private void OnCollisionEnter(Collision collision) { if (collision.gameObject.CompareTag(TagsLayers.spawnPointTag)) { PlateSpawner ps = collision.gameObject.GetComponent <PlateSpawner>(); if (ps != null && ps.havePlate) { CarryPlate(ps); } } if (collision.gameObject.CompareTag(TagsLayers.tableTag)) { if (plates.Count != 0 && collision.gameObject.GetComponent <Table>() == SpawnsTables.currentDeliverTable) { powerHandler.updateScale(plates.Count); foreach (Transform t in plates) { Destroy(t.gameObject); } plates.Clear(); SpawnsTables.changeDeliverTable(); } } if (collision.gameObject.CompareTag(TagsLayers.enemyTag)) { Interactor.handleInteraction(this, collision.gameObject.GetComponent <EnemyController>()); } }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.CompareTag(TagsLayers.spawnPointTag)) { navAgent.ResetPath(); if (enemyState != ENEMYSTATE.Dodged) { carryPlate(collision.gameObject.GetComponent <PlateSpawner>()); } } if (collision.gameObject.CompareTag(TagsLayers.tableTag)) { navAgent.ResetPath(); targetType = TargetType.None; currentPlate = null; currentPC = null; currentEC = null; if (enemyState != ENEMYSTATE.Dodged && plates.Count != 0 && collision.gameObject.GetComponent <Table>() == SpawnsTables.currentDeliverTable) { powerHandler.updateScale(plates.Count); foreach (Transform t in plates) { Destroy(t.gameObject); } plates.Clear(); SpawnsTables.changeDeliverTable(); } } if (collision.gameObject.CompareTag(TagsLayers.playerTag)) { Interactor.handleInteraction(this, collision.gameObject.GetComponent <PlayerController>()); } if (collision.gameObject.CompareTag(TagsLayers.enemyTag)) { Interactor.handleInteraction(this, collision.gameObject.GetComponent <EnemyController>()); } }