Ejemplo n.º 1
0
 /// <summary>
 /// Set parameters for a camp.
 /// </summary>
 /// <param name="userId">User identification ID.</param>
 /// <param name="level">Building level.</param>
 public void SetToCamp(string userId, int level)
 {        //TODO Camp building comfirmation notification
     this.userId = userId;
     buildingId  = FindObjectOfType <Generator> ().GenerateId();
     type        = buildingType.camp;
     this.level  = level;
     if (level == 0)
     {
         health      = 20;
         maxSpace    = 5;
         timeToBuild = 0;
     }
     else if (level == 1)
     {
         health      = 120;
         maxSpace    = 10;
         timeToBuild = 10;
     }
     else if (level == 2)
     {
         health      = 200;
         maxSpace    = 14;
         timeToBuild = 20;
     }
     else if (level == 3)
     {
         health      = 250;
         maxSpace    = 17;
         timeToBuild = 30;
     }
     isSet = true;
 }
Ejemplo n.º 2
0
        public Building(BuildingRelation _relation, BuildingConfigurations config, Material mat, int materialID, float texWidth)
        {
            type     = buildingType.withholeInside;
            relation = _relation;

            id = relation.outerWall.id;

            buildingConfig          = config;
            buildingHeight          = getBuildingHeight(relation.tags);
            equalizedBuildingHeight = assingBuildingTopLevel(relation.outerWall);

            isClockwise = getWayOrientation(relation.outerWall);

            defaultMaterial     = mat;
            defaultMaterialID   = materialID;
            defaultTextureWidth = texWidth;
            facadeSkins         = new List <FacadeSkin>();

            building = new GameObject("building" + id);
            building.transform.position = new Vector3(0.0f, 0.0f, 0.0f);

            GOtransform = new Vector3(0, 0, 0);
            GOrotate    = new Vector3(0, 0, 0);
            GOscale     = new Vector3(1, 1, 1);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Sets parameters for a Lumbermill.
 /// </summary>
 /// <param name="userId">User identification ID.</param>
 /// <param name="level">Lumbermill level.</param>
 public void SetToLumbermill(string userId, int level)
 {
     this.userId = userId;
     buildingId  = FindObjectOfType <Generator> ().GenerateId();
     type        = buildingType.lumbermill;
     this.level  = level;
     if (level == 0)
     {
         health      = 10;
         maxSpace    = 0;
         timeToBuild = 0;
     }
     else if (level == 1)
     {
         health      = 40;
         maxSpace    = 1;
         timeToBuild = 10;
     }
     else if (level == 2)
     {
         health      = 40;
         maxSpace    = 2;
         timeToBuild = 20;
     }
     else if (level == 3)
     {
         health      = 40;
         maxSpace    = 3;
         timeToBuild = 30;
     }
     isSet = true;
 }
Ejemplo n.º 4
0
        public Building(Way _way, BuildingConfigurations config, Material mat, int materialID, float texWidth)
        {
            type = buildingType.standard;
            way  = _way;

            id = way.id;

            buildingConfig          = config;
            buildingHeight          = getBuildingHeight(way.tags);
            equalizedBuildingHeight = assingBuildingTopLevel(way);

            defaultMaterial     = mat;
            defaultMaterialID   = materialID;
            defaultTextureWidth = texWidth;
            facadeSkins         = new List <FacadeSkin>();

            isClockwise = getWayOrientation(way);

            building = new GameObject("building" + id);
            building.transform.position = new Vector3(0.0f, 0.0f, 0.0f);

            GOtransform = new Vector3(0, 0, 0);
            GOrotate    = new Vector3(0, 0, 0);
            GOscale     = new Vector3(1, 1, 1);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Sets parameters for a baracks.
 /// </summary>
 /// <param name="userId">User identification ID.</param>
 /// <param name="level">Baracks level.</param>
 public void SetToBaracks(string userId, int level)
 {
     this.userId = userId;
     buildingId  = FindObjectOfType <Generator> ().GenerateId();
     type        = buildingType.baracks;
     this.level  = level;
     if (level == 0)
     {
         health      = 20;
         maxSpace    = 0;
         timeToBuild = 0;
     }
     else if (level == 1)
     {
         health      = 60;
         maxSpace    = 200;
         timeToBuild = 10;
     }
     else if (level == 2)
     {
         health      = 70;
         maxSpace    = 300;
         timeToBuild = 20;
     }
     else if (level == 3)
     {
         health      = 80;
         maxSpace    = 400;
         timeToBuild = 30;
     }
     isSet = true;
 }
Ejemplo n.º 6
0
    void Update()
    {
        // TODO Ideally, this only needs to run once. The problem is, void Start() is before the parent's void Start(),
        // which means it won't the value it wants. If this can be solved, move this out of void Update().
        if (type == buildingType.blank) {
            type = GetComponentInParent<BuildingButtonBehavior>().getBuildingType();
        }

        comText.text = "Get " + buyAmount + "\n$" + data.getBuildingCostForNext(buyAmount, type);
    }
Ejemplo n.º 7
0
    // This function determines if the player can buy a certain amount of a building.
    public bool bIsItBuyable(int amount, buildingType type)
    {
        int index = BuildingTypeToIndex(type);

        if (numMoney >= buildings[index].getCostForNext(amount)) {
            return true;
        } else {
            return false;
        }
    }
Ejemplo n.º 8
0
 public void SetType(buildingType type)
 {
     this.type = type;
     switch (type)
     {
         case buildingType.건물1:
             names = "건물1";
             message = "건물1이라고 합니다.";
             variation = new Stat(1, 2, 3);
             time = 10;
             valid = true;
             break;
         case buildingType.건물2:
             names = "건물2";
             message = "건물2라고 합니다.";
             variation = new Stat(3, 2, 1);
             time = 20;
             valid = false;
             break;
     }
     gameObject.GetComponent<SpriteRenderer>().sprite = graphic[(int)type];
 }
Ejemplo n.º 9
0
    public void SetType(buildingType type)
    {
        this.type = type;
        switch (type)
        {
        case buildingType.건물1:
            names     = "건물1";
            message   = "건물1이라고 합니다.";
            variation = new Stat(1, 2, 3);
            time      = 10;
            valid     = true;
            break;

        case buildingType.건물2:
            names     = "건물2";
            message   = "건물2라고 합니다.";
            variation = new Stat(3, 2, 1);
            time      = 20;
            valid     = false;
            break;
        }
        gameObject.GetComponent <SpriteRenderer>().sprite = graphic[(int)type];
    }
Ejemplo n.º 10
0
    // This function returns the cash per hit of a given building
    public int getBuildingCashPerHit(buildingType type)
    {
        int index = BuildingTypeToIndex(type);

        return buildings[index].getCashPerHit();
    }
Ejemplo n.º 11
0
 public void Init(buildingType type)
 {
     SetType(type);
 }
Ejemplo n.º 12
0
 public Building(string namie, buildingLevel levelie, buildingType typeie)
 {
     buildName  = namie;
     buildLevel = levelie;
     buildType  = typeie;
 }
Ejemplo n.º 13
0
 public void Init(buildingType type)
 {
     SetType(type);
 }
Ejemplo n.º 14
0
        public Building(Way _way, BuildingConfigurations config, Material mat, int materialID, float texWidth)
        {
            type = buildingType.standard;
            way = _way;

            id = way.id;

            buildingConfig = config;
            buildingHeight = getBuildingHeight(way.tags);
            equalizedBuildingHeight = assingBuildingTopLevel(way);

            defaultMaterial = mat;
            defaultMaterialID = materialID;
            defaultTextureWidth = texWidth;
            facadeSkins = new List<FacadeSkin>();

            isClockwise = getWayOrientation(way);

            building = new GameObject("building" + id);
            building.transform.position = new Vector3(0.0f, 0.0f, 0.0f);

            GOtransform = new Vector3(0, 0, 0);
            GOrotate = new Vector3(0, 0, 0);
            GOscale = new Vector3(1, 1, 1);
        }
Ejemplo n.º 15
0
    // This function returns the name of a given building type.
    public double getBuildingTimeToHit(buildingType type)
    {
        int index = BuildingTypeToIndex(type);

        return buildings[index].getTimeToHit();
    }
Ejemplo n.º 16
0
    // This function increases the amount of buildings bought by a given amount (and a given type.
    public void IncrementBuilding(int amount, buildingType type)
    {
        int index = BuildingTypeToIndex(type);

        numMoney -= buildings[index].getCostForNext(amount);
        buildings[index].addToNum(amount);

        totalBuildings++;
    }
Ejemplo n.º 17
0
    public void MultiplyBuildingCPH(int amount, buildingType type)
    {
        int index = BuildingTypeToIndex(type);

        buildings[index].MultiplyCPH(amount);
    }
Ejemplo n.º 18
0
    // This function returns the name of a given building type.
    public string printBuildingName(buildingType type)
    {
        int index = BuildingTypeToIndex(type);

        return buildings[index].printName();
    }
Ejemplo n.º 19
0
    // This function converts a type to the specific index of where it is stored.
    int BuildingTypeToIndex(buildingType type)
    {
        int index = -1;
        for (int i = 0; i < buildings.Length; i++) {
            if (buildings[i].editorName == TypeToName(type)) {
                index = i;
                break;
            }
        }

        return index;
    }
Ejemplo n.º 20
0
 // This function converts the buildingType of a building to its relative name.
 public string TypeToName(buildingType type)
 {
     switch (type) {
         case buildingType.tier1:
             return "tier1";
         case buildingType.tier2:
             return "tier2";
         case buildingType.tier3:
             return "tier3";
         default:
             return "null";
     }
 }
 void Start()
 {
     goalType = data.NameToType(goalName);
     rewardType = data.NameToType(rewardName);
     comButton = GetComponent<Image>();
 }
Ejemplo n.º 22
0
    // This function gives number of buildings bought based on a given type.
    // To expand on this, add another case for each type of building.
    public int getBuildingNum(buildingType type)
    {
        int index = BuildingTypeToIndex(type);

        return buildings[index].getNum();
    }
Ejemplo n.º 23
0
    // This function returns the cost of a given building.
    public ulong getBuildingCostForNext(int amount, buildingType type)
    {
        int index = BuildingTypeToIndex(type);

        return buildings[index].getCostForNext(amount);
    }
Ejemplo n.º 24
0
        public Building(BuildingRelation _relation, BuildingConfigurations config, Material mat,int materialID, float texWidth)
        {
            type = buildingType.withholeInside;
            relation = _relation;

            id = relation.outerWall.id;

            buildingConfig = config;
            buildingHeight = getBuildingHeight(relation.tags);
            equalizedBuildingHeight = assingBuildingTopLevel(relation.outerWall);

            isClockwise = getWayOrientation(relation.outerWall);

            defaultMaterial = mat;
            defaultMaterialID = materialID;
            defaultTextureWidth = texWidth;
            facadeSkins = new List<FacadeSkin>();

            building = new GameObject("building" + id);
            building.transform.position = new Vector3(0.0f, 0.0f, 0.0f);

            GOtransform = new Vector3(0, 0, 0);
            GOrotate = new Vector3(0, 0, 0);
            GOscale = new Vector3(1, 1, 1);
        }