private void OnTriggerEnter2D(Collider2D target) { if (target.CompareTag("Garbage")) { GarbageObstacle obstacle = target.gameObject.GetComponent <GarbageObstacle>(); speed += obstacle.garbage.playerSpeedModificator; } }
private void OnTriggerEnter2D(Collider2D target) { if (target.CompareTag("Player") && playerMovement.isAbleToMove()) { moveSpot = this.getRandomMovePosition(); waitingTimeCountdown = spotWaitTime; } if (target.CompareTag("Garbage")) { GarbageObstacle obstacle = target.gameObject.GetComponent <GarbageObstacle>(); speed += obstacle.garbage.crabSpeedModificator; } }