public void StartFire()
 {
     if (!containedRoom.IsOnFire)
     {
         containedRoom.StartFire();
     }
 }
Esempio n. 2
0
    private void Update()
    {
        if (afterBurnTimer > 0)
        {
            afterBurnTimer -= Time.deltaTime;
        }

        if (!isOnFire)
        {
            return;
        }
        if (fireLifeTimer > 0)
        {
            fireLifeTimer -= Time.deltaTime;
            StepFireForwards();
        }
        else if (burningTris.Count > 0)
        {
            for (int i = 0; i < 3; i++)
            {
                tris[removedTriangles * 3 + i] = 0;
            }
            removedTriangles++;
            availableDoorTriangles.Remove(burningTris[0]);
            burningTris.RemoveAt(0);
            if (burningTris.Count == 0)
            {
                particleSystem.Stop();
                smokeParticleSystem.Stop();
                mesh.triangles = tris;
                var sh = particleSystem.shape;
                sh.shapeType = ParticleSystemShapeType.Sphere;
                sh           = smokeParticleSystem.shape;
                sh.shapeType = ParticleSystemShapeType.Sphere;
                burningTris.Clear();
                removedTriangles = 0;
                isOnFire         = false;
                afterBurnTimer   = afterBurnTime;
            }
            else
            {
                mesh.triangles = tris;
                var sh = particleSystem.shape;
                sh.mesh = mesh;
                sh      = smokeParticleSystem.shape;
                sh.mesh = mesh;
            }
        }
        if (availableDoorTriangles.Count > 0)
        {
            for (int i = 0; i < availableDoorTriangles.Count; i++)
            {
                for (int j = 0; j < availableDoorTriangles[i].connectedEntranceIDs.Length; j++)
                {
                    NavMeshEntrance selectedEntrance = room.GetEntrance(availableDoorTriangles[i].connectedEntranceIDs[j]);
                    if (selectedEntrance.connectedEntrance != null && selectedEntrance.IsPassable)
                    {
                        RoomInformation nextRoom = room.GetConnectedRoomFromEntranceWithID(selectedEntrance.ID);
                        if (nextRoom)
                        {
                            nextRoom.StartFire(selectedEntrance.connectedEntrance.connectedTriangle.ID);
                        }
                    }
                }
            }
        }
    }