Exemplo n.º 1
0
        public CardInfo GetCardInfo(string cardName)
        {
            var cardInfo = new CardInfo();

            cardInfo.CardReference = GameObject.Find(cardName);
            if (!cardInfo.CardReference)
            {
                Debug.Log("Could not find CardInfo in library");
            }
            cardInfo.CardArt            = cardInfo.CardReference.transform.GetChild(1).gameObject.GetComponent <Image>().sprite;
            cardInfo.CardName           = cardInfo.CardReference.transform.GetChild(3).GetChild(0).gameObject.GetComponent <TextMeshProUGUI>().text;
            cardInfo.CardType           = cardInfo.CardReference.transform.GetChild(3).GetChild(1).gameObject.GetComponent <TextMeshProUGUI>().text;
            cardInfo.DescriptionHeader  = cardInfo.CardReference.transform.GetChild(4).GetChild(0).gameObject.GetComponent <TextMeshProUGUI>().text;
            cardInfo.DescriptionContent = cardInfo.CardReference.transform.GetChild(4).GetChild(1).gameObject.GetComponent <TextMeshProUGUI>().text;
            cardInfo.FlavorText         = cardInfo.CardReference.transform.GetChild(4).GetChild(2).gameObject.GetComponent <TextMeshProUGUI>().text;
            cardInfo.CardLevel          = int.Parse(cardInfo.CardReference.transform.GetChild(5).gameObject.GetComponent <TextMeshProUGUI>().text);
            cardInfo.CardPower          = int.Parse(cardInfo.CardReference.transform.GetChild(6).gameObject.GetComponent <TextMeshProUGUI>().text);
            cardInfo.CardStrength       = int.Parse(cardInfo.CardReference.transform.GetChild(7).gameObject.GetComponent <TextMeshProUGUI>().text);
            cardInfo.ManaCost           = int.Parse(cardInfo.CardReference.transform.GetChild(8).GetChild(0).gameObject.GetComponent <TextMeshProUGUI>().text);
            cardInfo.EnergyCost         = int.Parse(cardInfo.CardReference.transform.GetChild(8).GetChild(1).gameObject.GetComponent <TextMeshProUGUI>().text);
            cardInfo.MatterCost         = int.Parse(cardInfo.CardReference.transform.GetChild(8).GetChild(2).gameObject.GetComponent <TextMeshProUGUI>().text);
            cardInfo.PlaySound          = cardInfo.CardReference.transform.GetChild(9).gameObject.GetComponent <AudioSource>();
            return(cardInfo);
        }
Exemplo n.º 2
0
 void getCardInfo()
 {
     this.cardinfo = this.gameController.GetCardInfo(this.cardType);
 }
Exemplo n.º 3
0
 void rtnInstHealInfo()
 {
     this.cardinfo = this.gameController.GetCardInfo("Card_InstantHeal");
 }
