private void OnPlayed() { if (!AssertState(State.Playing)) { return; } if (cardModel.prototype.inLanePrefab != null) { GameObject laneObject = GameObject.Instantiate(cardModel.prototype.inLanePrefab); laneObject.transform.position = currSlot.transform.position; CardInLane card = laneObject.GetComponent <CardInLane>(); card.SetOwner(owner); card.SetCardModel(cardModel); card.SetSlot(currSlot); card.cardType = cardType; //TODO should probably be in CardPrototype SpellInLane spell = laneObject.GetComponent <SpellInLane>(); if (spell != null) { spell.SetOwner(owner); spell.SetCardModel(cardModel); spell.SetSlot(currSlot); } currSlot.Occupy(laneObject); //TODO sound effects or whatever (maybe configed on card prototype) } else { currSlot.Release(); currSlot = null; } Destroy(gameObject); }