Exemplo n.º 1
0
            public string GetStringRepresentation()
            {
                var representation = $@"T1:{Tower1.Select(t => t).Aggregate("", (agg, r) => $"{agg}{r}")},"
                                     + $@"T2:{Tower2.Select(t => t).Aggregate("", (agg, r) => $"{agg}{r}")},"
                                     + $@"T3:{Tower3.Select(t => t).Aggregate("", (agg, r) => $"{agg}{r}")}";

                return(representation);
            }
Exemplo n.º 2
0
 public HanoiPuzzle(int height)
 {
     validate  = new Validation();
     error     = false;
     y         = 5;
     maxHeight = height;
     print     = new Print(maxHeight);
     for (int i = maxHeight; i > 0; i--)
     {
         Tower1.Push(i);
     }
 }
Exemplo n.º 3
0
    public void SetTarget(Tower1 tower_in)
    {
        tower = tower_in;

        transform.position = tower.transform.position;

        towerDetails.text      = tower.getTowerInfo();
        sellButtonText.text    = tower.getSellInfo();
        upgradeButtonText.text = tower.getUpgradeInfo();

        //set range indicator size... this is not exact
        rangeIndicator.transform.localScale = new Vector2(tower.range * .8f, tower.range * .8f);
        rangeIndicator.enabled = true;
        ui.SetActive(true);
    }
Exemplo n.º 4
0
        /// <summary>
        /// Constructer
        /// </summary>
        /// <param name="numberOfDiscs"></param>
        public HanoiSimulator(int height)
        {
            // Sets max height variable
            this.maxHeight = height;
            print          = new Print(maxHeight);

            // Add circles to the first tower.
            for (int i = maxHeight; i > 0; i--)
            {
                Tower1.Push(i);
            }

            // Print towers before algorithm starts
            y = print.PrintTowers(Tower1, Tower2, Tower3, y);

            // Run the algorithm.
            SolveHanoi(maxHeight, Tower1, Tower2, Tower3);
        }
Exemplo n.º 5
0
    public void ClickToUpgrade()
    {
        if (gmanager.GetCash() > tower.towerUpgrade.cost)
        {
            // remove cash
            gmanager.RemoveCash(tower.towerUpgrade.cost);

            // instantiate new tower
            Tower1     newTowerInfo     = tower.towerUpgrade;
            Vector3    newTowerPosition = tower.transform.position;
            Quaternion newTowerRotation = tower.transform.rotation;

            // destroy old tower
            tower.Destroy();

            // create new tower
            Tower1 newTower = Instantiate(newTowerInfo, newTowerPosition, newTowerRotation);

            tower = newTower;
        }
    }
