Exemplo n.º 1
0
		public GameObject buildUnit(Transform spawn, UnitBuildInstructions buildInstructions, Faction faction)
		{
			GameObject unit;

			if (buildInstructions.prefab != null)
				unit = GameObject.Instantiate(buildInstructions.prefab);
			else
				unit = GameObject.Instantiate(unitBuilds[buildInstructions.type]);

			var unitComponent = unit.GetComponent<BaseUnit>();
			unitComponent.InitializeUnit(faction, buildInstructions);

			return unit;
		}
Exemplo n.º 2
0
		public void InitializeUnit(Faction unitFaction, UnitBuildInstructions template)
		{
			faction = unitFaction;

			_currentHealth = template.health;

			_buildInstructions = template;


			if (_currentHealth == 0)
				_currentHealth = 200;
			Globals.playfield.AddUnit(this);

			InitBehaviourTree();
		}
Exemplo n.º 3
0
		public void SetToInstructions(UnitBuildInstructions unitBuildInstructions)
		{
			_currentBuildInstructions = unitBuildInstructions;
			_descriptionText.text = unitBuildInstructions.unitName;
		}
Exemplo n.º 4
0
		public void BuildUnit(UnitBuildInstructions currentBuildInstructions)
		{
			var newUnit = Globals.unitBuilder.buildUnit(Globals.gameController.transform, currentBuildInstructions, this);

		}