コード例 #1
0
 private void OnTriggerEnter2D(Collider2D target)
 {
     if (target.CompareTag("Garbage"))
     {
         GarbageObstacle obstacle = target.gameObject.GetComponent <GarbageObstacle>();
         speed += obstacle.garbage.playerSpeedModificator;
     }
 }
コード例 #2
0
    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;
        }
    }