Exemplo n.º 1
0
    void Start()
    {
        circleList   = new List <Circle>();
        circleSprite = Resources.Load("circle") as GameObject;
        playerSprite = Resources.Load("player") as GameObject;
        player       = new Player(Instantiate(playerSprite).transform);

        //获得地图的宽高
        Camera camera           = Camera.main;
        float  orthographicSize = camera.orthographicSize;
        float  aspectRatio      = Screen.width * 1.0f / Screen.height;

        mapHeight_half = orthographicSize;
        mapWidth_half  = mapHeight_half * aspectRatio;

        //获取星球数据
        Data data = new Data();

        StarDatas = data.Read();

        Init();
        player.SetCircle(circleList.First());

        backGround = new BackGround(mapHeight_half * 2);
    }
Exemplo n.º 2
0
        private void init(bool fullRegen = false)
        {
            Vector3 min = new Vector3(0, Constants.HUD_OFFSET, 0f);
            Vector3 max = new Vector3(Constants.RESOLUTION_X, Constants.RESOLUTION_Y, 0f);

            this.boundary = new BoundingBox(min, max);
            this.rand     = new Random();
            PositionGenerator.getInstance().init(this.rand);
            SpawnGenerator.getInstance().SpawnRequests.Clear();
            if (StateManager.getInstance().GameMode == GameMode.OnePlayer)
            {
                this.playerOne = new Snake(this.content, Constants.HEADING_UP, 0f, ConfigurationManager.getInstance().PlayerOnesControls);
            }
            else
            {
                this.playerOne = new Snake(this.content, Constants.HEADING_UP, 100f, ConfigurationManager.getInstance().PlayerOnesControls);
                this.playerTwo = new Snake(this.content, Constants.HEADING_UP, -100f, ConfigurationManager.getInstance().PlayerTwosControls);
            }

            if (fullRegen)
            {
                this.backGround  = new BackGround(this.content);
                this.hud         = new HUD(this.content);
                this.foodManager = new FoodManager(content, this.rand);
                this.portals     = new PortalManager(content, this.rand);
                this.walls       = new WallManager(content, this.rand);
            }

#if DEBUG
            this.debugLine = LoadingUtils.load <Texture2D>(this.content, "Chip");
#endif
        }
        public override string ToString()
        {
            g = (BackGround)base.Tag;

            Binding myBinding = new Binding("filename");
            myBinding.Mode = BindingMode.TwoWay;
            myBinding.Source = g;
            cmbfilename.SetBinding(ComboBox.TextProperty, myBinding);

            Binding myBinding2 = new Binding("options");
            myBinding2.Mode = BindingMode.TwoWay;
            myBinding2.Source = g;
            txtopt.SetBinding(TextBox.TextProperty, myBinding2);

            Binding myBinding3 = new Binding("langoverride");
            myBinding3.Mode = BindingMode.TwoWay;
            myBinding3.Source = g;
            txtlang.SetBinding(ComboBox.TextProperty, myBinding3);


            Binding myBinding4 = new Binding("context");
            myBinding4.Mode = BindingMode.TwoWay;
            myBinding4.Source = g;
            txtcontext.SetBinding(TextBox.TextProperty, myBinding4);


            return base.ToString();
        }
Exemplo n.º 4
0
    //コンストラクタ
    public SceneController(TalkController gc)
    {
        //GameControllerへのインスタンス作成
        this.gc = gc;

        //GUIManagerインスタンス作成
        guiManager = GameObject.Find("GUI").GetComponent <GUIManager>();

        //SceneHolderは初期化と共にtxtを
        //#scene=001のような記述ごとにScene型のリストに変換して保持しておく
        string scenarioPath = "ScenarioData/scenarios";

        sceneHolder = new SceneHolder(scenarioPath);

        sceneReader = new SceneReader(this);

        background = GameObject.Find("BackGround").GetComponent <BackGround>();
        background.Init();

        fadeInOutManager = GameObject.Find("FadeInOut").GetComponent <FadeInOutManager>();
        fadeInOutManager.FadeinStart();

        //DoTween
        textSeq.Complete();
    }
