public Generate(char[,] drawBuffer, List <AbstractUnit> units, ObjectDeath objectDeath, List <int[]> freeCells) { this.units = units; this.freeCells = freeCells; this.drawBuffer = drawBuffer; this.objectDeath = objectDeath; }
// Use this for initialization void Start() { // find player player = GameObject.FindGameObjectWithTag("Player"); playerPos = player.GetComponent <Transform>(); pb = player.GetComponent <PlayerBehaviour>(); // set itself to players current object pb.SetCurrentObject(gameObject); death = GetComponent <ObjectDeath>(); // animate in iTween.ScaleFrom(gameObject, iTween.Hash("x", 0, "y", 0, "z", 0)); }
public Snake(int PosX, int PosY, char[,] drawBuffer, GameOver gameOver, ObjectDeath objectDeath, SetStats setStats) : base(PosX, PosY) { // Конструктор this.setStats = setStats; this.gameOver = gameOver; this.drawBuffer = drawBuffer; this.objectDeath = objectDeath; stats = new int[2] { 0, 0 }; touched = new Dictionary <AbstractUnit, int>(); touchedUpdates = new Dictionary <AbstractUnit, int>(); links = new List <SnakeLink>() { new SnakeLink(PosX, PosY + 1) }; }
public Microbe(int PosX, int PosY, int age, ObjectDeath objectDeath, char[,] drawBuffer) : base(PosX, PosY, age, objectDeath) { Profit = -1; switch (Rand.Get(1, 3)) { // выбор рандомного направления движения, происходит при создании объекта case 1: if (PosX == 0) { this.PosX = 1; } else if (PosX == drawBuffer.GetLength(1) - 1) { this.PosX = drawBuffer.GetLength(1) - 2; } axis = 'x'; break; case 2: if (PosY == 0) { this.PosY = 1; } else if (PosY == drawBuffer.GetLength(0) - 1) { this.PosY = drawBuffer.GetLength(0) - 2; } axis = 'y'; break; } switch (Rand.Get(1, 3)) { case 1: direction = '-'; break; case 2: direction = '+'; break; } // Вспомогательные координаты, используемые для реалзации движения объекта baseX = this.PosX; baseY = this.PosY; }
public Runtime(char[,] drawBuffer, int speed, string name) { this.name = name; this.speed = speed; this.drawBuffer = drawBuffer; stats = new int[2]; setStats = UpdateStatistics; objectDeath = ObjectDeathFunc; gameOver = delegate { exit = true; }; snake = new Snake((int)Math.Round((double)(drawBuffer.GetLength(1) - 1) / 2), (int)Math.Round((double)(drawBuffer.GetLength(0) - 1) / 2), drawBuffer, gameOver, objectDeath, setStats); units = new List <AbstractUnit>() { }; toRemove = new List <AbstractUnit>() { }; drawer = new Drawer(drawBuffer, freeCells); generate = new Generate(drawBuffer, units, objectDeath, freeCells); }
public Heal(int PosX, int PosY, int age, ObjectDeath objectDeath, char[,] drawBuffer) : base(PosX, PosY, age, objectDeath, drawBuffer) { Sign = '8'; Profit = 2; }
public AbstractEatableAgingUnit(int PosX, int PosY, int age, ObjectDeath objectDeath) : base(PosX, PosY, age, objectDeath) { }
public AbstractAgingUnit(int PosX, int PosY, int age, ObjectDeath objectDeath) : base(PosX, PosY) { Age = age; this.objectDeath = objectDeath; AsyncAgeControl(); }
public PoisonedMicrobe(int PosX, int PosY, int age, ObjectDeath objectDeath, char[,] drawBuffer) : base(PosX, PosY, age, objectDeath, drawBuffer) { Sign = 'Ж'; Profit = -3; }
public FreeLink(int PosX, int PosY, int age, ObjectDeath objectDeath) : base(PosX, PosY, age, objectDeath) { Profit = 1; }