private void SwapColor() { if (Input.GetButtonDown("SwapColor")) { colorController.SwapColor(); if (colorController.GetColor() == 1) { this.GetComponent <SpriteRenderer>().color = new Color(0.4f, 0.4f, 1f, 1f); } else { this.GetComponent <SpriteRenderer>().color = new Color(1f, 0.4f, 0.4f, 1f); } } }