IEnumerator TeleportChipRoutine(Card chip, Slot target) { if (!chip.parentSlot) { yield break; } if (chip.destroying) { yield break; } if (target.GetChip() || !target.gravity) { yield break; } Vector3 scale_target = Vector3.zero; chip.can_move = false; target.SetChip(chip); scale_target.z = 1; while (chip != null && chip.transform.localScale.x > 0) { chip.transform.localScale = Vector3.MoveTowards(chip.transform.localScale, scale_target, Time.deltaTime * 8); yield return(0); } chip.transform.localPosition = Vector3.zero; scale_target.x = 1; scale_target.y = 1; while (chip != null && chip.transform.localScale.x < 1) { chip.transform.localScale = Vector3.MoveTowards(chip.transform.localScale, scale_target, Time.deltaTime * 12); yield return(0); } if (chip != null) { chip.can_move = true; } //Chip new_chip = Instantiate(chip.gameObject).GetComponent<Chip>(); //new_chip.parentSlot = null; //new_chip.transform.position = target.transform.position; //target.SetChip(new_chip); //chip.HideChip(false); }
public Card GetNewStone(int x, int y, Vector3 position) { //ContentAssistant.main.GetItem ("Stone"); // GameObject o = ResourceMgr.Instance.LoadAndInstanceGameObjectFromPreload("Stone"); // o.transform.position = position; // o.name = "Stone"; // Slot slot = SlotManager.Instance.FindSlot(x, y); // Chip chipForSlot = slot.GetChip(); // if (chipForSlot != null) // o.transform.position = chipForSlot.transform.position; // // Chip chip = o.GetComponent<Chip> (); // slot.SetChip(chip); // return chip; Card card = CardManager.Instance.GetOneSimpleCard(-1); slot.SetChip(card); card.transform.position = position; // card.transform.SetParent(slot.transform); return(card); }
// Creating a simple chip specified color public Card GetNewSimpleChip(int x, int y, Vector3 position, int id) { //ContentAssistant.main.GetItem("SimpleChip" + Chip.chipTypes[id]); // GameObject o = ResourceMgr.Instance.LoadAndInstanceGameObjectFromPreload("SimpleCard" + Card.chipTypes[id]); // o.transform.position = position; // o.name = "Card_" + Card.chipTypes[id]; // // DebugUtil.Debug(FightControl.Instance.EFightStatus + ",{" + x + "x" + y + "}"); Slot slot = SlotManager.Instance.FindSlot(x, y); // Card chipForSlot = slot.Card; // if (chipForSlot != null) // o.transform.position = chipForSlot.transform.position; // // Chip chip = o.GetComponent<Chip> (); // // Card card = CardManager.Instance.GetOneSimpleCard(id); slot.SetChip(card); //card.transform.SetParent(slot.transform,false); // DebugUtil.Debug("aa"); return(card); }