Esempio n. 1
0
 protected override void OnParentSet(IHexGridCell oldParent)
 {
     if (oldParent != null)
     {
         oldParent.RemoveComponent <UnselectableComponent>();
     }
     Parent.AddComponent(new UnselectableComponent());
 }
        private void CreateBase(int x, int y, bool isPlayer, IDictionary <IHexGridCell, bool> baseTerrains)
        {
            IHexGridCell centerBaseTile = HexTiling[x, y];

            centerBaseTile.RemoveComponent <CreepComponent>();
            centerBaseTile.AddComponent((isPlayer) ? (new PlayerBaseComponent() as ICellComponent) : new EnemyBaseComponent());
            baseTerrains.Add(centerBaseTile, isPlayer);
            foreach (IHexGridCell neighbor in HexTiling.CellNeighbors(centerBaseTile))
            {
                baseTerrains.Add(neighbor, isPlayer);
                neighbor.RemoveComponent <CreepComponent>();
            }
            if (isPlayer)
            {
                PlayerBase = centerBaseTile;
            }
            else
            {
                EnemyBase = centerBaseTile;
            }
        }