Exemplo n.º 6
0
	public Character SpawnCharacter(CharacterData.CharacterClassType classType, int charModeType, int camp, int level, Vector3 pos, Vector3 dir, CharacterStatus.Pose pose){
		this.START_METHOD("SpawnCharacter");
		Character tempChar = null;
		//create the enemies
		if (classType == CharacterData.CharacterClassType.CHARACTER) {
			//create the enemy
			if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.BOWMAN){
				Bowman chara = new Bowman();
				chara.SetArmor(armorList[0]);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			}
//			} else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.GIANT){
//				Gaint chara = new Gaint("giant");
//				SetEnemy(chara,pos,dir,camp,pose,0.02f,20);
//				tempChar = chara;
//			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.VIKING){
				Viking chara = new Viking();
				chara.SetArmor(armorList[1]);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,30);
				tempChar = chara;
			}
			//create enemy2
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY2){
				Gaint chara = new Gaint("enemy2");
				chara.SetArmor(armorList[2]);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			//enemy3
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY3){
				Gaint chara = new Gaint("enemy3");
				chara.SetArmor(armorList[3]);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			//enemy4
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY4){
				Gaint chara = new Gaint("enemy4");
				chara.SetArmor(armorList[4]);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY5){
				Gaint chara = new Gaint("enemy5");
				chara.SetArmor(armorList[5]);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY6){
				Gaint chara = new Gaint("enemy6");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY7){
				Gaint chara = new Gaint("enemy7");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY8){
				Gaint chara = new Gaint("enemy8");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY9){
				Gaint chara = new Gaint("enemy9");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY10){
				Gaint chara = new Gaint("enemy10");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY11){
				Gaint chara = new Gaint("enemy11");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY12){
				Gaint chara = new Gaint("enemy12");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY13){
				Gaint chara = new Gaint("enemy13");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY14){
				Gaint chara = new Gaint("enemy14");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY15){
				Gaint chara = new Gaint("enemy15");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY16){
				Gaint chara = new Gaint("enemy16");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY17){
				Gaint chara = new Gaint("enemy17");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 

			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY19){
				Gaint chara = new Gaint("enemy19");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY20){
				Gaint chara = new Gaint("enemy20");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY21){
				Gaint chara = new Gaint("enemy21");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY22){
				Gaint chara = new Gaint("enemy22");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 

			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY24){
				Gaint chara = new Gaint("enemy24");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY25){
				Gaint chara = new Gaint("enemy25");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 

			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY27){
				Gaint chara = new Gaint("enemy27");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY28){
				Gaint chara = new Gaint("enemy28");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY30){
				Gaint chara = new Gaint("enemy30");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY31){
				Gaint chara = new Gaint("enemy31");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY32){
				Gaint chara = new Gaint("enemy32");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY33){
				Gaint chara = new Gaint("enemy33");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY34){
				Gaint chara = new Gaint("enemy34");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY35){
				Gaint chara = new Gaint("enemy35");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY36){
				Gaint chara = new Gaint("enemy36");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY37){
				Gaint chara = new Gaint("enemy37");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY38){
				Gaint chara = new Gaint("enemy38");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY39){
				Gaint chara = new Gaint("enemy39");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 

			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY41){
				Gaint chara = new Gaint("enemy41");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 

			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY43){
				Gaint chara = new Gaint("enemy43");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY44){
				Gaint chara = new Gaint("enemy44");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY45){
				Gaint chara = new Gaint("enemy45");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY46){
				Gaint chara = new Gaint("enemy46");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.BOSS1){
				Gaint chara = new Gaint("boss1");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.BOSS2){
				Gaint chara = new Gaint("boss2");
				SetEnemy(chara,pos,dir,camp,pose,0.02f,10);
				tempChar = chara;
			} 


			//used enemies model
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY18){
				Gaint chara = new Gaint("enemy18");
				chara.SetArmor(armorList[0]);
				chara.SetIsPonsion(false);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,hpList[0]);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY23){
				Gaint chara = new Gaint("enemy23");
				chara.SetArmor(armorList[1]);
				chara.SetIsPonsion(false);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,hpList[1]);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY26){
				Gaint chara = new Gaint("enemy26");
				chara.SetArmor(armorList[2]);
				chara.SetIsPonsion(false);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,hpList[2]);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY29){
				Gaint chara = new Gaint("enemy29");
				chara.SetArmor(armorList[3]);
				chara.SetIsPonsion(false);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,hpList[3]);
				tempChar = chara;
			}
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY40){
				Gaint chara = new Gaint("enemy40");
				chara.SetArmor(armorList[4]);
				chara.SetIsPonsion(false);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,hpList[4]);
				tempChar = chara;
			} 
			else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY42){
				Gaint chara = new Gaint("enemy42");
				chara.SetArmor(armorList[5]);
				chara.SetIsPonsion(false);
				SetEnemy(chara,pos,dir,camp,pose,0.02f,hpList[5]);
				tempChar = chara;
			} 


			if(tempChar != null){
				chars.Add(tempChar);
			} else {
				throw new UnityException("no current char type to spawn!");
			}
		}
		//create the building
		else if (classType == CharacterData.CharacterClassType.BUILDING) {
			//create the barrack to gather resources
			if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.BARRACK){
				TowerBarrack character = new TowerBarrack();
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetCamp(camp);
				tempChar = character;
			} else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.CANNON){
				Cannon character = new Cannon();
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose (pose);
				character.SetCamp(camp);
				//set attack power
				character.SetAttackPower(50);
				tempChar = character;
			}
			//Tower01
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER1){
				Tower1 character = new Tower1();
				character.SetAttackRange(2.25f);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose (pose);
				character.SetCamp(camp);
				character.SetAttackRate(1f);
				character.SetNeedPower(towerPowerList[0]);
				//set attack power
				character.SetAttackPower(tower1AttackNumber);
				tempChar = character;
			}
			//Tower02
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER2){
				Tower2 character = new Tower2();
				character.SetAttackRange(2);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose (pose);
				character.SetCamp(camp);
				character.SetAttackRate(1f);
				character.SetNeedPower(towerPowerList[1]);
				//set attack power
				character.SetAttackPower(tower2AttackNumber);
				tempChar = character;
			}
			//Tower4
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER4){
				Tower4 character = new Tower4();
				character.SetAttackRange(2);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetNeedPower(towerPowerList[2]);
				tempChar = character;
			}
			//Tower7
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER7){
				Tower7 character = new Tower7();
				character.SetAttackRange(2.5f);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackPower(tower7AttackNumber);
				character.SetAttackRate(1f);
				character.SetNeedPower(towerPowerList[3]);
				tempChar = character;
			}
			//Tower10
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER10){
				Tower10 character = new Tower10();
				character.SetAttackRange(2.5f);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackPower(tower10AttackNumber);
				character.SetAttackRate(1f);
				character.SetNeedPower(towerPowerList[4]);
				tempChar = character;
			}
			//Research
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.LAB){
				Research character = new Research();
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				tempChar = character;
			}
			//Diamond Resource
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.DIAMOND){
				DiamondResource character = new DiamondResource();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				tempChar = character;
			}
			//Small Mine
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.MINE1){
				SmallMine character = new SmallMine();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				tempChar = character;
			}
			//Large Mine
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.MINE2){
				LargeMine character = new LargeMine();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				tempChar = character;
			}
			//Small Geneator
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.GENERATOR1){
				SmallGeneator character = new SmallGeneator();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				tempChar = character;
			}
			//Large Geneator
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.GENERATOR2){
				LargeGeneator character = new LargeGeneator();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				tempChar = character;
			}
			//Targeting Facility
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TARGETING){
				TargetingFacility character = new TargetingFacility();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackRange(1);
				character.SetNeedPower(towerPowerList[5]);
				tempChar = character;
			}
			//Super Capacitor
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.CAPACITOR){
				SuperCapacitor character = new SuperCapacitor();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackRange(1);
				character.SetNeedPower(towerPowerList[6]);
				tempChar = character;
			}
			//Alien Recovery
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.ALIEN){
				AlienRecovery character = new AlienRecovery();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackRange(2);
				tempChar = character;
			}
			//Antenna
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.ANTENNA){
				Antenna character = new Antenna();
				character.SetPos(pos);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackRange(antennaRange);
				tempChar = character;
			}
			//created the tower, add to the building list
			if(tempChar != null){
				building.Add(tempChar);
			} else { 
				throw new UnityException("no current building type to spawn!");
			}
		}
		//add to the all character list
		allCharacter.Add (tempChar);
		this.END_METHOD("SpawnCharacter");
		return tempChar;
	}