Exemplo n.º 4
0
 void rtnFireballInfo()
 {
     this.FireballPrefab = prefab;
     // Instantiate each piece of information about the card. ~Liam
     this.cardinfo = this.gameController.GetCardInfo("Card_Fireball");
 }
        // Inputs for the game.
        void ProcessInput()
        {
            // Input should only be recognized if the player has not died. ~Liam
            if (!this.IsGameOver)
            {
                // Basic input code for casting cards. ~Jackson
                if (Input.GetButtonDown("PlayCard1"))
                {
                    this.PlayerInventory.PlayCard1();
                }

                if (Input.GetButtonDown("PlayCard2"))
                {
                    this.PlayerInventory.PlayCard2();
                }

                if (Input.GetButtonDown("PlayCard3"))
                {
                    this.PlayerInventory.PlayCard3();
                }

                // Code for drawing a card from the deck. ~Liam
                if (Input.GetButtonDown("Fire2"))
                {
                    // Only draw a card if there is not currently a cooldown. ~Liam
                    if (this.DrawCardCoolDown == 0)
                    {
                        // Set the draw cooldown if a card was drawn. ~Liam
                        if (this.PlayerInventory.DrawCard())
                        {
                            // Play audio for drawing a card. ~Liam
                            this.DrawCardSound.GetComponent <AudioSource>().Play();

                            this.DrawCardCoolDown = this.DRAW_CARD_COOL_DOWN_BASE;
                        }
                        else if (!this.PlayerInventory.GetDrawError())
                        {
                            // Play audio for replacing the deck. ~Liam
                            this.ReplaceDiscardSound.GetComponent <AudioSource>().Play();
                        }
                    }
                    else
                    {
                        this.DrawErrorMessageDuration = PLAYER_ERROR_MESSAGE_DURATION;
                        this.SetDrawErrorText(true);
                        this.PlayerInventory.SetDrawError(false);
                    }
                }

                if (Input.GetButtonDown("Jump"))
                {
                    var camera           = GameObject.Find("Main Camera");
                    var cameraController = camera.GetComponent <CameraController>();
                    cameraController.ToggleCameraControl();
                }

                // Code for examining a card in the player's UI, or the market. ~Liam
                if (Input.GetButtonDown("ExamineCard"))
                {
                    CardInfo tempCInfo = new CardInfo();

                    // Check what card the player is hovering over. ~Liam
                    if (GameObject.Find("Card1").GetComponent <ExamineDisplay>().IsPointerHovering())
                    {
                        if (this.PlayerInventory.GetCardSlot1Info(ref tempCInfo))
                        {
                            this.RenderExamineCard(tempCInfo);
                        }
                    }
                    else if (GameObject.Find("Card2").GetComponent <ExamineDisplay>().IsPointerHovering())
                    {
                        if (this.PlayerInventory.GetCardSlot2Info(ref tempCInfo))
                        {
                            this.RenderExamineCard(tempCInfo);
                        }
                    }
                    else if (GameObject.Find("Card3").GetComponent <ExamineDisplay>().IsPointerHovering())
                    {
                        if (this.PlayerInventory.GetCardSlot3Info(ref tempCInfo))
                        {
                            this.RenderExamineCard(tempCInfo);
                        }
                    }
                    else if (GameObject.Find("DiscardPile").GetComponent <ExamineDisplay>().IsPointerHovering())
                    {
                        if (this.PlayerInventory.GetDiscardSlotImageInfo(ref tempCInfo))
                        {
                            this.RenderExamineCard(tempCInfo);
                        }
                    }
                    // If the player mouse is not over any UI object, check if they are over any market. ~Liam
                    else
                    {
                        for (int i = 0; i < this.MarketList.Length; i++)
                        {
                            if (this.MarketList[i].GetComponent <MarketController>().IsPointerHovering())
                            {
                                this.RenderExamineCard(this.MarketList[i].GetComponent <MarketController>().GetMarketCardInfo());
                                break;
                            }
                        }
                    }
                }

                if (Input.GetButtonUp("ExamineCard"))
                {
                    // Set the high quality card image to inactive when the player releases the key. ~Liam
                    this.ExamineCardImage.SetActive(false);
                }


                // Movement using WASD Keys.
                // Movement is implemented in this file to allow for simultaneous horizontal and vertical movment
                // instead of separate horizontal or vertical movement in individual movement scripts.
                Vector2 movement = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));

                // Jackson's ADSR code handles the speed modifiers. ~Jackson
                this.HorizontalADSR.Update(movement.x, Time.fixedDeltaTime, this.VerticalADSR.IsSustaining());
                this.VerticalADSR.Update(movement.y, Time.fixedDeltaTime, this.HorizontalADSR.IsSustaining());


                var rigidBody = gameObject.GetComponent <Rigidbody2D>();
                rigidBody.MovePosition(rigidBody.position + this.GetPlayerSpeed() * Time.fixedDeltaTime);
            }
        }