Пример #1
0
 public int ChangeState(BaseSwitcher switcher)
 {
     if (currentState == 1)
     {
         TurnOff();
     }
     return(currentState);
 }
Пример #2
0
 /// <summary>
 /// Creates a unit with all parameters
 /// </summary>
 /// <param name="unitName">Name of the unit e.g. Tank 1</param>
 /// <param name="hp">Healthpoints of the unit e.g. 100</param>
 /// <param name="attack">Attackvalue of the unit e.g. 20</param>
 /// <param name="critChance">Chance to hit a critical hit on another unit e.g. 0,1 = 10%</param>
 /// <param name="defense">The defense value of a unit</param>
 /// <param name="type">The type of the unit. (Tank, Soldier or Plane)</param>
 /// <param name="armorType">The armor type of the unit. Important for passives</param>
 /// <param name="buildtime">The time it takes to build this unit in seconds</param>
 /// <param name="createAndOrderButton">The script that triggeres a production of this unit</param>
 /// <param name="baseSwitch">The script that handles a base switch</param>
 public Unit Initialize(string unitName, int hp, int attack, float critChance, int defense, Type type, ArmorType armorType, float buildtime, CreateAndOrderUnit createAndOrderButton, BaseSwitcher baseSwitch)
 {
     this.UnitName             = unitName;
     this.hp                   = hp;
     this.attack               = attack;
     this.critChance           = critChance;
     this.defense              = defense;
     this.UnitType             = type;
     this.ArmorTypeUnit        = armorType;
     this.buildtime            = buildtime;
     this.CreateAndOrderButton = createAndOrderButton;
     this.baseSwitch           = baseSwitch;
     AllUnits.Add(this);
     return(this);
 }
Пример #3
0
 public abstract int ChangeState(BaseSwitcher switcher, string action);
Пример #4
0
 /// <summary>Runs one time when object is instanciated</summary>
 private void Start()
 {
     this.baseSwitch       = GameObject.FindObjectOfType <BaseSwitcher>();
     this.energyManagement = this.baseSwitch.GetEnergyPool();
 }
Пример #5
0
 public override int ChangeState(BaseSwitcher switcher, string action)
 {
     return(ChangeState(switcher));
 }