Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     Rate               = 1;
     Count              = 0;
     SceneObj           = GameObject.FindObjectOfType <SceneController>();
     FadeObj            = SceneObj.transform.Find("FadeCanvas").GetComponent <FadeController>();
     Cannons            = GameObject.Find("ColdSleepCannons(Clone)");
     Cursors            = GameObject.Find("Cursors(Clone)");
     FadeFlg            = false;
     g_UI               = GameObject.Find("GameUI");
     _slider_Background = g_UI.transform.GetChild(0).transform.GetChild(4).transform.GetChild(0).gameObject;
     _slider_Fillarea   = g_UI.transform.GetChild(0).transform.GetChild(4).transform.GetChild(1).gameObject;
     _sliderText1       = g_UI.transform.GetChild(0).transform.GetChild(4).transform.GetChild(2).gameObject;
     _sliderText2       = g_UI.transform.GetChild(0).transform.GetChild(4).transform.GetChild(3).gameObject;
     _slider_Handle     = g_UI.transform.GetChild(0).transform.GetChild(4).transform.GetChild(4).gameObject;
     S_timer            = GameObject.FindObjectOfType <StartTimer>();
     VanishGroundFlg    = false;
     PerformanceGround  = GameObject.Find("PerformanceGround");
     ParentGround1      = GameObject.Find("PerfomanceObj01");
     ParentGround2      = GameObject.Find("PerfomanceObj02");
     ParentGround3      = GameObject.Find("PerfomanceObj03");
     VanishGround       = PerformanceGround.GetComponent <VanishWall>();
     VanishParent1      = ParentGround1.GetComponent <VanishWall>();
     VanishParent2      = ParentGround2.GetComponent <VanishWall>();
     VanishParent3      = ParentGround3.GetComponent <VanishWall>();
     LookTarget         = GameObject.Find("LookTarget");
 }