Exemplo n.º 5
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);

            graphics.PreferredBackBufferWidth  = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;

            ScreenRectangle = new Rectangle(
                0,
                0,
                screenWidth,
                screenHeight);

            Content.RootDirectory = "Content";

            Components.Add(new InputHandler(this));

            stateManager = new GameStateManager(this);
            Components.Add(stateManager);

            backGround = new BackGround(this, stateManager);
            //startMenuScreen = new GameScreens.StartMenuScreen(this, stateManager);
            startMenuScreen = new StartMenuScreens(this, stateManager);

            stateManager.ChangeState(backGround);
        }
Exemplo n.º 6
0
        public override string ToString()
        {
            g = (BackGround)base.Tag;

            Binding myBinding = new Binding("filename");

            myBinding.Mode   = BindingMode.TwoWay;
            myBinding.Source = g;
            cmbfilename.SetBinding(ComboBox.TextProperty, myBinding);

            Binding myBinding2 = new Binding("options");

            myBinding2.Mode   = BindingMode.TwoWay;
            myBinding2.Source = g;
            txtopt.SetBinding(TextBox.TextProperty, myBinding2);

            Binding myBinding3 = new Binding("langoverride");

            myBinding3.Mode   = BindingMode.TwoWay;
            myBinding3.Source = g;
            txtlang.SetBinding(ComboBox.TextProperty, myBinding3);


            Binding myBinding4 = new Binding("context");

            myBinding4.Mode   = BindingMode.TwoWay;
            myBinding4.Source = g;
            txtcontext.SetBinding(TextBox.TextProperty, myBinding4);


            return(base.ToString());
        }
Exemplo n.º 7
0
        public SceneManager(Game game)
            : base(game)
        {
            this.game = game;

            floorEffect = Game.Content.Load <Effect>("effects");
            player      = Game.Content.Load <PlayerData>("Configuration/PlayerData");
            tankmode    = Game.Content.Load <Mode[]>(@"Configuration/TankMode");
            world       = Game.Content.Load <WorldMatrix>("Configuration/WorldData");
            tankStatus  = new TankStatusMode(tankmode[0]);


            city             = new City();
            background       = new BackGround(game);
            inputHandler     = new InputHandler();
            textHandler      = new TextHandler();
            levelHander      = new GameLevelHandler(Game.Content);
            explosionHandler = new ExplosionHandler(game);
            gameMenu         = new GameMenuScreen(game, levelHander);
            worldData        = new GameWorldData(world);
            camera           = new FirstPersonCamera(game);
            background.InitializeModel(floorEffect);

            camera.prepareCamera();
            camera.setWeapon(Game.Content.Load <Model>(@"Models\weapon"));
        }
Exemplo n.º 8
0
        public static void Main(string[] args)
        {
            Ship PlayerShip = new Ship();

            //char[,] BackGroundMap = new char[28,25];
            //foreach(char s in BackGroundMap)
            //{
            //      Console.Write("C");
            //}
            //Console.Read();
            {
                string choice = Game.PlayerChoice(ref PlayerShip);

                Console.WriteLine("You chose " + choice + ", Now, on to naming it!, please input your ship's chosen name");
            }
            PlayerShip.Name = Console.ReadLine();
            Console.WriteLine("Great!, I wish you good luck in the battls to come!");
            Console.Read();
            Console.Clear();
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.White;
            BackGround backGround = new BackGround();
            backGround.Populate();
            backGround.Display();
            Console.Read();
        }
