예제 #1
0
    public float AddFluidToTile(Tile t, float Add, Fluid.FluidType type)
    {
        if (type == Fluid.FluidType.Lava && t.GetFluidLevel() == 0)
        {
            if (WorldController.GetWorldController._soundManager.SpawnLavaSource(t.transform.position))
            {
                Instantiate(StaticMapInfo.RockModleHolder.LavaSound, new Vector3(t.transform.position.x, t.transform.position.y, t.transform.position.z), new Quaternion(0, 0, 0, 0));
            }
        }
        if (t._IsSourceBlock)
        {
            return(0.0f);
        }
        float level = t.GetFluidLevel() + Add;

        if (type == Fluid.FluidType.Lava && t.CurrentFluidType == Fluid.FluidType.Water)
        {
            //this is a water cell with lava being added.
            level = Add;
            type  = Fluid.FluidType.Lava;
            Particles.NotifyFluidInteraction(t.gameObject.transform.position, 1.0f);
        }
        else if (type == Fluid.FluidType.Water && t.CurrentFluidType == Fluid.FluidType.Lava)
        {
            //this is a lava cell with water being added.
            level = t.GetFluidLevel();
            type  = Fluid.FluidType.Lava;
            Particles.NotifyFluidInteraction(t.gameObject.transform.position, 1.0f);
        }
        t.SetFluidLevel(level, type);
        return(level);
    }
예제 #2
0
    public float RemoveFluidFromCell(int x, int y, float amt, Fluid.FluidType type)
    {
        Tile t = _TileMap.GetTileAtPos(x, y);

        if (t != null)
        {
            if (t.CurrentFluidType != type)
            {
                return(0.0f);
            }
            float RemovedAmt = Mathf.Min(amt, t.GetFluidLevel());
            AddFluidToTile(t, -RemovedAmt, type);
            return(RemovedAmt);
        }
        return(0.0f);
    }
예제 #3
0
 public Fluid GetFluid(Fluid.FluidType type)
 {
     return(_FluidDefinitions[(int)type]);
 }