Exemplo n.º 1
0
    public void BuildHouse(WeaponController.Weapons w)
    {
        if (!isHouseBuild)
        {
            GameObject panel = GameObject.Find("TopPanel");
            panel.GetComponent <ScoreController>().buildingBuilt();

            GameObject.Find("winManager").GetComponent <win_check>().winCount++;
            print(GameObject.Find("winManager").GetComponent <win_check>().winCount);

            if (GameObject.Find("winManager").GetComponent <win_check>().winCount == 5)
            {
                GameObject.Find("winManager").GetComponent <win_check>().GameWin();
            }
        }
        isHouseBuild         = true;
        sr.enabled           = true;
        weaponSprite.enabled = true;

        // set weapon if this is the highest tier house built
        int maxLev = hs.findHighestHouseLevelByWepType(w);

        if (maxLev < Level)
        {
            wc.setWeaponLevel(w, Level);
        }



        SetWeapon(w);
    }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     weapon = WeaponController.Weapons.BFG;
     hs     = GameObject.Find("HouseSystem").GetComponent <HouseSystem>();
     sr     = GetComponentInChildren <SpriteRenderer>();
     wc     = GameObject.Find("Player").GetComponent <WeaponController>();
     DestroyHouse();
     //BuildHouse();
 }
Exemplo n.º 3
0
 void BuildHouse(WeaponController.Weapons w)
 {
     if (goldc.canBuy(price))
     {
         goldc.spendGold(price);
         hs.BuildCurrentHouse(w);
     }
     else
     {
         ShowTooExpensive();
     }
 }
Exemplo n.º 4
0
    public int findHighestHouseLevelByWepType(WeaponController.Weapons weptype)
    {
        int highestLevel = -1;

        foreach (House h in houseList)
        {
            if (h.weapon == weptype && h.Level > highestLevel)
            {
                highestLevel = h.Level;
            }
        }
        return(highestLevel);
    }
Exemplo n.º 5
0
    void SetWeapon(WeaponController.Weapons w)
    {
        weapon = w;

        if (w == WeaponController.Weapons.Sword)
        {
            weaponSprite.sprite = hs.buildings_weaponsSword;
        }
        else if (w == WeaponController.Weapons.Pistol)
        {
            weaponSprite.sprite = hs.buildings_weaponsPistol;
        }
        else if (w == WeaponController.Weapons.Shotgun)
        {
            weaponSprite.sprite = hs.buildings_weaponsShotgun;
        }
    }
Exemplo n.º 6
0
    public void DestroyHouse()
    {
        isHouseBuild         = false;
        sr.enabled           = false;
        weaponSprite.enabled = false;

        GameObject.Find("winManager").GetComponent <win_check>().winCount--;
        print(GameObject.Find("winManager").GetComponent <win_check>().winCount);

        WeaponController.Weapons oldType = weapon;
        weapon = WeaponController.Weapons.Staff;
        // TODO: find highest weapon tier house and asssign it to WeaponController
        int maxLev = hs.findHighestHouseLevelByWepType(oldType);

        if (maxLev == -1)
        {
            wc.setWeaponLevel(oldType, oldType == WeaponController.Weapons.Staff ? 1 : 0); //staff cannot have level lower than 1
        }
        else
        {
            wc.setWeaponLevel(oldType, maxLev);
        }
    }
Exemplo n.º 7
0
 public void BuildCurrentHouse(WeaponController.Weapons w)
 {
     currentHouse.BuildHouse(w);
 }