bool IsMountable(NestDescriptor nest)
 {
     bool[] shape = nest.Shape.Mask;
     for (int x = -2; x < Model.Cells.GetLength(0) + 2; ++x)
     {
         for (int y = -2; y < Model.Cells.GetLength(1) + 2; ++y)
         {
             if (IsShapeValidOnCoords(shape, x, y))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Exemplo n.º 2
0
        void InitMonoBindings()
        {
            MonoBehaviourBindings monoBinds = GameObject.FindObjectOfType <MonoBehaviourBindings>();

            injectionBinder.Bind <ITextAccessor>().ToValue(new TextAccessor
            {
                Text = monoBinds.StartText
            }).ToName(TextType.START);
            injectionBinder.Bind <ITextAccessor>().ToValue(new TextAccessor
            {
                Text = monoBinds.GameOverText
            }).ToName(TextType.GAMEOVER);
            injectionBinder.Bind <IPositionsSetAccessor>().ToValue(new PositionsSetAccessor
            {
                Container = monoBinds.VerticalPosSet
            }).ToName(MotionType.VERTICAL);
            injectionBinder.Bind <IPositionsSetAccessor>().ToValue(new PositionsSetAccessor
            {
                Container = monoBinds.HorizontalPosSet
            }).ToName(MotionType.HORIZONTAL);
            injectionBinder.Bind <IGrid <CellDescriptor> >().ToValue(new GridAccessor <CellDescriptor>()
            {
                Container = monoBinds.CellsGrid
            });
            foreach (Transform tr in monoBinds.NestsGrid)
            {
                NestDescriptor nest = tr.GetComponent <NestDescriptor>();
                nest.Container = tr;
            }
            injectionBinder.Bind <IGrid <NestDescriptor> >().ToValue(new GridAccessor <NestDescriptor>()
            {
                Container = monoBinds.NestsGrid
            });
            injectionBinder.Bind <Cursor>().ToValue(monoBinds.Cursor);
            injectionBinder.Bind <FillingGenerator>().ToValue(monoBinds.FillGenerator);
            injectionBinder.Bind <ButtonAccessor>().ToValue(new ButtonAccessor
            {
                Button = monoBinds.RestartButton
            });
        }