public string cardName() { if (number < 11) { return(number.ToString()); } else { Royal c = (Royal)number; return(c.ToString()); } }
public void AcceptRoyal(Royal royal) { if (royal == null) { Debug.LogError("Delegation: Given null royal"); return; } // Set royal transform parent, and starting informing it _delRoyal = royal; _delRoyal.transform.parent = transform; _delRoyal.DelParent = this; }
public Delegation CreateDelegation(Royal royal) { Delegation newDelegation = ObjectManager.CreateDelegation(); if (newDelegation == null) { Debug.LogError("Dispatcher: Failed to instantiate new delegation"); return(null); } newDelegation.transform.parent = delagations; newDelegation.AcceptRoyal(royal); return(newDelegation); }
//Adds a child to the node or its subnodes. public void AddChild(Royal child) { if (child.Parent.Equals(this.Name)) { this.children.Add(child); } else { foreach (Royal royal in this.children) { royal.AddChild(child); } } }
// Use this for initialization protected void Awake() { _delRoyal = null; _orders = new Queue <Order>(); _location = null; currentlySelected = false; inputInterp = InterfaceManager.GetInputInterpreter(); _deployed = false; currentOrder = null; _retinue = GetComponentInChildren <MorphTracker>(); if (_retinue == null) { Debug.LogError("Error in Delegation object structure"); Destroy(this); } }
public static void Main() { //Read inputs. int n = int.Parse(Console.ReadLine()); Royal royalLeader = ReadRoyal(); for (int i = 0; i < n - 1; i++) { Royal royal = ReadRoyal(); royalLeader.AddChild(royal); } //Traverse the complete tree. foreach (Royal royal in royalLeader.Traverse()) { Console.WriteLine(royal.Name); } }
private void GrowVegetable() { foreach (var growingVegetable in this.Database.GrowingVegetables) { if (!this.Database.Ninjas.Any(ninja => ninja.Position.Equals(growingVegetable.Position))) { growingVegetable.Grow(); } if (growingVegetable.GrowthTime == 0) { IVegetable newVegetable = null; IMatrixPosition position = growingVegetable.Position; switch (growingVegetable.VegetableHolder) { case VegetableType.Asparagus: newVegetable = new Asparagus(position); break; case VegetableType.Broccoli: newVegetable = new Broccoli(position); break; case VegetableType.CherryBerry: newVegetable = new CherryBerry(position); break; case VegetableType.Mushroom: newVegetable = new Mushroom(position); break; case VegetableType.Royal: newVegetable = new Royal(position); break; } this.Database.AddVegetable(newVegetable); this.Database.SetGameFieldObject(growingVegetable.Position, newVegetable); } } }
public void SeedField(IList <string> inputMatrix, string firstNinjaName, string secondNinjaName) { for (int i = 0; i < inputMatrix.Count; i++) { List <IGameObject> currentRow = new List <IGameObject>(); string currentInputRow = inputMatrix[i]; for (int j = 0; j < currentInputRow.Length; j++) { char currentElement = currentInputRow[j]; IVegetable newVegetable = null; IBlankSpace newBlanckSpace = null; INinja newNinja = null; IMatrixPosition position = new MatrixPosition(i, j); switch (currentElement) { case 'A': newVegetable = new Asparagus(position); break; case 'B': newVegetable = new Broccoli(position); break; case 'C': newVegetable = new CherryBerry(position); break; case 'M': newVegetable = new Mushroom(position); break; case 'R': newVegetable = new Royal(position); break; case '*': newVegetable = new MeloLemonMelon(position); break; case '-': newBlanckSpace = new BlankSpace(position, -1, VegetableType.Blank); break; } if (currentElement.Equals(firstNinjaName[0])) { newNinja = new Ninja(position, firstNinjaName); } if (currentElement.Equals(secondNinjaName[0])) { newNinja = new Ninja(position, secondNinjaName); } if (newVegetable != null) { this.AddVegetable(newVegetable); currentRow.Add(newVegetable); } if (newNinja != null) { this.AddNinja(newNinja); currentRow.Add(newNinja); } if (newBlanckSpace != null) { currentRow.Add(newBlanckSpace); } } this.gameField.Add(currentRow); } }