Example #1
0
 private void OnTriggerEnter2D(Collider2D col)
 {
     if (col.tag == "Player")
     {
         GameObject     player = col.gameObject;
         SpriteRenderer playerSpriteRenderer = player.GetComponent <SpriteRenderer>();
         if (color == colorManager.white)
         {
             playerSpriteRenderer.color = colorManager.white;
         }
         else
         {
             playerSpriteRenderer.color = colorManager.CombineColors(playerSpriteRenderer.color, color);
         }
         Destroy(gameObject);
     }
 }
    private IEnumerator PullPlayer()
    {
        player.canControlMovement = false;
        isPullingPlayer           = true;
        yield return(new WaitForSeconds(pullPlayerTime));

        if (player.spriteRenderer.color == color)
        {
            FreeThePlayer();
            yield break;
        }
        else if (isResetTrigger)
        {
            player.GetComponent <SpriteRenderer>().color = Color.white;
        }
        else
        {
            player.GetComponent <SpriteRenderer>().color = colorManager.CombineColors(player.spriteRenderer.color, color);
        }
        Deactivate();
    }