Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        int  i = 0;
        Navi n = navi.GetComponent <Navi>();

        while (i < held)
        {
            BattleChip bc = chips[i].GetComponent <BattleChip>();
            if ((bc.color_code == n.combo_color))                                          // chip in combo
            {
                if ((n.combo_color != ChipData.WHITE) && (n.combo_color != ChipData.GREY)) // white and grey don't combo
                {
                    if (n.combo_level <= 2)
                    {
                        bc.cost = (bc.base_cost - 1 >= 0) ? bc.base_cost - 1 : 0; // no negative cost
                    }
                    else                                                          // after 3rd chip in combo, discount become 2
                    {
                        bc.cost = (bc.base_cost - 2 >= 0) ? bc.base_cost - 2 : 0; // no negative cost
                    }
                    bc.cost_icon.GetComponent <Outline>().enabled = true;
                }
            }
            else                // reset all non-combo-color chips back to base cost
            {
                bc.cost = bc.base_cost;
                bc.cost_icon.GetComponent <Outline>().enabled = false;
            }
            i++;
        }
    }
Beispiel #2
0
 // Use this for initialization
 void Start()
 {
     pos        = transform.position;
     tr         = transform;
     music      = GetComponent <AudioSource>();
     bg         = GameObject.FindGameObjectWithTag("BattleArea").GetComponent <BattleGrid>();
     shoot      = Resources.Load("Music/shoot1") as AudioClip;
     damage     = Resources.Load("Music/Hit1") as AudioClip;
     battleChip = GetComponent <BattleChip>();
 }