Exemplo n.º 7
0
    IEnumerator FireDelay()
    {
        isBuild = false;
        progressBar.SetActive(false);
        transform.Find("Soil").GetComponent <Button>().interactable           = false;
        transform.Find("Soil").GetComponent <EventTrigger>().enabled          = false;
        progressBar.transform.Find("Image").GetComponent <Image>().fillAmount = 0;
        if (tower1.activeInHierarchy)
        {
            Tower1 code = tower1.GetComponent <Tower1>();
            image1.SetActive(false);
            towerImage1.SetActive(true);
            range1.GetComponent <PolygonCollider2D>().enabled = true;
            range1.GetComponent <Range1>().enabled            = true;
            selfAudioSource.clip = code.audioClips[code.SwitchAudio % 3];
            selfAudioSource.Play();
            tower1.transform.Find("Archer1").gameObject.SetActive(true);
            tower1.transform.Find("Archer2").gameObject.SetActive(true);
            code.SwitchAudio++;
            yield return(new WaitForSeconds(1.5f));

            range1.GetComponent <Range1>().isStart = true;
        }
        else if (tower2.activeInHierarchy)
        {
            Tower2 code = tower2.GetComponent <Tower2>();
            image2.SetActive(false);
            towerImage2.SetActive(true);
            range2.GetComponent <Range2>().isFirst = 1;
            range2.GetComponent <Range2>().enabled = true;
            selfAudioSource.clip = code.audioClips[code.SwitchAudio % 4];
            selfAudioSource.Play();
            code.SwitchAudio++;
        }
        else if (tower3.activeInHierarchy)
        {
            Tower3 code = tower3.GetComponent <Tower3>();
            image3.SetActive(false);
            towerImage3.SetActive(true);
            range3.GetComponent <PolygonCollider2D>().enabled = true;
            range3.GetComponent <Range3>().enabled            = true;
            selfAudioSource.clip = code.audioClips[code.SwitchAudio % 3];
            selfAudioSource.Play();
            tower3.transform.Find("Mage").gameObject.SetActive(true);
            code.SwitchAudio++;
            yield return(new WaitForSeconds(1.5f));

            range3.GetComponent <Range3>().isStart = true;
        }
        else if (tower4.activeInHierarchy)
        {
            Tower4 code = tower4.GetComponent <Tower4>();
            image4.SetActive(false);
            towerImage4.SetActive(true);
            range4.GetComponent <PolygonCollider2D>().enabled = true;
            range4.GetComponent <Range4>().enabled            = true;
            selfAudioSource.clip = code.audioClips[code.SwitchAudio % 3];
            selfAudioSource.Play();
            code.SwitchAudio++;
            yield return(new WaitForSeconds(1.5f));

            range4.GetComponent <Range4>().isStart = true;
        }
    }
