コード例 #1
0
    void ChangeElement(int index, int newType)
    {
        var p = powders[index];

        PowderSystemUtils.SchdeduleRemovePowder(ref toDeleteEntities, index);
        PowderGame.Spawn(ref cmdBuffer, p.coord.x, p.coord.y, newType);
    }
コード例 #2
0
 void Lava(ref Powder p, ref Neighbors n)
 {
     if (!n.BottomEmpty() &&
         powders[n.Bottom()].type != PowderTypes.Fire &&
         powders[n.Bottom()].type != PowderTypes.Lava &&
         powders[n.Bottom()].type != PowderTypes.Stone
         )
     {
         PowderSystemUtils.SchdeduleRemovePowder(ref toDeleteEntities, n.Bottom());
     }
 }
コード例 #3
0
 void AcidTouch(int index)
 {
     if (powders[index].type != PowderTypes.Acid &&
         powders[index].type != PowderTypes.Fire &&
         powders[index].type != PowderTypes.Water &&
         powders[index].type != PowderTypes.Glass &&
         powders[index].type != PowderTypes.Lava
         )
     {
         PowderSystemUtils.SchdeduleRemovePowder(ref toDeleteEntities, index);
     }
 }
コード例 #4
0
 void Water(ref Powder p, ref Neighbors n)
 {
     if (!n.BottomEmpty())
     {
         if (powders[n.Bottom()].type == PowderTypes.Fire || powders[n.Bottom()].type == PowderTypes.Steam)
         {
             PowderSystemUtils.SchdeduleRemovePowder(ref toDeleteEntities, n.Bottom());
         }
         else if (powders[n.Bottom()].type == PowderTypes.Lava)
         {
             ChangeElement(n.index, PowderTypes.Steam);
         }
     }
 }
コード例 #5
0
    Powder Simulate(Powder p, int index)
    {
        if (p.life == 0 || p.coord.x < 0 || p.coord.x > PowderGame.width || p.coord.y < 0 || p.coord.y > PowderGame.height)
        {
            PowderSystemUtils.SchdeduleRemovePowder(ref toDeleteEntities, index);
            return(p);
        }

        if (p.life != -1)
        {
            p.life--;
        }

        var n = new Neighbors(ref hashMap, p, index);

        SimulateState(ref p, ref n);

        switch (p.type)
        {
        case PowderTypes.Acid:
            Acid(ref p, ref n);
            break;

        case PowderTypes.Fire:
            Fire(ref p, ref n);
            break;

        case PowderTypes.Steam:
            Steam(ref p, ref n);
            break;

        case PowderTypes.Water:
            Water(ref p, ref n);
            break;

        case PowderTypes.Lava:
            Lava(ref p, ref n);
            break;

        default:
            if (PowderTypes.values[p.type].IsGenerator())
            {
                Generate(ref p, ref n);
            }
            break;
        }
        return(p);
    }