// Use this for initialization
 void Start()
 {
     storage        = GameObject.Find("SelectionStorage");
     charstorage    = storage.GetComponent <CharacterSelectStorage>();
     imagecomponent = GetComponent <Image>();
 }
Beispiel #2
0
    void Start()
    {
        charactersavehealth = GameObject.Find("CharacterHealthsaver");
        healthscript        = charactersavehealth.GetComponent <CharacterSavedHealth>();

        unit      = GameObject.Find("Round Counter");
        uscript   = unit.GetComponent <RoundCounter>();
        roundswon = uscript.rounds;


        loadClasses();

        storage     = GameObject.Find("SelectionStorage");
        charstorage = storage.GetComponent <CharacterSelectStorage>();

        dead       = false;
        selected   = false;
        maxHealth  = Classes[ClassInt].healthMax;
        health     = Classes[ClassInt].healthMax;
        armor      = Classes[ClassInt].armor;
        minD       = Classes[ClassInt].minDamage;
        maxD       = Classes[ClassInt].maxDamage;
        critChance = Classes[ClassInt].crit;
        speed      = Random.Range(0, 4);
        if (Ally)
        {
            GameObject.Find(this.name + "Canvas").transform.SetPositionAndRotation(new Vector3(83, 1000, 0), Quaternion.identity);
        }

        for (int i = 1; i < 5; i++)
        {
            if (this.name == "Ally#" + i)
            {
                positionInt = i;
                this.tag    = "Ally" + i;
            }
            else if (this.name == "Enemy#" + i)
            {
                positionInt = i;
                this.tag    = "Enemy" + i;
            }
        }

        if (this.tag == "Ally1")
        {
            if (charstorage.StorageList[0] == 1)
            {
                ClassInt = 0;
            }
            if (charstorage.StorageList[0] == 2)
            {
                ClassInt = 1;
            }
            if (charstorage.StorageList[0] == 3)
            {
                ClassInt = 2;
            }
            if (charstorage.StorageList[0] == 4)
            {
                ClassInt = 3;
            }
        }

        if (this.tag == "Ally2")
        {
            if (charstorage.StorageList[1] == 1)
            {
                ClassInt = 0;
            }
            if (charstorage.StorageList[1] == 2)
            {
                ClassInt = 1;
            }
            if (charstorage.StorageList[1] == 3)
            {
                ClassInt = 2;
            }
            if (charstorage.StorageList[1] == 4)
            {
                ClassInt = 3;
            }
        }

        if (this.tag == "Ally3")
        {
            if (charstorage.StorageList[2] == 1)
            {
                ClassInt = 0;
            }
            if (charstorage.StorageList[2] == 2)
            {
                ClassInt = 1;
            }
            if (charstorage.StorageList[2] == 3)
            {
                ClassInt = 2;
            }
            if (charstorage.StorageList[2] == 4)
            {
                ClassInt = 3;
            }
        }

        if (this.tag == "Ally4")
        {
            if (charstorage.StorageList[3] == 1)
            {
                ClassInt = 0;
            }
            if (charstorage.StorageList[3] == 2)
            {
                ClassInt = 1;
            }
            if (charstorage.StorageList[3] == 3)
            {
                ClassInt = 2;
            }
            if (charstorage.StorageList[3] == 4)
            {
                ClassInt = 3;
            }
        }

        updateClass();

        if (roundswon > 0)
        {
            if (this.name == "Ally#1")
            {
                health = healthscript.character1health;
            }
            if (this.name == "Ally#2")
            {
                health = healthscript.character2health;
            }
            if (this.name == "Ally#3")
            {
                health = healthscript.character3health;
            }
            if (this.name == "Ally#4")
            {
                health = healthscript.character4health;
            }
        }
    }