Ejemplo n.º 2
0
        // Create object in room upon user click
        private void MakeSpaceObject(string texName, Image tex, DrawPoint mp)
        {
            texName = texName.Replace(".png", "");

            int numberOfFrames = SpaceObject.GetNumberOfFrames(texName);

            //Much repeated code to account for each possible object
            if (rb_WallStatic.Checked)
            {
                mp.X -= (texture.Width / (numberOfFrames * 2));
                mp.Y -= (texture.Height / 2);

                WallStatic wall = new WallStatic(
                    Conversion.DrawPointToVector2(mp),
                    currdir + "\\" + texName + ".tri");

                wall.TextureName = texName;

                currentlySelectedRoom.AddObject(wall);
            }
            else if (rb_WallDynamic.Checked)
            {
                mp.X -= (texture.Width / (numberOfFrames * 2));
                mp.Y -= (texture.Height / 2);

                WallDynamic wall = new WallDynamic(
                    Conversion.DrawPointToVector2(mp),
                    new Vector2(0, 0),
                    currdir + "\\" + texName + ".tri");

                wall.TextureName = texName;

                currentlySelectedRoom.AddObject(wall);
            }
            else if (rb_HazardStatic.Checked)
            {
                mp.X -= (texture.Width / (numberOfFrames * 2));
                mp.Y -= (texture.Height / 2);

                HazardStatic hazard = new HazardStatic(
                    Conversion.DrawPointToVector2(mp),
                    currdir + "\\" + texName + ".tri");

                hazard.TextureName = texName;

                currentlySelectedRoom.AddObject(hazard);
            }

            else if (rb_HazardDynamic.Checked)
            {
                mp.X -= (texture.Width / (numberOfFrames * 2));
                mp.Y -= (texture.Height / 2);

                HazardDynamic hazard = new HazardDynamic(
                    Conversion.DrawPointToVector2(mp),
                    new Vector2(0, 0),
                    currdir + "\\" + texName + ".tri");

                hazard.TextureName = texName;

                currentlySelectedRoom.AddObject(hazard);
            }

            else if (rb_Parts.Checked)
            {
                mp.X -= (texture.Width / (numberOfFrames * 2));
                mp.Y -= (texture.Height / 2);

                Part part = new Part(
                    Conversion.DrawPointToVector2(mp),
                    currdir + "\\" + texName + ".tri");

                part.TextureName = texName;

                currentlySelectedRoom.AddObject(part);
            }

            else if (rb_Survivors.Checked)
            {
                mp.X -= (texture.Width / (numberOfFrames * 2));
                mp.Y -= (texture.Height / 2);

                Survivor survivor = new Survivor(
                    Conversion.DrawPointToVector2(mp),
                    currdir + "\\" + texName + ".tri");

                survivor.TextureName = texName;

                //sets up the survivor color as appropriate
                switch (survivor.TextureName)
                {
                    case "Art\\Survivors\\SurvivorBlue":
                        survivor.SColor = Survivor.survivorColor.BLUE;
                        break;

                    case "Art\\Survivors\\SurvivorRed":
                        survivor.SColor = Survivor.survivorColor.RED;
                        break;

                    case "Art\\Survivors\\SurvivorYellow":
                        survivor.SColor = Survivor.survivorColor.YELLOW;
                        break;

                    case "Art\\Survivors\\SurvivorPurple":
                        survivor.SColor = Survivor.survivorColor.PURPLE;
                        break;

                    case "Art\\Survivors\\SurvivorOrange":
                        survivor.SColor = Survivor.survivorColor.ORANGE;
                        break;

                    case "Art\\Survivors\\Survivor":
                        survivor.SColor = Survivor.survivorColor.GREEN;
                        break;

                    default:
                        break;

                }

                currentlySelectedRoom.AddObject(survivor);
            }

            else if (rb_Vanish_Walls.Checked)
            {
                mp.X -= (texture.Width / (numberOfFrames * 2));
                mp.Y -= (texture.Height / 2);

                VanishWall vanish = new VanishWall(
                    Conversion.DrawPointToVector2(mp),
                    currdir + "\\" + texName + ".tri");

                vanish.TextureName = texName;

                currentlySelectedRoom.AddObject(vanish);
            }

            else if (rb_Handlebars.Checked)
            {
                mp.X -= (texture.Width / 2);
                mp.Y -= (texture.Height / 2);

                Handlebar hdlbar = new Handlebar(
                    Conversion.DrawPointToVector2(mp),
                    new Vector2(0, 0),
                    currdir + "\\" + texName + ".tri");

                hdlbar.TextureName = texName;

                currentlySelectedRoom.AddObject(hdlbar);
            }

            else if (rb_VictoryTest.Checked)
            {
                mp.X -= (texture.Width / 2);
                mp.Y -= (texture.Height / 2);

                VictoryTest victest = new VictoryTest(
                    Conversion.DrawPointToVector2(mp),
                    currdir + "\\" + texName + ".tri");

                victest.TextureName = texName;

                currentlySelectedRoom.AddObject(victest);
            }

            else if (rb_SavePoint.Checked)
            {
                mp.X -= (texture.Width / (numberOfFrames * 2));
                mp.Y -= (texture.Height / 2);

                SavePoint savePoint = new SavePoint(
                    Conversion.DrawPointToVector2(mp),
                    currdir + "\\" + texName + ".tri");

                savePoint.TextureName = texName;

                currentlySelectedRoom.AddObject(savePoint);
            }

            else if (rb_Player.Checked)
            {
                mp.X -= (int)((texture.Width * Constants.PLAYER_SCALE) / 2);
                mp.Y -= (int)((texture.Height * Constants.PLAYER_SCALE) / 2);

                world.player = new Player(
                    Conversion.DrawPointToVector2(mp),
                    currdir + "\\" + texName + ".tri"
                    );

                world.CurrentRoom = currentlySelectedRoom;
                world.player.TextureName = texName;
            }
        }