Пример #1
0
 public void SetSlot(SlotComponent slot)
 {
     if (current != null)
     {
         current.Clear();
     }
     current = slot;
 }
Пример #2
0
    public void OnErase(SlotComponent slot)
    {
        BoxComponent box = slot.box;

        slot.Clear();
        boxCount--;
        boxes.Remove(box.id);
        GameObject.DestroyImmediate(box.gameObject);
//		AudioPlayerComponent.Play ("fx_combo");
//		EffectComponent.Show (effectBang [0], slot.transform.position);
        blocked = false;
    }
Пример #3
0
    public void OnMerge(SlotComponent slot)
    {
        BoxComponent box1 = slot.box;
        BoxComponent box2 = slot.target;

        int level = box1.level + 1;

        if (level >= boxPrefabs.Length)
        {
            Debug.LogError("biggest box can't merge");
            return;
        }

        slot.Clear();
        boxCount -= 2;
        boxes.Remove(box1.id);
        boxes.Remove(box2.id);
        GameObject.DestroyImmediate(box1.gameObject);
        GameObject.DestroyImmediate(box2.gameObject);
        New(level, slot);
        // insert score increament
        bool isWin = AppendScore(level);

//		Vector3 pos = slot.transform.position;

        // insert effect 'bang'
//		EffectComponent.Show (effectBang [level], pos);

        // insert coin increment
//		if (EffectComponent.Show (effectCoin [level], pos) != null) {
//			AudioPlayerComponent.Play ("fx_coin");
//			game.AppendCoin();
//		}

        // insert effect 'combo'
//		if (EffectComponent.Show (effectCombo [(Mathf.Min(combo, effectCombo.Length-1))], pos) != null) {
//			AudioPlayerComponent.Play ("fx_combo");
//		}

        if (isWin)
        {
            Victory();
            blocked = true;
        }
        else
        {
            OnMoved(slot);
        }
    }