Exemplo n.º 8
0
 public void SelectTower(Tower1 tower_in)
 {
     selectedTower = tower_in;
     towerSelectedUI.SetTarget(tower_in);
 }
Exemplo n.º 9
0
	public Character SpawnCharacter(CharacterData.CharacterClassType classType, int charModeType, int camp, int level, Vector3 pos, Vector3 dir, CharacterStatus.Pose pose){
		this.START_METHOD("SpawnCharacter");
		Character tempChar = null;
		//create the enemies
		if (classType == CharacterData.CharacterClassType.CHARACTER) {
			//create the enemy
			if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.BOWMAN){
				Bowman chara = new Bowman();
				chara.SetPos(pos);
				chara.SetDir(dir);
				chara.SetPose(pose);
				chara.SetCamp(camp);
				chara.SetSpeed(0.01f);
				//set bowman max life
				chara.SetLife(200);
				tempChar = chara;
			} else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.GIANT){
				Gaint chara = new Gaint();
				chara.SetPos(pos);
				chara.SetDir(dir);
				chara.SetPose(pose);
				chara.SetCamp(camp);
				chara.SetSpeed(0.01f);
				//set giant max life
				chara.SetLife(400);
				tempChar = chara;
			} else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.VIKING){
				Viking chara = new Viking();
				chara.SetPos(pos);
				chara.SetDir(dir);
				chara.SetPose(pose);
				chara.SetCamp(camp);
				chara.SetSpeed(0.01f);
				//set viking max life
				chara.SetLife(300);
				tempChar = chara;
			} 
			if(tempChar != null){
				chars.Add(tempChar);
			} else {
				throw new UnityException("no current char type to spawn!");
			}
		}
		//create the building
		else if (classType == CharacterData.CharacterClassType.BUILDING) {
			//create the barrack to gather resources
			if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.BARRACK){
				TowerBarrack character = new TowerBarrack();
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetCamp(camp);
				tempChar = character;
			} else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.CANNON){
				Cannon character = new Cannon();
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose (pose);
				character.SetCamp(camp);
				//set attack power
				character.SetAttackPower(50);
				tempChar = character;
			}
			//Tower01
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER1){
				Tower1 character = new Tower1();
				character.SetAttackRange(3);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose (pose);
				character.SetCamp(camp);
				character.SetAttackRate(1f);
				//set attack power
				character.SetAttackPower(1);
				tempChar = character;
			}
			//Tower02
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER2){
				Tower2 character = new Tower2();
				character.SetAttackRange(3);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose (pose);
				character.SetCamp(camp);
				character.SetAttackRate(1f);
				//set attack power
				character.SetAttackPower(1);
				tempChar = character;
			}
			//Tower4
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER4){
				Tower4 character = new Tower4();
				character.SetAttackRange(2);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose(pose);
				character.SetCamp(camp);
				tempChar = character;
			}
			//Tower7
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER7){
				Tower7 character = new Tower7();
				character.SetAttackRange(2);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackPower(1);
				character.SetAttackRate(1f);
				tempChar = character;
			}
			//Tower10
			else if((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER10){
				Tower10 character = new Tower10();
				character.SetAttackRange(4);
				character.SetLevel(1);
				character.SetPos(pos);
				character.SetDir(dir);
				character.SetPose(pose);
				character.SetCamp(camp);
				character.SetAttackPower(1);
				character.SetAttackRate(2f);
				tempChar = character;
			}
			//created the barrack, add to the building list
			if(tempChar != null){
				building.Add(tempChar);
			} else { 
				throw new UnityException("no current building type to spawn!");
			}
		}
		//add to the all character list
		allCharacter.Add (tempChar);
		this.END_METHOD("SpawnCharacter");
		return tempChar;
	}
