Пример #1
0
        //Initialization for a card and sets it's position to (1000, 1000, 1000)
        public void init(BattlePlayer player, int cardID, int diet, int level, int attack, int health, string species_name, string type, string description)
        {
            this.player             = player;
            this.cardID             = cardID;
            this.manaCost           = level;
            this.transform.position = new Vector3(player.DeckPos.x, player.DeckPos.y, player.DeckPos.z);
            canAttackNow            = true;
            velocity         = 0;
            terminalVelocity = 6000;
            distance         = 0;
            delayTimer       = 0;
            name             = species_name;
            this.diet        = getDietType(diet);
            this.dietNum     = diet;
            this.level       = level;
            maxHP            = hp = health;
            naturalDmg       = dmg = attack;
            //this.type = type; //hide temporarily
            //this.description = description; //hide temporarily

            Debug.Log("diet" + diet);
            //0-omnivore, 1-carnivore, 2-herbivore, 3-spell
            Texture2D cardTexture    = (Texture2D)Resources.Load("Images/Battle/cardfront" + (int)this.diet, typeof(Texture2D));
            Texture2D speciesTexture = (Texture2D)Resources.Load("Images/" + this.name, typeof(Texture2D));

            //Changing cardfront texture
            GetComponent <Renderer>().material.mainTexture = cardTexture;
            transform.Find("CardArt").GetComponent <MeshRenderer> ().material.mainTexture = speciesTexture;

            //Changing card text
//		Color gold = new Color (209f, 234f, 50f, 255f);
            transform.Find("NameText").GetComponent <TextMesh> ().text = TextWrap(this.name, 16);
            transform.Find("TypeText").GetComponent <TextMesh> ().text = this.type;
            transform.Find("TypeText").GetComponent <MeshRenderer> ().material.color        = Color.white;
            transform.Find("DescriptionText").GetComponent <TextMesh> ().text               = TextWrap(this.description, 26);
            transform.Find("DescriptionText").GetComponent <MeshRenderer> ().material.color = Color.white;
            transform.Find("LevelText").GetComponent <TextMesh> ().text = "" + this.level;
            transform.Find("LevelText").GetComponent <MeshRenderer> ().material.color = Color.white;
            transform.Find("DoneText").GetComponent <MeshRenderer> ().material.color  = Color.red;
            transform.Find("DamageText").GetComponent <TextMesh> ().text = "";
            transform.Find("DamageText").GetComponent <MeshRenderer> ().material.color = Color.red;

            //Initializes off screen
            transform.position = new Vector3(1000, 1000, 1000);

            //rotate facedown if player 2
            if (!player.player1 && !Constants.SINGLE_PLAYER)
            {
                transform.rotation = new Quaternion(180, 0, 0, 0);
            }
        }
Пример #2
0
        //Initialization for a card and sets it's position to (1000, 1000, 1000)
        public void init(BattlePlayer player, int cardID, int diet, int level, int attack, int health, string species_name, string type, string description)
        {
            this.player = player;
            this.cardID = cardID;
            this.manaCost = level;
            this.transform.position = new Vector3 (player.DeckPos.x, player.DeckPos.y, player.DeckPos.z);
            canAttackNow = true;
            velocity = 0;
            terminalVelocity = 6000;
            distance = 0;
            delayTimer = 0;
            name = species_name;
            this.diet = getDietType (diet);
            this.dietNum = diet;
            this.level = level;
            maxHP = hp = health;
            naturalDmg = dmg = attack;
            //this.type = type; //hide temporarily
            //this.description = description; //hide temporarily

            Debug.Log ("diet" + diet);
            //0-omnivore, 1-carnivore, 2-herbivore, 3-spell
            Texture2D cardTexture = (Texture2D)Resources.Load ("Images/Battle/cardfront" + (int)this.diet, typeof(Texture2D));
            Texture2D speciesTexture = (Texture2D)Resources.Load ("Images/" + this.name, typeof(Texture2D));

            //Changing cardfront texture
            renderer.material.mainTexture = cardTexture;
            transform.Find ("CardArt").GetComponent<MeshRenderer> ().material.mainTexture = speciesTexture;

            //Changing card text
            //		Color gold = new Color (209f, 234f, 50f, 255f);
            transform.Find ("NameText").GetComponent<TextMesh> ().text = TextWrap (this.name, 16);
            transform.Find ("TypeText").GetComponent<TextMesh> ().text = this.type;
            transform.Find ("TypeText").GetComponent<MeshRenderer> ().material.color = Color.white;
            transform.Find ("DescriptionText").GetComponent<TextMesh> ().text = TextWrap (this.description, 26);
            transform.Find ("DescriptionText").GetComponent<MeshRenderer> ().material.color = Color.white;
            transform.Find ("LevelText").GetComponent<TextMesh> ().text = "" + this.level;
            transform.Find ("LevelText").GetComponent<MeshRenderer> ().material.color = Color.white;
            transform.Find ("DoneText").GetComponent<MeshRenderer> ().material.color = Color.red;
            transform.Find ("DamageText").GetComponent<TextMesh> ().text = "";
            transform.Find ("DamageText").GetComponent<MeshRenderer> ().material.color = Color.red;

            //Initializes off screen
            transform.position = new Vector3 (1000, 1000, 1000);

            //rotate facedown if player 2
            if (!player.player1 && !Constants.SINGLE_PLAYER) {
                transform.rotation = new Quaternion (180, 0, 0, 0);
            }
        }