Exemplo n.º 9
0
    public void RnadomElement()
    {
        int totalRate = 0;
        int random    = UnityEngine.Random.Range(0, 101);

        // 属性を決める
        BackGround backGround = gameObject.transform.parent.GetComponent <BackGround>();

        for (int i = 0; i < backGround.elementsSprite.Length; i++)
        {
            if (((totalRate + backGround.elementsSprite[i].rate) >= random) && (random >= totalRate))
            {
                elementInfo = backGround.elementsSprite[i];
                break;
            }
            totalRate += backGround.elementsSprite[i].rate;
        }
        // 画像を決める
        if (elementInfo != null)
        {
            random = UnityEngine.Random.Range(0, elementInfo.sprite.Length);
            if (elementInfo.sprite[random])
            {
                gameObject.GetComponent <SpriteRenderer>().sprite = elementInfo.sprite[random];
                elements = elementInfo.elements;
            }
        }
    }
Exemplo n.º 10
0
    void Start()
    {
#if !UNITY_EDITOR
        //in editor
        if (MapEditor.MapEditorConfig.CurrentMapGameMode == MapGameMode.Normal)
        {
            GameObject.DestroyImmediate(_panel);
        }
        else if (MapEditor.MapEditorConfig.CurrentMapGameMode == MapGameMode.Parkour)
        {
            main_camera = Camera.main;
            obj_MapEdge = GameObject.Find("MapEdge").gameObject;
            background  = GameObject.FindObjectOfType <BackGround>();
        }
#else
        //in editor
        if (MapEditor.MapEditorConfig.CurrentMapGameMode == MapGameMode.Normal)
        {
            GameObject.DestroyImmediate(_panel);
        }
        else if (MapEditor.MapEditorConfig.CurrentMapGameMode == MapGameMode.Parkour)
        {
            main_camera = Camera.main;
            obj_MapEdge = GameObject.Find("MapEdge").gameObject;
            background  = GameObject.FindObjectOfType <BackGround>();
        }
#endif
    }
Exemplo n.º 11
0
    void Start()
    {
        backGround = GameObject.Find("BackGround").GetComponent <BackGround>();
        anim       = GetComponent <Animator>();

        rig = GetComponent <Rigidbody2D>();
    }
Exemplo n.º 12
0
    public void NextStage()
    {
        switch (BackGround.GetStageNum())
        {
        case 1:
            SceneManager.LoadScene("Stage2");
            break;

        case 2:
            SceneManager.LoadScene("Stage3");
            break;

        case 3:
            SceneManager.LoadScene("Stage4");
            break;

        case 4:
            SceneManager.LoadScene("Stage5");
            break;

        case 5:
            SceneManager.LoadScene("Stage6");
            break;

        case 6:
            SceneManager.LoadScene("Stage7");
            break;

        case 7:
            SceneManager.LoadScene("Stage8");
            break;
        }
    }
Exemplo n.º 13
0
    //  ScriptableObjectのマップデータの読み込み
    private void ImportMapData()
    {
        string fullPath = EditorUtility.OpenFilePanel("マップデータの選択", ASSET_PATH, "asset");

        // パスが入っていれば選択されたということ(キャンセルされたら入ってこない)
        if (!string.IsNullOrEmpty(fullPath))
        {
            //  フルパスから相対パスへ
            string path = "Assets" + fullPath.Substring(Application.dataPath.Length);
            //  パスからデータを取得
            MapData data = AssetDatabase.LoadAssetAtPath <MapData>(path);

            if (data == null)
            {
                Debug.Log("Dataの読み込みエラー");
            }

            //  値の代入
            for (int i = 0; i < data.mapDate.Length; i++)
            {
                for (int j = 0; j < data.mapDate.Length; j++)
                {
                    mapData[i, j]     = data.mapDate[i].mapNum[j];
                    gimmickData[i, j] = data.gimmickDate[i].mapNum[j];
                    enemyData[i, j]   = data.enemyDate[i].mapNum[j];
                }
            }
            backGround = (BackGround)data.backGroundNum;
        }
    }
