コード例 #1
0
        public void playTest()
        {
            fire instance = new fire();

            instance.play();
            Assert.Fail();
        }
コード例 #2
0
        public void fireTest()
        {
            fire instance = new fire();

            instance.fireGun();
            Assert.Fail();
        }
コード例 #3
0
    //public float time2;

    // Use this for initialization
    void Start()
    {
        instance = this;
        cd       = new CDTime[2];
        cd[0]    = new CDTime(cd1);
        cd[1]    = new CDTime(cd2);
    }
コード例 #4
0
        public List <fire> GetFireList()
        {
            List <fire> lc = new List <fire>();

            string sql = "select srcUid,count(id) as b from t_user where srcUid > 0 and date(addOn) > '2017-05-01'  group by srcUid order by b desc";

            using (DataTable dt = helper.GetDataTable(sql))
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow r in dt.Rows)
                    {
                        fire o = new fire()
                        {
                            nickName = "",
                            photoUrl = "",
                            uId      = Convert.ToInt32(r["srcUid"]),
                            fireNum  = Convert.ToInt16(r["b"])
                        };
                        user u = new _User().GetUser("", "", o.uId);
                        if (u != null)
                        {
                            o.nickName = u.nickName;
                            o.contact  = u.contact;
                            o.photoUrl = u.photoUrl;
                        }
                        lc.Add(o);
                    }
                }
            }
            return(lc);
        }
コード例 #5
0
ファイル: fireWorks.cs プロジェクト: dlobser/beach
 // Use this for initialization
 void Start()
 {
     sparks = new fire[sparkAmount];
     for (int i = 0; i < sparkAmount; i++) {
         sparks[i] = new fire();
         sparks[i].ball = Instantiate(spark);
         sparks[i].Acceleration = Vector3.up;
         sparks[i].Velocity = Vector3.zero;
         sparks[i].damp = .1f;
     }
 }
コード例 #6
0
ファイル: RangeIndicator.cs プロジェクト: Axmos/SkillsUSA
    // Use this for initialization
    void Start()
    {
        myFire = GetComponentInChildren <fire>();
        speed  = myFire.speed;
        multi  = myFire.max - myFire.min;
        multi *= bullshit;
        d      = ((Mathf.Pow(multi * speed, 2f)) / Physics.gravity.y) * Mathf.Sin(90);//distance
        Vector3 indicPos = (((d / speed) * 1.3f) * transform.forward) + transform.position;

        indicator.transform.position = indicPos;
    }
