コード例 #1
0
 private void TurnOn()
 {
     isPressed = true;
     spawner.SetDefender(defenderPrefab);
     GetComponent <SpriteRenderer>().color = originalColor;
     costText.color = originalColor;
 }
コード例 #2
0
 private void OnMouseDown()
 {
     foreach (DefenderButton button in FindObjectsOfType <DefenderButton>())
     {
         button.GetComponent <SpriteRenderer>().color = Color.black;
     }
     GetComponent <SpriteRenderer>().color = Color.white;
     defenderSpawner.SetDefender(defenderPrefab);
 }
コード例 #3
0
    private void SetNewDefender()
    {
        DefenderSpawner spawner = FindObjectOfType <DefenderSpawner>();

        if (spawner && defenderObject)
        {
            spawner.SetDefender(defenderObject, defenderCost);
        }
    }
コード例 #4
0
    void OnMouseDown()
    {
        var buttons = FindObjectsOfType <DefenderButton>();

        foreach (DefenderButton button in buttons)
        {
            button.GetComponent <SpriteRenderer>().color = new Color32(40, 40, 40, 255);
        }

        gameObject.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1);
        spawner.SetDefender(myDefender);
    }
コード例 #5
0
 private void SetDefender()
 {
     defenderSpawner.SetDefender(defenderPrefab);
 }