Beispiel #1
0
        public ActionCount DoActionCount(World world)
        {
            CountMovingAttackingDyingExploding.Using(CurrentData, CurrentUnits, Output: Multigrid[0]);

            world.DrawVisibleGrid(scale: 1.5f);

            ActionCount count = (ActionCount)MultigridReduce(CountReduce_4x1byte.Apply);

            //Console.WriteLine("moving: {0}, attacking: {1}, dying: {2}, exploding: {3})", count.UnitsMoving, count.UnitsAttacking, count.UnitsDying, count.BuildingsExploding);

            return(count);
        }
Beispiel #2
0
        ActionCount FragmentShader(VertexOut vertex, Field <data> Data, Field <unit> Units)
        {
            data data_here = Data[Here];
            unit unit_here = Units[Here];

            ActionCount output = ActionCount.Nothing;

            if (Something(data_here) && IsUnit(unit_here))
            {
                output.UnitsMoving    = data_here.change == Change.Moved ? _1 : _0;
                output.UnitsAttacking = unit_here.anim == Anim.Attack ? _1 : _0;
                output.UnitsDying     = unit_here.anim == Anim.Die ? _1 : _0;
            }

            if (Something(data_here) && IsBuilding(unit_here))
            {
                output.BuildingsExploding = data_here.direction == Dir.StationaryDying ? _1 : _0;
            }

            return(output);
        }