コード例 #7
0
    public void Save()
    {
        // 1. Get the SaveName;
        string scenarioName = ScenarioName.text;

        // 2. Get all the existing scenes from gamemanager.
        List <GameObject> AllScenes = null;

        if (gamemanager.name == "DesignSceneGameManager")
        {
            AllScenes = gamemanager.GetComponent <DesignSceneGameManager>().AllScenes;
        }

        // 3. Create a folder named with savename.
        WorkingDirectory = Application.persistentDataPath + "/" + scenarioName;
        // If there already exists a scenario with scenarioName, replace it with the new one. Therefore,
        // users should make sure not to use the same scenario name
        if (Directory.Exists(WorkingDirectory))
        {
            Directory.Delete(WorkingDirectory, true);
        }
        Directory.CreateDirectory(WorkingDirectory);

        // 4. For each scene, do the followings
        foreach (GameObject Scene in AllScenes)
        {
            // 4.1 create a sub-folder with the scenarioName name
            WorkingDirectory = Application.persistentDataPath + "/" + scenarioName + "/" + Scene.name;
            Directory.CreateDirectory(WorkingDirectory);

            // 4.2 create a list to store all the names of the objects
            List <string> AllObjectNames = new List <string>();

            // 4.3 Fill in the class SceneDetails according to the design of the scene
            SceneDetails sceneDetails = new SceneDetails();
            sceneDetails.Walls       = new List <wall>();
            sceneDetails.Floors      = new List <floor>();
            sceneDetails.Ceilings    = new List <ceiling>();
            sceneDetails.Obstacles   = new List <obstacle>();
            sceneDetails.Doors       = new List <door>();
            sceneDetails.Fires       = new List <fire>();
            sceneDetails.Pedestrians = new List <pedestrian>();
            sceneDetails.Players     = new List <player>();
            // 4.3.1 Fill in the simulation info
            sceneDetails.SimTime = Scene.GetComponent <SceneInfo>().SimulationTime;
            sceneDetails.Width   = Scene.GetComponent <SceneInfo>().Width;
            sceneDetails.Length  = Scene.GetComponent <SceneInfo>().Length;
            sceneDetails.Height  = Scene.GetComponent <SceneInfo>().Height;
            sceneDetails.PlayerX = Scene.GetComponent <SceneInfo>().PlayerX;
            sceneDetails.PlayerY = Scene.GetComponent <SceneInfo>().PlayerY;
            // 4.3.2 fill in the info of different objects into sceneDetails
            foreach (Transform ChildObjectTransform in Scene.transform)
            {
                // Wall and its doors
                if (ChildObjectTransform.tag == "Wall")
                {
                    wall WallInfo = new wall();
                    Wall wallinfo = ChildObjectTransform.gameObject.GetComponent <Wall>();
                    AllObjectNames.Add(wallinfo.Name);
                    WallInfo.NameIndex = AllObjectNames.Count - 1;
                    WallInfo.xpos      = wallinfo.x_pos;
                    WallInfo.ypos      = wallinfo.y_pos;
                    WallInfo.zrot      = wallinfo.z_rot;
                    WallInfo.Width     = wallinfo.Width;
                    WallInfo.Height    = wallinfo.Height;
                    WallInfo.Opacity   = wallinfo.Opacity;
                    sceneDetails.Walls.Add(WallInfo);

                    // doors that are attached to it
                    foreach (Transform doorTransform in ChildObjectTransform)
                    {
                        if (doorTransform.tag == "Door")
                        {
                            door DoorInfo = new door();
                            Door doorinfo = doorTransform.gameObject.GetComponent <Door>();
                            AllObjectNames.Add(doorinfo.Name);
                            DoorInfo.NameIndex        = AllObjectNames.Count - 1;
                            DoorInfo.RelativePosition = doorinfo.RelativePosition;
                            DoorInfo.Width            = doorinfo.Width;
                            DoorInfo.Height           = doorinfo.Height;
                            if (doorinfo.Open)
                            {
                                DoorInfo.Open = 1;
                            }
                            else
                            {
                                DoorInfo.Open = 0;
                            }
                            DoorInfo.WallNameIndex = WallInfo.NameIndex;
                            AllObjectNames.Add(doorinfo.NextScene.name);
                            DoorInfo.SceneNameIndex = AllObjectNames.Count - 1;
                            sceneDetails.Doors.Add(DoorInfo);
                        }
                    }
                }
                // Floor
                else if (ChildObjectTransform.tag == "Floor")
                {
                    floor FloorInfo = new floor();
                    Floor floorinfo = ChildObjectTransform.gameObject.GetComponent <Floor>();
                    AllObjectNames.Add(floorinfo.Name);
                    FloorInfo.NameIndex = AllObjectNames.Count - 1;
                    FloorInfo.xpos      = floorinfo.x_pos;
                    FloorInfo.ypos      = floorinfo.y_pos;
                    FloorInfo.Width     = floorinfo.Width;
                    FloorInfo.Length    = floorinfo.Length;
                    sceneDetails.Floors.Add(FloorInfo);
                }
                // Ceiling
                else if (ChildObjectTransform.tag == "Ceiling")
                {
                    ceiling CeilingInfo = new ceiling();
                    Ceiling ceilinginfo = ChildObjectTransform.gameObject.GetComponent <Ceiling>();
                    AllObjectNames.Add(ceilinginfo.Name);
                    CeilingInfo.NameIndex = AllObjectNames.Count - 1;
                    CeilingInfo.xpos      = ceilinginfo.x_pos;
                    CeilingInfo.ypos      = ceilinginfo.y_pos;
                    CeilingInfo.zpos      = ceilinginfo.z_pos;
                    CeilingInfo.Width     = ceilinginfo.Width;
                    CeilingInfo.Length    = ceilinginfo.Length;
                    CeilingInfo.Opacity   = ceilinginfo.Opacity;
                    sceneDetails.Ceilings.Add(CeilingInfo);
                }
                // Obstacle
                else if (ChildObjectTransform.tag == "Obstacle")
                {
                    obstacle ObstacleInfo = new obstacle();
                    Obstacle obstacleinfo = ChildObjectTransform.gameObject.GetComponent <Obstacle>();
                    AllObjectNames.Add(obstacleinfo.Name);
                    ObstacleInfo.NameIndex = AllObjectNames.Count - 1;
                    ObstacleInfo.xpos      = obstacleinfo.x_pos;
                    ObstacleInfo.ypos      = obstacleinfo.y_pos;
                    ObstacleInfo.Width     = obstacleinfo.Width;
                    ObstacleInfo.Length    = obstacleinfo.Length;
                    ObstacleInfo.Height    = obstacleinfo.Height;
                    ObstacleInfo.Opacity   = obstacleinfo.Opacity;
                    sceneDetails.Obstacles.Add(ObstacleInfo);
                }
                // Fire
                else if (ChildObjectTransform.tag == "Fire")
                {
                    fire FireInfo = new fire();
                    Fire fireinfo = ChildObjectTransform.gameObject.GetComponent <Fire>();
                    AllObjectNames.Add(fireinfo.Name);
                    FireInfo.NameIndex  = AllObjectNames.Count - 1;
                    FireInfo.xpos       = fireinfo.x_pos;
                    FireInfo.ypos       = fireinfo.y_pos;
                    FireInfo.zpos       = fireinfo.z_pos;
                    FireInfo.Width      = fireinfo.Width;
                    FireInfo.Length     = fireinfo.Length;
                    FireInfo.HRRPUA     = fireinfo.HRRPUA;
                    FireInfo.CO_YIELD   = fireinfo.CO_YIELD;
                    FireInfo.SOOT_YIELD = fireinfo.SOOT_YIELD;
                    FireInfo.Fuel       = Array.IndexOf(fireinfo.Fuels,
                                                        fireinfo.FUEL);
                    sceneDetails.Fires.Add(FireInfo);
                }
                // Pedestrian
                else if (ChildObjectTransform.tag == "Pedestrian")
                {
                    pedestrian PedestrianInfo = new pedestrian();
                    Pedestrian pedestrianinfo = ChildObjectTransform.gameObject.GetComponent <Pedestrian>();
                    AllObjectNames.Add(pedestrianinfo.Name);
                    PedestrianInfo.NameIndex = AllObjectNames.Count - 1;
                    PedestrianInfo.xpos      = pedestrianinfo.x_pos;
                    PedestrianInfo.ypos      = pedestrianinfo.y_pos;
                    PedestrianInfo.Speed     = pedestrianinfo.Speed;
                    PedestrianInfo.Health    = pedestrianinfo.Health;
                    AllObjectNames.Add(pedestrianinfo.Exit.name);
                    PedestrianInfo.ExitNameIndex = AllObjectNames.Count - 1;
                    sceneDetails.Pedestrians.Add(PedestrianInfo);
                }
                else if (ChildObjectTransform.tag == "Player")
                {
                    player PlayerInfo = new player();
                    Player playerinfo = ChildObjectTransform.gameObject.GetComponent <Player>();
                    AllObjectNames.Add(playerinfo.Name);
                    PlayerInfo.NameIndex = AllObjectNames.Count - 1;
                    PlayerInfo.xpos      = playerinfo.x_pos;
                    PlayerInfo.ypos      = playerinfo.y_pos;
                    PlayerInfo.Speed     = playerinfo.Speed;
                    PlayerInfo.Health    = playerinfo.Health;
                    sceneDetails.Players.Add(PlayerInfo);
                }
            }

            // 4.4 Save AllObjectNames into a text file
            StreamWriter NamesTxtFile = new StreamWriter(WorkingDirectory + "/AllNames.txt");
            foreach (string name in AllObjectNames)
            {
                NamesTxtFile.WriteLine(name);
            }
            NamesTxtFile.Close();

            // 4.5 Save sceneDetails into a binary file, SceneDetails.dat
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(WorkingDirectory + "/SceneDetails.dat", FileMode.OpenOrCreate);
            bf.Serialize(file, sceneDetails);
            file.Close();
        }
    }
コード例 #8
0
ファイル: fireTests.cs プロジェクト: Raman227/FireGame
 public void frstchanceTest()
 {
     fire obj = new fire();
 }
コード例 #9
0
 void Start()
 {
     fire1 = GetComponent <fire>();
 }
コード例 #10
0
 public void genNoTest()
 {
     fire obj = new fire();
 }