示例#1
0
 public string cardName()
 {
     if (number < 11)
     {
         return(number.ToString());
     }
     else
     {
         Royal c = (Royal)number;
         return(c.ToString());
     }
 }
示例#2
0
    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;
    }
示例#3
0
    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);
    }
示例#4
0
 //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);
         }
     }
 }
示例#5
0
    // 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);
        }
    }
示例#6
0
    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);
        }
    }
示例#7
0
        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);
                }
            }
        }
示例#8
0
        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);
            }
        }