示例#1
0
    void Awake()
    {
        fireSim   = Terrain.activeTerrain.GetComponent <FireSimulation>();
        fireCache = new List <IFlamable>();
        pos       = new Vector2(transform.position.x, transform.position.z);


        fireSim.AddFire(this);
        enabled = false;
    }
示例#2
0
    public void SetFlameState(FlameState state)
    {
        if (state == flameState)
        {
            return;
        }
        switch (state)
        {
        case FlameState.NONE:
            ResetFire();
            break;

        case FlameState.HEATING:
            SetHeating();
            break;

        case FlameState.BURNED_OUT:
            SetBurnedOut();
            break;

        case FlameState.BURNING:
            SetBurning();
            fireSim.AddFire(this);
            break;

        case FlameState.COOLING:
            SetCooling();
            break;

        default:
            break;
        }
        if (flameState == FlameState.BURNING && state != FlameState.BURNING)
        {
            fireSim.RemoveFire(this);
        }
        flameState = state;
    }