Exemplo n.º 14
0
 //  グリッドの初期化
 private void ResetMapData()
 {
     mapData     = new int[gridNum, gridNum];
     gimmickData = new int[gridNum, gridNum];
     enemyData   = new int[gridNum, gridNum];
     backGround  = BackGround.NONE;
 }
Exemplo n.º 15
0
        /// <summary>
        /// Render the FormulaBack
        /// </summary>
        /// <param name="g">Graphics to render</param>
        /// <param name="R">Rectangle</param>
        public void Render(Graphics g, Rectangle R)
        {
            g.FillRectangle(BackGround.GetBrush(), R);
            R.Width--;
            R.Height--;

            int w = (int)(LeftPen.Width - 1);

            if (w >= 0)
            {
                g.DrawLine(LeftPen.GetPen(), R.Left + w, R.Top, R.Left + w, R.Bottom);
            }

            w = (int)(TopPen.Width - 1);
            if (w >= 0)
            {
                g.DrawLine(TopPen.GetPen(), R.Left, R.Top + w, R.Right, R.Top + w);
            }

            w = (int)(RightPen.Width - 1);
            if (w >= 0)
            {
                g.DrawLine(RightPen.GetPen(), R.Right, R.Top, R.Right, R.Bottom);
            }

            w = (int)(BottomPen.Width - 1);
            if (w >= 0)
            {
                g.DrawLine(BottomPen.GetPen(), R.Left, R.Bottom, R.Right, R.Bottom);
            }
        }
Exemplo n.º 16
0
 void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     //DontDestroyOnLoad(gameObject);
 }
Exemplo n.º 17
0
 // Use this for initialization
 void Start()
 {
     //item = GameObject.FindGameObjectWithTag("item_Change").GetComponent<item_Change>();
     Itemget = GameObject.FindGameObjectWithTag("Background").GetComponent <BackGround>();
     //au = GetComponent<AudioSource>();
     //playera = GameObject.FindGameObjectWithTag("Playera").GetComponent<Playera>();
     //playerb = GameObject.FindGameObjectWithTag("Playerb").GetComponent<Playerb>();
 }
Exemplo n.º 18
0
    // Use this for initialization
    void Start()
    {
        //背景オブジェクトの情報参照
        BG = BGPre.GetComponent <BackGround>();

        //コリジョン生成
        CreateCollision();
    }
Exemplo n.º 19
0
 /// <summary>
 /// Initializes the background
 /// </summary>
 /// <param name="i_Game">The Hosting Game</param>
 /// <param name="i_StarsNum">The number of stars to be shown on background</param>
 public BackgroundScreen(Game i_Game, int i_StarsNum)
     : base(i_Game)
 {
     m_Background = new BackGround(i_Game);
     this.Add(m_Background);
     this.IsOverlayed = true;
     this.Visible = true;
     this.Enabled = true;
     m_StarsNum = i_StarsNum;
 }