Exemplo n.º 10
0
    public Character SpawnCharacter(CharacterData.CharacterClassType classType, int charModeType, int camp, int level, Vector3 pos, Vector3 dir, CharacterStatus.Pose pose)
    {
        this.START_METHOD("SpawnCharacter");
        Character tempChar = null;

        //create the enemies
        if (classType == CharacterData.CharacterClassType.CHARACTER)
        {
            //create the enemy
            if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.BOWMAN)
            {
                Bowman chara = new Bowman();
                chara.SetArmor(armorList[0]);
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
//			} else if((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.GIANT){
//				Gaint chara = new Gaint("giant");
//				SetEnemy(chara,pos,dir,camp,pose,0.02f,20);
//				tempChar = chara;
//			}
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.VIKING)
            {
                Viking chara = new Viking();
                chara.SetArmor(armorList[1]);
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 30);
                tempChar = chara;
            }
            //create enemy2
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY2)
            {
                Gaint chara = new Gaint("enemy2");
                chara.SetArmor(armorList[2]);
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            //enemy3
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY3)
            {
                Gaint chara = new Gaint("enemy3");
                chara.SetArmor(armorList[3]);
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            //enemy4
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY4)
            {
                Gaint chara = new Gaint("enemy4");
                chara.SetArmor(armorList[4]);
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY5)
            {
                Gaint chara = new Gaint("enemy5");
                chara.SetArmor(armorList[5]);
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY6)
            {
                Gaint chara = new Gaint("enemy6");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY7)
            {
                Gaint chara = new Gaint("enemy7");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY8)
            {
                Gaint chara = new Gaint("enemy8");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY9)
            {
                Gaint chara = new Gaint("enemy9");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY10)
            {
                Gaint chara = new Gaint("enemy10");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY11)
            {
                Gaint chara = new Gaint("enemy11");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY12)
            {
                Gaint chara = new Gaint("enemy12");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY13)
            {
                Gaint chara = new Gaint("enemy13");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY14)
            {
                Gaint chara = new Gaint("enemy14");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY15)
            {
                Gaint chara = new Gaint("enemy15");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY16)
            {
                Gaint chara = new Gaint("enemy16");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY17)
            {
                Gaint chara = new Gaint("enemy17");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }

            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY19)
            {
                Gaint chara = new Gaint("enemy19");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY20)
            {
                Gaint chara = new Gaint("enemy20");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY21)
            {
                Gaint chara = new Gaint("enemy21");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY22)
            {
                Gaint chara = new Gaint("enemy22");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }

            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY24)
            {
                Gaint chara = new Gaint("enemy24");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY25)
            {
                Gaint chara = new Gaint("enemy25");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }

            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY27)
            {
                Gaint chara = new Gaint("enemy27");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY28)
            {
                Gaint chara = new Gaint("enemy28");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }

            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY30)
            {
                Gaint chara = new Gaint("enemy30");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY31)
            {
                Gaint chara = new Gaint("enemy31");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY32)
            {
                Gaint chara = new Gaint("enemy32");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY33)
            {
                Gaint chara = new Gaint("enemy33");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY34)
            {
                Gaint chara = new Gaint("enemy34");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY35)
            {
                Gaint chara = new Gaint("enemy35");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY36)
            {
                Gaint chara = new Gaint("enemy36");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY37)
            {
                Gaint chara = new Gaint("enemy37");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY38)
            {
                Gaint chara = new Gaint("enemy38");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY39)
            {
                Gaint chara = new Gaint("enemy39");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }

            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY41)
            {
                Gaint chara = new Gaint("enemy41");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }

            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY43)
            {
                Gaint chara = new Gaint("enemy43");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY44)
            {
                Gaint chara = new Gaint("enemy44");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY45)
            {
                Gaint chara = new Gaint("enemy45");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY46)
            {
                Gaint chara = new Gaint("enemy46");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.BOSS1)
            {
                Gaint chara = new Gaint("boss1");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.BOSS2)
            {
                Gaint chara = new Gaint("boss2");
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, 10);
                tempChar = chara;
            }


            //used enemies model
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY18)
            {
                Gaint chara = new Gaint("enemy18");
                chara.SetArmor(armorList[0]);
                chara.SetIsPonsion(false);
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, hpList[0]);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY23)
            {
                Gaint chara = new Gaint("enemy23");
                chara.SetArmor(armorList[1]);
                chara.SetIsPonsion(false);
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, hpList[1]);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY26)
            {
                Gaint chara = new Gaint("enemy26");
                chara.SetArmor(armorList[2]);
                chara.SetIsPonsion(false);
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, hpList[2]);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY29)
            {
                Gaint chara = new Gaint("enemy29");
                chara.SetArmor(armorList[3]);
                chara.SetIsPonsion(false);
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, hpList[3]);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY40)
            {
                Gaint chara = new Gaint("enemy40");
                chara.SetArmor(armorList[4]);
                chara.SetIsPonsion(false);
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, hpList[4]);
                tempChar = chara;
            }
            else if ((CharacterData.CharacterModel)charModeType == CharacterData.CharacterModel.ENEMY42)
            {
                Gaint chara = new Gaint("enemy42");
                chara.SetArmor(armorList[5]);
                chara.SetIsPonsion(false);
                SetEnemy(chara, pos, dir, camp, pose, 0.02f, hpList[5]);
                tempChar = chara;
            }


            if (tempChar != null)
            {
                chars.Add(tempChar);
            }
            else
            {
                throw new UnityException("no current char type to spawn!");
            }
        }
        //create the building
        else if (classType == CharacterData.CharacterClassType.BUILDING)
        {
            //create the barrack to gather resources
            if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.BARRACK)
            {
                TowerBarrack character = new TowerBarrack();
                character.SetPos(pos);
                character.SetDir(dir);
                character.SetCamp(camp);
                tempChar = character;
            }
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.CANNON)
            {
                Cannon character = new Cannon();
                character.SetPos(pos);
                character.SetDir(dir);
                character.SetPose(pose);
                character.SetCamp(camp);
                //set attack power
                character.SetAttackPower(50);
                tempChar = character;
            }
            //Tower01
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER1)
            {
                Tower1 character = new Tower1();
                character.SetAttackRange(2.25f);
                character.SetLevel(1);
                character.SetPos(pos);
                character.SetDir(dir);
                character.SetPose(pose);
                character.SetCamp(camp);
                character.SetAttackRate(1f);
                character.SetNeedPower(towerPowerList[0]);
                //set attack power
                character.SetAttackPower(tower1AttackNumber);
                tempChar = character;
            }
            //Tower02
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER2)
            {
                Tower2 character = new Tower2();
                character.SetAttackRange(2);
                character.SetLevel(1);
                character.SetPos(pos);
                character.SetDir(dir);
                character.SetPose(pose);
                character.SetCamp(camp);
                character.SetAttackRate(1f);
                character.SetNeedPower(towerPowerList[1]);
                //set attack power
                character.SetAttackPower(tower2AttackNumber);
                tempChar = character;
            }
            //Tower4
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER4)
            {
                Tower4 character = new Tower4();
                character.SetAttackRange(2);
                character.SetLevel(1);
                character.SetPos(pos);
                character.SetDir(dir);
                character.SetPose(pose);
                character.SetCamp(camp);
                character.SetNeedPower(towerPowerList[2]);
                tempChar = character;
            }
            //Tower7
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER7)
            {
                Tower7 character = new Tower7();
                character.SetAttackRange(2.5f);
                character.SetLevel(1);
                character.SetPos(pos);
                character.SetDir(dir);
                character.SetPose(pose);
                character.SetCamp(camp);
                character.SetAttackPower(tower7AttackNumber);
                character.SetAttackRate(1f);
                character.SetNeedPower(towerPowerList[3]);
                tempChar = character;
            }
            //Tower10
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TOWER10)
            {
                Tower10 character = new Tower10();
                character.SetAttackRange(2.5f);
                character.SetLevel(1);
                character.SetPos(pos);
                character.SetDir(dir);
                character.SetPose(pose);
                character.SetCamp(camp);
                character.SetAttackPower(tower10AttackNumber);
                character.SetAttackRate(1f);
                character.SetNeedPower(towerPowerList[4]);
                tempChar = character;
            }
            //Research
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.LAB)
            {
                Research character = new Research();
                character.SetLevel(1);
                character.SetPos(pos);
                character.SetPose(pose);
                character.SetCamp(camp);
                tempChar = character;
            }
            //Diamond Resource
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.DIAMOND)
            {
                DiamondResource character = new DiamondResource();
                character.SetPos(pos);
                character.SetPose(pose);
                character.SetCamp(camp);
                tempChar = character;
            }
            //Small Mine
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.MINE1)
            {
                SmallMine character = new SmallMine();
                character.SetPos(pos);
                character.SetPose(pose);
                character.SetCamp(camp);
                tempChar = character;
            }
            //Large Mine
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.MINE2)
            {
                LargeMine character = new LargeMine();
                character.SetPos(pos);
                character.SetPose(pose);
                character.SetCamp(camp);
                tempChar = character;
            }
            //Small Geneator
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.GENERATOR1)
            {
                SmallGeneator character = new SmallGeneator();
                character.SetPos(pos);
                character.SetPose(pose);
                character.SetCamp(camp);
                tempChar = character;
            }
            //Large Geneator
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.GENERATOR2)
            {
                LargeGeneator character = new LargeGeneator();
                character.SetPos(pos);
                character.SetPose(pose);
                character.SetCamp(camp);
                tempChar = character;
            }
            //Targeting Facility
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.TARGETING)
            {
                TargetingFacility character = new TargetingFacility();
                character.SetPos(pos);
                character.SetPose(pose);
                character.SetCamp(camp);
                character.SetAttackRange(1);
                character.SetNeedPower(towerPowerList[5]);
                tempChar = character;
            }
            //Super Capacitor
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.CAPACITOR)
            {
                SuperCapacitor character = new SuperCapacitor();
                character.SetPos(pos);
                character.SetPose(pose);
                character.SetCamp(camp);
                character.SetAttackRange(1);
                character.SetNeedPower(towerPowerList[6]);
                tempChar = character;
            }
            //Alien Recovery
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.ALIEN)
            {
                AlienRecovery character = new AlienRecovery();
                character.SetPos(pos);
                character.SetPose(pose);
                character.SetCamp(camp);
                character.SetAttackRange(2);
                tempChar = character;
            }
            //Antenna
            else if ((CharacterData.buildingMode)charModeType == CharacterData.buildingMode.ANTENNA)
            {
                Antenna character = new Antenna();
                character.SetPos(pos);
                character.SetPose(pose);
                character.SetCamp(camp);
                character.SetAttackRange(antennaRange);
                tempChar = character;
            }
            //created the tower, add to the building list
            if (tempChar != null)
            {
                building.Add(tempChar);
            }
            else
            {
                throw new UnityException("no current building type to spawn!");
            }
        }
        //add to the all character list
        allCharacter.Add(tempChar);
        this.END_METHOD("SpawnCharacter");
        return(tempChar);
    }
Exemplo n.º 11
0
 public bool IsStateTerminalState()
 {
     return(Tower1.Count() == 0 && Tower3.Count() == 0);
 }