unit FragmentShader(VertexOut vertex, Field <unit> Units, Field <data> Data, PlayerTuple Teams) { unit unit_here = Units[Here]; data data_here = Data[Here]; if (!Something(data_here) && unit_here.player == Player.None) { return(unit_here); } unit_here.team = GetPlayerVal(Teams, unit_here.player); return(unit_here); }
PlayerTuple FragmentShader(VertexOut vertex, Field <PlayerTuple> Necromancy, Field <data> Data, Field <unit> Units) { data data_here = Data[Here]; unit unit_here = Units[Here]; PlayerTuple right = Necromancy[RightOne], up = Necromancy[UpOne], left = Necromancy[LeftOne], down = Necromancy[DownOne]; PlayerTuple necromancy = max(right, up, left, down) - vec(_1, _1, _1, _1); if (unit_here.type == UnitType.Necromancer) { SetPlayerVal(ref necromancy, unit_here.player, NecromancyRange); } return(necromancy); }
PlayerTuple FragmentShader(VertexOut vertex, Field <PlayerTuple> Path, Field <data> Data, Field <unit> Units) { data data_here = Data[Here]; unit unit_here = Units[Here]; PlayerTuple right = Path[RightOne], up = Path[UpOne], left = Path[LeftOne], down = Path[DownOne]; PlayerTuple distance_to = min(right, up, left, down) + vec(_1, _1, _1, _1); if (Something(data_here)) { SetPlayerVal(ref distance_to, unit_here.player, _0); } return(distance_to); }
magic FragmentShader(VertexOut vertex, Field <magic> Magic, Field <data> CurrentData, Field <data> PreviousData, Field <corpse> Corpses, Field <PlayerTuple> Necromancy) { magic here = Magic[Here]; corpse corpse_here = Corpses[Here]; PlayerTuple necromancy = Necromancy[Here]; data cur_data = CurrentData[Here], prev_data = PreviousData[Here]; // Reset the kill bit here.kill = _false; here.raising_player = Player.None; // Check for resurrection if (CorpsePresent(corpse_here) && !Something(cur_data) && !Something(prev_data)) { float player = Player.None; float necro = _0; if (necromancy.PlayerOne > necro) { necro = necromancy.PlayerOne; player = Player.One; } if (necromancy.PlayerTwo > necro) { necro = necromancy.PlayerTwo; player = Player.Two; } if (necromancy.PlayerThree > necro) { necro = necromancy.PlayerThree; player = Player.Three; } if (necromancy.PlayerFour > necro) { necro = necromancy.PlayerFour; player = Player.Four; } here.raising_player = player; } return(here); }
public static void SetPlayerVal(ref PlayerTuple tuple, int player, float value) { if (player == 1) { tuple.PlayerOne = value; } if (player == 2) { tuple.PlayerTwo = value; } if (player == 3) { tuple.PlayerThree = value; } if (player == 4) { tuple.PlayerFour = value; } throw new BadPlayerNumberException(player); }
public static void SetPlayerVal(ref PlayerTuple tuple, float player, float value) { if (player == Player.One) { tuple.PlayerOne = value; } if (player == Player.Two) { tuple.PlayerTwo = value; } if (player == Player.Three) { tuple.PlayerThree = value; } if (player == Player.Four) { tuple.PlayerFour = value; } throw new BadPlayerNumberException(player); }
public static float GetPlayerVal(PlayerTuple tuple, int player) { if (player == 1) { return(tuple.PlayerOne); } if (player == 2) { return(tuple.PlayerTwo); } if (player == 3) { return(tuple.PlayerThree); } if (player == 4) { return(tuple.PlayerFour); } //throw new BadPlayerNumberException(player); return(0); }
public static float GetPlayerVal(PlayerTuple tuple, float player) { if (player == Player.One) { return(tuple.PlayerOne); } if (player == Player.Two) { return(tuple.PlayerTwo); } if (player == Player.Three) { return(tuple.PlayerThree); } if (player == Player.Four) { return(tuple.PlayerFour); } throw new BadPlayerNumberException(player); return(0); }
unit FragmentShader(VertexOut vertex, Field <unit> Unit, Field <data> Data, Field <magic> Magic, PlayerTuple Teams) { data data_here = Data[Here]; unit unit_here = Unit[Here]; magic magic_here = Magic[Here]; if (Something(data_here)) { if (data_here.action == UnitAction.Spawning) { unit barracks = Unit[dir_to_vec(Reverse(data_here.direction))]; unit_here.player = barracks.player; unit_here.team = barracks.team; unit_here.type = UnitType.Footman; unit_here.anim = Anim.Stand; } if (data_here.action == UnitAction.Raising) { unit_here.player = magic_here.raising_player; unit_here.team = GetPlayerVal(Teams, magic_here.raising_player); unit_here.type = UnitType.Skeleton; unit_here.anim = Anim.StartRaise; } } return(unit_here); }