Exemplo n.º 20
0
 private void Next()
 {
     //判断是不是基础的交互
     if (m_interactives[InteractivesIndex] is Session)
     {
         Session session = m_interactives[InteractivesIndex] as Session;
         m_MainPanel.SetActive(true);
         m_MainPanel.transform.GetChild(0).gameObject.GetComponent <Image>().sprite = Resources.Load("Image/portrait/" + session.m_PIC, typeof(Sprite)) as Sprite;
         UpdateTextString(session.m_value);
     }
     else if (m_interactives[InteractivesIndex] is If)
     {
         If @if = m_interactives[InteractivesIndex] as If;
         m_interactives.InsertRange(InteractivesIndex, @if.Interactives);
     }
     else if (m_interactives[InteractivesIndex] is Jump)
     {
         Jump jump = m_interactives[InteractivesIndex] as Jump;
         if (Jump.m_JumpList.ContainsKey(jump.m_target))
         {
             InteractivesIndex = m_interactives.IndexOf(Jump.m_JumpList[jump.m_target]) + 1;
         }
         //interactives.InsertRange(InteractivesIndex, @if.Interactives);
     }
     else if (m_interactives[InteractivesIndex] is BackGround)
     {
         BackGround backGround = m_interactives[InteractivesIndex] as BackGround;
         m_background.GetComponent <Image>().sprite = Resources.Load("Image/BackGround/" + backGround.m_PIC, typeof(Sprite)) as Sprite;
         InteractivesIndex++;
     }
     else if (m_interactives[InteractivesIndex] is BGM)
     {
         BGM bgm = m_interactives[InteractivesIndex] as BGM;
         StartCoroutine(LoadMusic(bgm.m_Music));
         InteractivesIndex++;
     }
     else if (m_interactives[InteractivesIndex] is Disappear)
     {
         m_MainPanel.SetActive(false);
         InteractivesIndex++;
     }
     else
     {
         m_suspend = true;
         string name = m_interactives[InteractivesIndex].GetType().Name;
         Debug.Log(name);
         GameObject prefab = Instantiate(Resources.Load("Prefabs/" + name + "/" + name, typeof(GameObject)) as GameObject);
         prefab.transform.SetParent(m_background.transform);
         prefab.transform.localScale = new Vector3(1, 1, 1);
         Debug.Log(prefab.name);
         prefab.GetComponent <BaseManager>().OnInit(m_interactives[InteractivesIndex]);
         //特殊交互暂停主逻辑
     }
 }
Exemplo n.º 21
0
 protected override void LoadContent()
 {
     spriteBatch    = new SpriteBatch(GraphicsDevice);
     assetManager   = new AssetManager(Content);
     sessionManager = new SessionManager(assetManager);
     crossHair      = new CrossHair(assetManager.SpriteLib["Crosshair"]);
     gameInterface  = new GameUI(this, assetManager);
     menu           = new MainMenu(assetManager);
     backGround     = new BackGround(assetManager, ScreenRes_X, ScreenRes_Y);
     createLoadingLabel();
 }
Exemplo n.º 22
0
        /// <summary>
        /// A Clone of FormulaBack
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            FormulaBack fb = new FormulaBack();

            fb.BackGround = BackGround.Clone();
            fb.LeftPen    = LeftPen.Clone();
            fb.RightPen   = RightPen.Clone();
            fb.BottomPen  = BottomPen.Clone();
            fb.TopPen     = TopPen.Clone();
            return(fb);
        }
Exemplo n.º 23
0
        private void ReSetCurrentShowed()
        {
            List <String> stockIdShowed = new List <String>();
            int           multiPos      = multiStartPos % stocksList.ListMaxSize;

            for (int i = 0; i < stocksList.ListMaxSize && i + listStartPos < GlobalData.StocksCode.Rows.Count; ++i)
            {
                stockIdShowed.Add(GlobalData.StocksCode.Rows[i + listStartPos]["stockId"].ToString().PadLeft(7, '0'));
            }
            GlobalData.CurrentShowList = stockIdShowed;
            routineLoader.ReadNow();

            if (isListMode)
            {
                BackGround.getBackGround().StopAllTasks();
                for (int i = multiStartPos; i < multiStartPos + 9; ++i)
                {
                    string stockId = GlobalData.StocksCode.Rows[i]["stockId"].ToString().PadLeft(7, '0');
                    BackGround.BackGroundTask task;
                    task.stockId   = stockId;
                    task.taskType  = BackGround.TaskType.PerbidTask;
                    task.cycleTime = -1;
                    BackGround.getBackGround().AddTask(task);
                }
            }
            else
            {
                for (int i = multiStartPos - 9; i < multiStartPos + 18; ++i)
                {
                    int realId = i;
                    if (realId < 0)
                    {
                        realId += GlobalData.StocksCode.Rows.Count;
                    }
                    else if (realId > GlobalData.StocksCode.Rows.Count - 1)
                    {
                        realId -= GlobalData.StocksCode.Rows.Count;
                    }
                    string stockId = GlobalData.StocksCode.Rows[realId]["stockId"].ToString().PadLeft(7, '0');
                    BackGround.BackGroundTask task;
                    task.stockId  = stockId;
                    task.taskType = BackGround.TaskType.PerbidTask;
                    if (i < multiStartPos || i > multiStartPos + 8)
                    {
                        task.cycleTime = -1;
                    }
                    else
                    {
                        task.cycleTime = 6000;
                    }
                    BackGround.getBackGround().AddTask(task);
                }
            }
        }
