public void cutPacks() { if (inScaling || inBoosterMove || notInZone) { return; } if (currentPack == 0 && deck.bankAmount < 10 || currentPack == 1 && deck.bankAmount < 8 || currentPack == 2 && deck.bankAmount < 11) { return; } deck = GameObject.Find("Deck").GetComponent <DeckScript>(); mousePos = Input.mousePosition; mousePos.z = startPositionPack.z; Vector3 currentMousePosition = Camera.main.ScreenToWorldPoint(mousePos); if (Input.GetMouseButton(0)) { if (!mousePressed) { mouseStartPosition = currentMousePosition; } Debug.DrawLine(mouseStartPosition, currentMousePosition, Color.red); mousePressed = true; } else if (mousePressed) { SpriteSlicer2D.SliceAllSprites(mouseStartPosition, currentMousePosition, false, ref cuts); mousePressed = false; } }
public void ManualStart(DeckScript incomingDeckReference) { deckScript = incomingDeckReference; //ActiveSquareBehaviour[] hitSquares; spriteRenderer = gameObject.GetComponent <SpriteRenderer> (); active = true; //cardInPlayArea = false; clickedOn = false; hitSquareOverflow = 0; //GameObject loaderScriptTemp = GameObject.FindWithTag("MainLoader"); // GameObject deckControllerObjectTemp = GameObject.FindWithTag ("DeckController"); // if (deckControllerObjectTemp != null) { // deckScript = deckControllerObjectTemp.GetComponent<DeckScript> (); // } // if (deckControllerObjectTemp == null) { // Debug.Log ("Cannot find 'deckController'object"); // } GameObject gameControllerScriptTemp = GameObject.FindWithTag("GameController"); if (gameControllerScriptTemp != null) { gameController = gameControllerScriptTemp.GetComponent <GameControllerScript> (); } if (gameControllerScriptTemp == null) { Debug.Log("Cannot find 'GameController'object"); } }
// Use this for initialization void Start() { deck = GameObject.FindGameObjectWithTag("Deck").GetComponent <DeckScript>(); cardsObtained = deck.cardsObtained.ToArray(); currentCards = new GameObject[7]; cardStack_more = new Stack <int>(deck.cardsObtained); cardStack_less = new Stack <int>(); sendCards = string.Join(",", new List <int>(cardsObtained).ConvertAll(i => i.ToString()).ToArray()); initCardPositions(); initCardAngles(); layoutCards(cardStack_more.Count); inAnimation = false; speed = 0.75f; zoomed = false; showCards = GameObject.Find("ShowCards").GetComponent <ShowCards>(); showCards.DisableObject(); currentIndex = 0; receiveHolder.SetActive(false); acceptHolder.SetActive(false); waitHolder.SetActive(false); offer = false; receiveOffer = false; ignoreToggle = false; accept = false; receiveAccept = false; readyForCards = true; receiveZoomed = false; inTrade = false; }
// Use this for initialization void Start() { player = 1; List <Card> cardDeck1 = new List <Card>(); List <Card> cardDeck2 = new List <Card>(); List <Card> tableDeck = new List <Card>(); int numDecks = 1; while (numDecks <= 2) { for (int i = 0; i < CardDeck.getCardDeck().Length; i++) { cardDeck1.Add(CardDeck.getCardDeck()[i]); } numDecks++; } Debug.Log(cardDeck1.Count); CardDeck.Shuffle <Card>(cardDeck1); CardDeck.Shuffle <Card>(cardDeck1); while (cardDeck2.Count < 48) { cardDeck2.Add(cardDeck1[0]); cardDeck1.RemoveAt(0); } while (tableDeck.Count < 8) { tableDeck.Add(cardDeck1[0]); cardDeck1.RemoveAt(0); } Debug.Log(cardDeck1.Count + ", " + cardDeck2.Count + ", " + tableDeck.Count); DeckScript deckScript1 = GameObject.Find("P1 Deck").GetComponent <DeckScript>(); DeckScript deckScript2 = GameObject.Find("P2 Deck").GetComponent <DeckScript>(); for (int i = 1; i < 9; i++) { HouseScript houseScript; if (i < 5) { houseScript = GameObject.Find("LH" + i + " MainC").GetComponent <HouseScript>(); } else { houseScript = GameObject.Find("RH" + i + " MainC").GetComponent <HouseScript>(); } houseScript.addFirstCardToPile(tableDeck[i - 1]); houseScript.loadCard(); } deckScript1.setDeck(cardDeck1); deckScript2.setDeck(cardDeck2); }
[RPC] void SpawnDeck(NetworkViewID viewID, int id) { GameObject go = NetworkView.Find(viewID).gameObject; DeckScript ds = go.GetComponent <DeckScript>(); ds.playerID = id; TurnManager.instance.playerDecks[id] = ds; }
void Awake() { deckScript = GetComponent<DeckScript>(); deck = deckScript.BuildDeck(numDecks); initNumCards = numCards = deck.Count; handOne.handArea = handOneArea; handTwo.handArea = handTwoArea; dealerHand.handArea = dealerArea; }
// Use this for initialization void Start() { mute = false; deckHolder.SetActive(false); if (GameObject.Find("Deck") == null) { deckHolder.SetActive(true); } deck = GameObject.Find("Deck").GetComponent <DeckScript>(); boosterStartPosition = packholder.transform.position; current_volume = 0.25f; AudioListener.volume = current_volume; cards_up = 0; gameObject.tag = "Manager"; doneholder.GetComponent <DoneButton>().disableDone(); Vector3[] positions = new Vector3[cards.Length]; for (int i = 0; i < cards.Length; i++) { positions[i] = cards[i].GetComponent <MainCard>().transform.position; } foreach (GameObject card in cards) { card.GetComponent <MainCard>().initializePositions(positions); } disableAllCards(); newCardFlag = false; AudioListener.pause = false; booster = GameObject.FindGameObjectWithTag("Boosterpack"); startPositionPack = booster.transform.position; packText = GameObject.Find("CurrentPack"); inScaling = false; currentPack = 0; initBoosters(); disableAllBoosters(); enableBooster(); packText.GetComponent <Text>().text = "Current Pack: " + boosterpacks[currentPack].name; packButtons = GameObject.FindGameObjectsWithTag("Packselection"); inBoosterMove = false; cardsSelected = 0; inSelectionMove = false; notInZone = true; packs = GameObject.Find("Packs").GetComponent <Packs>(); bank = GameObject.Find("BankAmount").GetComponent <Text>(); SetBankText(deck.bankAmount); }
// Initialize the singleton instance. private void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { throw new System.ArgumentException("there should not already be an instance of this"); } }
public void ManualStart() { deckScript = gameObject.transform.parent.GetComponent <DeckScript> (); // deckScript = incomingDeckScript; // print ("done "+ incomingDeckScript.getControllerParentIdTag()); // GameObject deckBehaviourObject = GameObject.FindWithTag("DeckController"); //whole block is for grabbing the Deck object so it can deal a card when clicked // if(deckBehaviourObject != null){ // deckScript = deckBehaviourObject.GetComponent<DeckScript>(); // } // if(deckBehaviourObject == null){ // Debug.Log ("Cannot find 'DeckController'object"); // } //spriteRenderer = GetComponent<SpriteRenderer>(); }
public override void OnInspectorGUI() { DrawDefaultInspector(); DeckScript script = (DeckScript)target; if (GUILayout.Button("Draw")) { script.DrawCard(); } if (GUILayout.Button("Spawn")) { script.SpawnDeck(); } }
[RPC] void SpawnDeck(NetworkViewID viewID, int id, string deckDB) { GameObject go = NetworkView.Find(viewID).gameObject; DeckScript ds = go.GetComponent <DeckScript>(); ds.playerID = id; string[] separatedString = deckDB.Split(','); int[] newCards = new int[separatedString.Length]; for (int i = 0; i < separatedString.Length; i++) { newCards[i] = int.Parse(separatedString[i]); } ds.cards = newCards; TurnManager.instance.playerDecks[id] = ds; }
void ReadSimpleObjects() { if (File.Exists(saveFile)) { using (FileStream fs = File.OpenRead(saveFile)) { BinaryReader fileReader = new BinaryReader(fs); int simpleObjectCount = fileReader.ReadInt32(); for (int simpleCount = 0; simpleCount < simpleObjectCount; simpleCount++) { GameObject deckScript = new GameObject(); DeckScript simpleScript = deckScript.AddComponent <DeckScript>(); simpleScript.ReadObjectState(fileReader); } } } }
//private bool boolCardClickedOn; void Start() { GameObject loaderScriptTemp = GameObject.FindWithTag("MainLoader"); //whole block is for grabbing the Deck object so it can deal a card when clicked if (loaderScriptTemp == null) { SceneManager.LoadScene("XMLLoaderScene"); //Only happens if coroutine is finished // StartCoroutine (StartUpLoader()); return; } enemyController = gameObject.GetComponentInChildren <EnemyScript>(); playerController = gameObject.GetComponentInChildren <PlayerScript>(); enemyDeckController = enemyController.GetComponentInChildren <DeckScript>(); playerDeckController = playerController.GetComponentInChildren <DeckScript>(); // print ("and still"); //boolCardClickedOn = false; currentClickedOnCardWeaponMatrix = new CurrentWeaponHitBox(false, null, 0); shuffleDiscardsButton.onClick.AddListener(shuffleDiscard); // MakeSquaresButton.onClick.AddListener(makeActiveSquares); discardEverythingButton.onClick.AddListener(discardAllActiveShuffle); // makeBodyButton.onClick.AddListener(makeBody); // GameObject deckControllerObjectTemp = GameObject.FindWithTag("DeckController"); //whole block is for grabbing the Deck object so it can deal a card when clicked // if(deckControllerObjectTemp != null){ // deckController = deckControllerObjectTemp.GetComponent<DeckScript>(); // } // if(deckControllerObjectTemp == null){ // Debug.Log ("Cannot find 'deckController'object"); // } // GameObject playAreaControllerTemp = GameObject.FindWithTag("PlayAreaController"); // if(playAreaControllerTemp != null){ // playAreaController = playAreaControllerTemp.GetComponent<PlayAreaScript>(); // } // if(playAreaControllerTemp == null){ // Debug.Log ("Cannot find 'DeckBehaviour'object"); // } // StartCoroutine (playAreaController.ManualStart ()); // print ("manual play area done"); StartCoroutine(enemyController.ManualStart()); // print ("manual enemy cont done"); // playAreaController.populateEnemyPlayAreaSquares (); // print ("enemy play area population started"); }
void trashCard() { GameScript gameScript = FindObjectOfType <Camera>().GetComponent <GameScript>(); trashDeck.Add(gameScript.getCardSelected()); if (gameScript.getCardSelObjName().Contains("Card")) { CardScript cardScript = GameObject.Find(gameScript.getCardSelObjName()).GetComponent <CardScript>(); if (gameScript.getCardSelObjName().Contains("1")) { DeckScript deckScript = GameObject.Find("P1 Deck").GetComponent <DeckScript>(); deckScript.removeCard(); } else if (gameScript.getCardSelObjName().Contains("2")) { DeckScript deckScript = GameObject.Find("P2 Deck").GetComponent <DeckScript>(); deckScript.removeCard(); } cardScript.setEnabled(false); cardScript.selectCard(); //To unselect it } else if (gameScript.getCardSelObjName().Contains("Trash")) { TrashScript trashScript = GameObject.Find(gameScript.getCardSelObjName()).GetComponent <TrashScript>(); trashScript.removeCard(); gameScript.setCardSelected(null); gameScript.setCardSelObjName(null); } else if (gameScript.getCardSelObjName().Contains("Main")) { HouseScript houseScript = GameObject.Find(gameScript.getCardSelObjName()).GetComponent <HouseScript>(); houseScript.removeCard(); gameScript.setCardSelected(null); gameScript.setCardSelObjName(null); } loadCard(); }
void Awake() { oldPos = this.transform.position; //grab playerHand's Handscript component playerDeckScript = playerDeck.GetComponent<DeckScript> (); hasSelected = false; setArt(); }
// Use this for initialization void Start() { playerHand = GameObject.Find("Background").GetComponent <PlayerHand>(); deck = GameObject.Find("cardDeck").GetComponent <DeckScript>(); rank = value; }
// Use this for initialization void Start() { deck = GameObject.Find("cardDeck").GetComponent <DeckScript>(); }
void Start() { deck = GetComponent <DeckScript> (); }
// Update is called once per frame void Update() { PlayerScript mainPlayerScript = GlobalScript.ourGlobalScript.myMainPlayerScript; //move cursor's card if(myCardScript) { myCardScript.transform.position = Camera.main.ScreenToWorldPoint(Cursor()); } //deck uninspection if(null != myDeckScript) { if(Input.GetMouseButtonUp(0)) { DeckScript deckScript = myDeckScript; myDeckScript = null; deckScript.myRotation.Animate(Quaternion.Euler(305.3767f, 93.77283f, 310.0072f), .2f); deckScript.mySize.Animate(deckScript.DeckSize(), .2f); } } //drag box when nothing selected else if (null == myUnitScript && null == myCardScript) { GlobalScript.ourGlobalScript.myMainPlayerScript.mySelectionScript.Selection(); } //move cursor's unit if (myUnitScript && myUnitScript.myOwner.owner == mainPlayerScript) { mainPlayerScript.mySelectionScript.myIsDragging = false; if(Input.GetMouseButton(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, myRayLength)) { if (hit.transform != myUnitScript.transform) { myUnitScript.myNavMeshAgent.destination = hit.point; } } } } if(Input.GetMouseButtonDown(0)) { if (DoubleClick()) { myLastDoubleClickTime = Time.time; if (Input.GetKey("left shift")) { mainPlayerScript.mySelectionScript.mySelectedUnits.UnionWith(myOnScreenOwnedUnitScripts); } else { mainPlayerScript.mySelectionScript.mySelectedUnits = new HashSet<UnitScript>(myOnScreenOwnedUnitScripts); } } myLastClickTime = Time.time; } }
// Use this for initialization void Start() { deck = deckObject.GetComponent <DeckScript>(); }
public void cutPacks() { if (inScaling || inBoosterMove || notInZone) { return; } if (currentPack == 0 && deck.bankAmount < 10 || currentPack == 1 && deck.bankAmount < 8 || currentPack == 2 && deck.bankAmount < 11) { return; } deck = GameObject.Find("Deck").GetComponent<DeckScript>(); mousePos = Input.mousePosition; mousePos.z = startPositionPack.z; Vector3 currentMousePosition = Camera.main.ScreenToWorldPoint(mousePos); if (Input.GetMouseButton(0)) { if (!mousePressed) { mouseStartPosition = currentMousePosition; } Debug.DrawLine(mouseStartPosition, currentMousePosition, Color.red); mousePressed = true; } else if (mousePressed) { SpriteSlicer2D.SliceAllSprites(mouseStartPosition, currentMousePosition, false, ref cuts); mousePressed = false; } }
// Use this for initialization void Start() { deck = deckObject.GetComponent <DeckScript>(); DoneSelectingButton.gameObject.SetActive(false); cards = new List <CardData>(); }
public void addToPile() { GameScript gameScript = FindObjectOfType <Camera>().GetComponent <GameScript>(); pile.Add(gameScript.getCardSelected()); if (pile.Count > 1) { GameObject newObj; GameObject createdObj; Transform parent = gameObject.transform.parent; if (gameObject.name.Contains("LH")) { newObj = Resources.Load <GameObject>("LPiledCard"); //parentName = "LHCanvas" + houseNum; createdObj = Instantiate(newObj, parent); createdObj.name = "LH" + houseNum + "C" + (pile.Count - 1); createdObj.transform.localPosition = new Vector3((pile.Count - 2) * -15.0f, 0.0f, 0.0f); } else //if (gameObject.name.Contains("RH")) { newObj = Resources.Load <GameObject>("RPiledCard"); createdObj = Instantiate(newObj, parent); createdObj.name = "RH" + houseNum + "C" + (pile.Count - 1); createdObj.transform.localPosition = new Vector3((pile.Count - 2) * 15.0f, 0.0f, 0.0f); } gameObject.transform.SetSiblingIndex(pile.Count - 1); PiledScript piledScript = createdObj.GetComponent <PiledScript>(); piledScript.setCard(pile[pile.Count - 2]); piledScript.loadCard(); } if (gameScript.getCardSelObjName().Contains("Card")) { CardScript cardScript = GameObject.Find(gameScript.getCardSelObjName()).GetComponent <CardScript>(); DeckScript deckScript = GameObject.Find("P" + gameScript.getPlayer() + " Deck").GetComponent <DeckScript>(); TrashScript trashScript = GameObject.Find("P" + gameScript.getPlayer() + " Trash").GetComponent <TrashScript>(); deckScript.removeCard(); cardScript.setEnabled(false); cardScript.selectCard(); //To unselect it if (trashScript.isEmpty() && deckScript.isEmpty()) { Instantiate(Resources.Load <GameObject>("Winner"), GameObject.Find("Canvas").transform); GameObject.Find("Winner").GetComponent <Text>().text = "Player " + gameScript.getPlayer() + " wins!!"; } } else if (gameScript.getCardSelObjName().Contains("Trash")) { TrashScript trashScript = GameObject.Find(gameScript.getCardSelObjName()).GetComponent <TrashScript>(); trashScript.removeCard(); gameScript.setCardSelected(null); gameScript.setCardSelObjName(null); DeckScript deckScript = GameObject.Find("P" + gameScript.getPlayer() + " Deck").GetComponent <DeckScript>(); if (trashScript.isEmpty() && deckScript.isEmpty()) { Instantiate(Resources.Load <GameObject>("Winner"), GameObject.Find("Canvas").transform); GameObject.Find("Winner(Clone)").GetComponent <Text>().text = "Player " + gameScript.getPlayer() + " wins!!"; } } else if (gameScript.getCardSelObjName().Contains("Main")) { HouseScript houseScript = GameObject.Find(gameScript.getCardSelObjName()).GetComponent <HouseScript>(); houseScript.removeCard(); gameScript.setCardSelected(null); gameScript.setCardSelObjName(null); } loadCard(); }
// Use this for initialization void Start() { mute = false; deckHolder.SetActive(false); if (GameObject.Find("Deck") == null) { deckHolder.SetActive(true); } deck = GameObject.Find("Deck").GetComponent<DeckScript>(); boosterStartPosition = packholder.transform.position; current_volume = 0.25f; AudioListener.volume = current_volume; cards_up = 0; gameObject.tag = "Manager"; doneholder.GetComponent<DoneButton>().disableDone(); Vector3[] positions = new Vector3[cards.Length]; for (int i = 0; i < cards.Length; i++) { positions[i] = cards[i].GetComponent<MainCard>().transform.position; } foreach (GameObject card in cards) { card.GetComponent<MainCard>().initializePositions(positions); } disableAllCards(); newCardFlag = false; AudioListener.pause = false; booster = GameObject.FindGameObjectWithTag("Boosterpack"); startPositionPack = booster.transform.position; packText = GameObject.Find("CurrentPack"); inScaling = false; currentPack = 0; initBoosters(); disableAllBoosters(); enableBooster(); packText.GetComponent<Text>().text = "Current Pack: " + boosterpacks[currentPack].name; packButtons = GameObject.FindGameObjectsWithTag("Packselection"); inBoosterMove = false; cardsSelected = 0; inSelectionMove = false; notInZone = true; packs = GameObject.Find("Packs").GetComponent<Packs>(); bank = GameObject.Find("BankAmount").GetComponent<Text>(); SetBankText(deck.bankAmount); }
// Update is called once per frame void Update() { PlayerScript mainPlayerScript = GlobalScript.ourGlobalScript.myMainPlayerScript; //move cursor's card if (myCardScript) { myCardScript.transform.position = Camera.main.ScreenToWorldPoint(Cursor()); } //deck uninspection if (null != myDeckScript) { if (Input.GetMouseButtonUp(0)) { DeckScript deckScript = myDeckScript; myDeckScript = null; deckScript.myRotation.Animate(Quaternion.Euler(305.3767f, 93.77283f, 310.0072f), .2f); deckScript.mySize.Animate(deckScript.DeckSize(), .2f); } } //drag box when nothing selected else if (null == myUnitScript && null == myCardScript) { GlobalScript.ourGlobalScript.myMainPlayerScript.mySelectionScript.Selection(); } //move cursor's unit if (myUnitScript && myUnitScript.myOwner.owner == mainPlayerScript) { mainPlayerScript.mySelectionScript.myIsDragging = false; if (Input.GetMouseButton(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, myRayLength)) { if (hit.transform != myUnitScript.transform) { myUnitScript.myNavMeshAgent.destination = hit.point; } } } } if (Input.GetMouseButtonDown(0)) { if (DoubleClick()) { myLastDoubleClickTime = Time.time; if (Input.GetKey("left shift")) { mainPlayerScript.mySelectionScript.mySelectedUnits.UnionWith(myOnScreenOwnedUnitScripts); } else { mainPlayerScript.mySelectionScript.mySelectedUnits = new HashSet <UnitScript>(myOnScreenOwnedUnitScripts); } } myLastClickTime = Time.time; } }
// Use this for initialization void Start() { deck = cardDeck.GetComponent <DeckScript>(); }
// Use this for initialization void Start() { deck = GameObject.FindGameObjectWithTag("Deck").GetComponent<DeckScript>(); cardsObtained = deck.cardsObtained.ToArray(); currentCards = new GameObject[7]; cardStack_more = new Stack<int>(deck.cardsObtained); cardStack_less = new Stack<int>(); sendCards = string.Join(",", new List<int>(cardsObtained).ConvertAll(i => i.ToString()).ToArray()); initCardPositions(); initCardAngles(); layoutCards(cardStack_more.Count); inAnimation = false; speed = 0.75f; zoomed = false; showCards = GameObject.Find("ShowCards").GetComponent<ShowCards>(); showCards.DisableObject(); currentIndex = 0; receiveHolder.SetActive(false); acceptHolder.SetActive(false); waitHolder.SetActive(false); offer = false; receiveOffer = false; ignoreToggle = false; accept = false; receiveAccept = false; readyForCards = true; receiveZoomed = false; inTrade = false; }