/// <summary> /// Publiczny konstruktor jednoparametrowy. /// </summary> /// <param name="posX">Pozycja startowa zolnierza (mierzona w tilesIndex.</param> /// <param name="direct">Kierunek w ktorym sie porusza.(Prawo,Lewo)</param> /// <param name="level">Referencja do obiektu planszy.</param> /// <param name="holdsBazooka">Czy moze strzelac</param> /// <author>Michal Ziober</author> /// <param name="offset"></param> public Soldier(float posX, Direction direct, Level level, float offset, bool holdsBazooka)//, SoldierType type) { //przy starcie jest zywy. _soldierStatus = SoldierStatus.IsAlive; //pozycja startowa - pozycja zniszczonej instalacji xPos = posX * LevelTile.TileWidth + offset; startPosition = posX; startLevelIndex = (int)posX; direction = direct; refToLevel = level; canDie = false; canReEnter = false; protectedTime = 0; lastFireTick = Environment.TickCount; weaponManager = new WeaponManager(level, this, RocketCount, 0, 0); weaponManager.RegisterWeaponToModelEvent += level.rocket_RegisterWeaponEvent; this.hasBazooka = holdsBazooka; if (holdsBazooka) { weaponManager.SelectWeapon = WeaponType.Rocket; } else { weaponManager.SelectWeapon = WeaponType.None; } Random r = new Random(); // doza losowosci firePrepareDelay = (int)(firePrepareDelay * Mathematics.RangeRandom(0.9f, 1.1f)); fireInterval = (int)(fireInterval * Mathematics.RangeRandom(0.9f, 1.1f)); bazookaRotationPerSecond = bazookaRotationPerSecond * Mathematics.RangeRandom(0.9f, 1.1f); bazookaRotationPerSecond *= Mathematics.RangeRandom(-1, 1) > 0 ? 1.0f : -1.0f; // zamiana kąta }
// Use this for initialization new void Start() { base.Start(); soldierStatus = transform.GetComponent<SoldierStatus>(); standingRotation = Quaternion.Euler(new Vector3(0, 0, 0)); }
/// <summary> /// Zabija zolnierza. /// </summary> public void Kill() { //zabijam zolnierza. _soldierStatus = SoldierStatus.IsDead; }
public void ReturnToBunker() { this._soldierStatus = SoldierStatus.InBunker; }