Exemplo n.º 24
0
    private void Awake()
    {
        startPosition = transform.position;
        characterY    = transform.position.y;

        playerAnimator = GetComponent <Animator>();

        uiManeger        = GameObject.Find("UIManeger").GetComponent <UIManeger>();
        backGround       = GameObject.Find("BackGround").GetComponent <BackGround>();
        backGroundObjec  = GameObject.Find("BackGround");
        MainCameraObject = GameObject.Find("MainCamera");
    }
Exemplo n.º 25
0
        Form1 form;                                 // 此状态具备管理窗体的权限

        public GameMenuState(StateSystem sys, TextureManager _t, SoundManagerEx _s, Form1 form = null)
        {
            _system         = sys;
            _textureManager = _t;
            soundmanager    = _s;
            backgroundImage = new BackGround(_t, 0);                   //背景更改为0级(最底层)
            option          = new Option(_t, _s, backgroundImage, 10); //10级,最顶层
            if (form != null)
            {
                this.form = form;
            }
        }
Exemplo n.º 26
0
    // Use this for initialization
    IEnumerator Start()
    {
        max       = Camera.main.ViewportToWorldPoint(new Vector2(1, 1));
        spaceship = GetComponent <Spaceship>();

        background = FindObjectOfType <BackGround>();
        while (true)
        {
            //spaceship.Shot(transform);
            GetComponent <AudioSource>().Play();
            yield return(new WaitForSeconds(spaceship.shotDelay));
        }
    }
Exemplo n.º 27
0
    IEnumerator LoadObject()
    {
        model   = GameObject.FindGameObjectWithTag("Model");
        manHinh = model.GetComponent <ManHinh>();
        manHinh.loadingScreen.SetActive(true);
        yield return(new WaitForEndOfFrame());

        menu = model.GetComponent <Menu>();
        yield return(new WaitForSeconds(0.1f));

        eve         = model.GetComponent <Event>();
        eve.textNum = 0;
        menu.menuList.SetActive(false);
        yield return(new WaitForSeconds(0.1f));

        backGround = model.GetComponent <BackGround>();
        yield return(new WaitForSeconds(0.1f));

        tg         = model.GetComponent <ThoiGian>();
        tg.dayNow  = DateTime.Now.Day;
        tg.dayPrev = tg.dayNow - 1;
        yield return(new WaitForSeconds(0.1f));

        if (!thPlay)
        {
            calendar = GameObject.FindGameObjectWithTag("Calendar").GetComponent <CalendarController>();
            yield return(new WaitForSeconds(0.1f));

            GetSelectedDayInCal();
        }
        music = GameObject.FindGameObjectWithTag("Music").GetComponent <Music>();
        yield return(new WaitForSeconds(0.1f));

        sound            = model.GetComponent <AudioSource>();
        music.musicSound = GameObject.FindGameObjectWithTag("Music").GetComponent <AudioSource>();
        yield return(new WaitForSeconds(0.1f));

        if (!thPlay)
        {
            ThayDoiNhacNen(music.normalMusic);
        }
        yield return(new WaitForSeconds(0.1f));

        stat = model.GetComponent <PlayerStat>();
        stat.LoadStat(PlayerPrefs.GetInt("idTKCurrent"));
        gameObject.GetComponent <EventController>().LoadCotTruyen();
        yield return(new WaitForSeconds(0.1f));

        loadComplete = true;
        manHinh.loadingScreen.SetActive(false);
    }
Exemplo n.º 28
0
        protected override void LoadContent()
        {
            spriteDrawer.LoadContent(new SpriteBatch(GraphicsDevice), Content);
            TestTexture = Content.Load <Texture2D>("TestNodeTextures/grass");

            for (int y = 0; y < 100; y++)
            {
                for (int x = 0; x < 100; x++)
                {
                    Vector2 curPos = new Vector2(x, y);
                    BackGround.Add(curPos, new Node(curPos, TestTexture));
                }
            }
        }
Exemplo n.º 29
0
 private void StartBackGround()
 {
     BackGround.BackGroundTask history;
     history.stockId   = stockId;
     history.taskType  = BackGround.TaskType.HistoryTask;
     history.cycleTime = -1;
     BackGround.BackGroundTask perbid;
     perbid.stockId   = stockId;
     perbid.taskType  = BackGround.TaskType.PerbidTask;
     perbid.cycleTime = Config.GlobalConfig.ThreadConfig.PerbidReadTime;
     BackGround.getBackGround().Execute(history);
     BackGround.getBackGround().Execute(perbid);
     BackGround.getBackGround().AddTask(perbid);
 }
Exemplo n.º 30
0
        public LoginView()
        {
            InitializeComponent();
            ColorAnimation animation = new ColorAnimation();

            animation.From     = Colors.Orange;
            animation.To       = Colors.Black;
            animation.Duration = new Duration(TimeSpan.FromSeconds(5));
            BackGround.BeginAnimation(SolidColorBrush.ColorProperty, animation);

            ViewModel.LoginViewModel viewModel = new ViewModel.LoginViewModel();
            DataContext = viewModel;
            viewModel.ClosingRequest += (sender, e) => Close();
        }
Exemplo n.º 31
0
        public PlayingState() : base()
        {
            Add(backGround = new BackGround());

            Add(theParticles = new GeometryClashParticles());

            Add(theEnemies = new GameObjectList());
            Add(theBullets = new GameObjectList());

            Add(thePlayer = new Player());
            Add(theLives  = new Lives());
            Add(theScore  = new Score());

            Reset();
        }
Exemplo n.º 32
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
            this.camera = new Camera(new Vector2(0), 1f, 0, this.graphics);

            SpriteBatch spriteBatch = new SpriteBatch(GraphicsDevice);

            myGraphicsObject = new DrawingUtils.MyGraphicsClass(this.graphics, spriteBatch, this.camera);

            backGround           = new BackGround(worldSize);
            gameObjectCollection = new GameObjectCollection(worldSize);

            this.graphics.PreferredBackBufferWidth  = this.graphics.GraphicsDevice.DisplayMode.Width;
            this.graphics.PreferredBackBufferHeight = this.graphics.GraphicsDevice.DisplayMode.Height;
            this.graphics.ApplyChanges();
        }
Exemplo n.º 33
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        BackGround backGround = collision.gameObject.GetComponent <BackGround>();

        if (backGround != null)
        {
            if (backGround.gameObject.transform.position.y < transform.position.y)
            {
                // 判断子弹归属,避免误伤
                if (backGround.isGround)
                {
                    JumpTimes = 0;
                }
            }
        }
    }
Exemplo n.º 34
0
 void Start()
 {
     bg = GetComponentInChildren<BackGround>();
     shape = GetComponentInChildren<Shape>();
 }
Exemplo n.º 35
0
 // Use this for initialization
 void Start()
 {
     myState = States.cell;
     backGround = GameObject.FindObjectOfType<BackGround>();
     MusicPlayer = GameObject.FindObjectOfType<MusicPlayer>();
 }