Inheritance: MonoBehaviour
Beispiel #1
0
    private EnemyCreator enemy_creator = null;                  // 방해 캐릭터 크리에이터.

    // ================================================================ //
    // MonoBehaviour에서 상속.

    void    Start()
    {
        this.player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>();

        //

        this.last_block.is_created = false;

        this.level_control = new LevelControl();
        this.level_control.initialize();
        this.level_control.loadLevelData(this.level_data_text);

        this.player.level_control = this.level_control;

        //

        this.game_root     = this.gameObject.GetComponent <GameRoot>();
        this.block_creator = this.gameObject.GetComponent <BlockCreator>();
        this.coin_creator  = this.gameObject.GetComponent <CoinCreator>();
        this.enemy_creator = this.gameObject.GetComponent <EnemyCreator>();

        this.block_creator.map_creator = this;
        this.coin_creator.map_creator  = this;
        this.enemy_creator.map_creator = this;

        //

        this.create_floor_block();
    }
Beispiel #2
0
 // Use this for initialization
 void Start()
 {
     startLocalPos   = transform.localPosition;
     levelState      = LevelControl.Instance;
     goalLocalPosY   = startLocalPos;
     goalLocalPosY.y = goalLocalPos.y;
 }
Beispiel #3
0
    // Use this for initialization
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>();
        player.gameSceneControl = this;

        levelControl = new LevelControl();
        levelControl.gameSceneControl = this;
        levelControl.player           = player;
        levelControl.oniGroupPrefab   = oniGroupPrefab;
        levelControl.Create();

        resultControl = new ResultControl();

        gameUIControl = GameUIControl.Instance;
        scoreControl  = gameUIControl.scoreControl;

        result.oniDefeatNum    = 0;
        result.evaluationCount = new int[(int)Evaluation.Num];
        result.rank            = 0;
        result.score           = 0;
        result.scoreMax        = 0;

        for (int i = 0; i < result.evaluationCount.Length; i++)
        {
            result.evaluationCount[i] = 0;
        }

        fadeControl = FadeControl.Instance;
        fadeControl.Fade(3.0f, new Color(0, 0, 0, 1.0f), new Color(0, 0, 0, 0));

        nextState = State.Start;
    }
Beispiel #4
0
    // This function initializes a level
    // It spawns enemies, and loads the player
    public void InitLevel(LevelControl level)
    {
        _lePersonnage = level.StartLevel(P_personnagePrefab, _nextDoor);
        P_playerDead  = false;
        if (_hasSavedStats)
        {
            _lePersonnage.SetStats(_lastStats);
            foreach (StatusEffect se in _StatusEffects)
            {
                se.ReInit(_lePersonnage);
            }
        }
        BattleInterface.Instance.Initialize();
        Camera.main.GetComponent <CameraBehavior>().P_target = _lePersonnage.transform;
        //This should be moved to the Level scripts
        Enemy[] enemies = FindObjectsOfType(typeof(Enemy)) as Enemy[];
        _lesEnemis.Clear();
        int enemycount = 1;

        foreach (Enemy e in enemies)
        {
            e.SetTarget(_lePersonnage.transform);
            _lesEnemis.Add(e);
            e.name = "Enemy" + enemycount.ToString();
            enemycount++;
        }
        Screen.showCursor = false;
    }
 void Start()
 {
     round_level    = GameObject.Find("spawner");
     round_accessor = round_level.GetComponent <LevelControl> ();
     store_accessor = GameObject.Find("Store");
     storecontrol   = store_accessor.GetComponent <StoreControl> ();
 }
Beispiel #6
0
 // Use this for initialization
 void Start()
 {
     pauseMenu  = pauseMenu.GetComponent <Canvas>();
     continuing = continuing.GetComponent <Button>();
     exit       = exit.GetComponent <Button>();
     level      = GameObject.FindGameObjectWithTag("Level").GetComponent <LevelControl>();
 }
Beispiel #7
0
    // ================================================================ //

    public void             create()
    {
        this.level_control = new LevelControl();
        this.level_control.initialize();
        this.level_control.loadLevelData(this.levelData);
        this.level_control.selectLevel();
    }
Beispiel #8
0
    // 삭제 직전에 호출된다.
    public override void            onDelete()
    {
        base.onDelete();

        // 아이템을 생성한다.
        if (this.reward_item.type != "" && this.reward_item.name != "")
        {
            string local_player_id = PartyControl.get().getLocalPlayer().getAcountID();

            ItemManager.get().createItem(this.reward_item.type, this.reward_item.name, local_player_id);
            ItemManager.get().setPositionToItem(this.reward_item.name, this.control.getPosition());

            var item = ItemManager.get().findItem(this.reward_item.name);

            if (item != null)
            {
                item.behavior.setFavorOption(this.reward_item.option0);
                item.behavior.beginSpawn();
            }
        }

        if (this.room != null)
        {
            LevelControl.get().onDeleteEnemy(this.room, this.control);
        }
    }
 // Use this for initialization
 void Start()
 {
     musicPlayer       = GameObject.FindWithTag("MusicPlayer").GetComponent <MusicPlayer>();
     MusicSlider.value = PlayerPrefsManager.GetMusicVolume();
     SfxSlider.value   = PlayerPrefsManager.GetSfxVolume();
     lvlControl        = GameObject.FindWithTag("LevelSelector").GetComponent <LevelControl>();
 }
Beispiel #10
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Beispiel #11
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            LevelControl.Draw(spriteBatch);
            spriteBatch.End();

            base.Draw(gameTime);
        }
Beispiel #12
0
 // Use this for initialization
 void Start()
 {
     levelControl = GameObject.Find("Game Controller").GetComponent <LevelControl>();
     player       = levelControl.GetPlayer().transform;
     camera       = GetComponent <Camera>();
     relPos       = player.position - transform.position;
 }
Beispiel #13
0
 public void create()
 {
     this.level_control = new LevelControl();
     this.level_control.initialize();                  // 레벨 데이터 초기화.
     this.level_control.loadLevelData(this.levelData); // 데이터 읽기.
     this.level_control.selectLevel();                 // 레벨 선택.
 }
Beispiel #14
0
//-------------------------------------------------------------
    public IEnumerator Spawn()
    {
        yield return(new WaitForSeconds(1.0f));

        playing = true;
        while (timeLeft > 0)
        {
            GameObject ball          = balls [Random.Range(0, balls.Length)];
            Vector3    spawnPosition = new Vector3(
                Random.Range(-maxWidth, maxWidth), transform.position.y, 0.0f);
            Quaternion spawnRotaion = Quaternion.identity;
            Instantiate(ball, spawnPosition, spawnRotaion);
            yield return(new WaitForSeconds(Random.Range(1.0f, 2.0f)));
        }
        LevelControl.setScore(score_Class.Score);
        yield return(new WaitForSeconds(2.0f));

        LevelControl.showMessageInEndOfGame();
        yield return(new WaitForSeconds(2.0f));

        LevelControl.showMasalInEndOfGame();
        LevelControl.saveLevelGame();
        yield return(new WaitForSeconds(5.0f));

        LevelControl.showMenuInEndOfGame();
    }
Beispiel #15
0
        public void Should_Write()
        {
            var levelControl = new LevelControl(new LevelControlOptions {
                Position = ControlPosition.BottomLeft,
                Style    = ControlStyle.Auto
            });

            var options = new IndoorManagerOptions {
                LevelControl = levelControl,
                StatesetId   = "statesetId",
                Theme        = IndoorLayerTheme.Auto,
                TilesetId    = "tilesetId",
                Geography    = "us"
            };

            var expectedJson = "{"
                               + "\"levelControl\":{"
                               + "\"options\":{"
                               + "\"position\":\"bottom-left\""
                               + ",\"style\":\"auto\""
                               + "}"
                               + "}"
                               + ",\"statesetId\":\"statesetId\""
                               + ",\"theme\":\"auto\""
                               + ",\"tilesetId\":\"tilesetId\""
                               + ",\"geography\":\"us\""
                               + "}";

            TestAndAssertWrite(options, expectedJson);
        }
 void Awake()
 {
     lvlCtrl     = GetComponent <LevelControl>();
     gameCtrl    = GetComponent <GameControl>();
     guiCtrl     = GetComponent <GameGUIControl>();
     pathArwCtrl = GetComponent <PathArrowControl>();
 }
Beispiel #17
0
    // Use this for initialization
    void Awake()
    {
        //First take care of singleton stuff

        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
        }

        character        = new Character(new Vector3(0, 0, 0));
        morphTriggers    = new Dictionary <Vector3, char>();
        teleportTriggers = new Dictionary <Vector3, Vector3>();
        moveTriggers     = new Dictionary <Vector3, char>();
        portalParticles  = Resources.Load("Portal", typeof(GameObject)) as GameObject;

        instance = this;
        DontDestroyOnLoad(this.gameObject);

        //Now load the game stuff

        levelLayout = new LevelEntity[20, 20, 20];
        for (int i = 0; i < 20; i++)
        {
            for (int j = 0; j < 20; j++)
            {
                for (int k = 0; k < 20; k++)
                {
                    levelLayout[i, j, k] = new LevelEntity(new Vector3(i, j, k));
                }
            }
        }

        restartGame();
    }
Beispiel #18
0
	void Awake ()
	{
		//Make this active and only instance
		instance = this;
		level = 0;
		ballsInitial = 0;
	}
Beispiel #19
0
 void Start()
 {
     levelState          = LevelControl.Instance;
     goalLight           = GetComponent <Light>();
     ImmersiveRange      = DefaultRange / LevelControl.ImmersiveScale;
     goalLight.intensity = 1.5f;
 }
Beispiel #20
0
    // Use this for initialization
    void Start()
    {
        // Initialize level control script reference
        levelControl = GetComponent <LevelControl> ();

        // Populate factory cell array
        cellArray = GameObject.FindGameObjectsWithTag("FactoryCell");

        // Initialize first dimension of distance array
        distanceArray = new float[cellArray.Length][];

        // loop for each cell in this level, initializing cell information
        for (int i = 0; i < cellArray.Length; i++)
        {
            // Initialize second dimension of distance array ** will potentially truncate subsequent arrays to avoid duplicate distances
            distanceArray [i] = new float[cellArray.Length];

            // Loop for each cell again to calculate the distance between each pair of cells
            for (int j = 0; j < cellArray.Length; j++)
            {
                // Store calculated distance between cell i and cell j
                distanceArray [i][j] = Vector3.Distance(cellArray [i].transform.position, cellArray [j].transform.position);
            }

            // Initialize and populate static information for cell i, add to cellInfoList
            FactoryCellInfo tempCellInfo = new FactoryCellInfo(i, cellArray, distanceArray);
            cellInfoList.Add(tempCellInfo);

            // tell FactoryCellControl scripts their cell numbers
            tempCellInfo.cellControlScript.cellNum = i;
        }
    }
Beispiel #21
0
 // Use this for initialization
 void Start()
 {
     playerControler  = FindObjectOfType <PlayerControler>();
     player           = playerControler.gameObject;
     enemyRigidbody2D = gameObject.GetComponent <Rigidbody2D>();
     levelControl     = FindObjectOfType <LevelControl>();
 }
Beispiel #22
0
    // ================================================================ //
    // 继承于MonoBehaviour

    void    Start()
    {
        this.rooms = new FloorControl[MODEL_NUM];

        for (int i = 0; i < 3; i++)
        {
            this.rooms[i] = (Instantiate(this.roomPrefab) as GameObject).GetComponent <FloorControl>();

            this.rooms[i].transform.position = new Vector3(0.0f, 0.0f, MODEL_Z_OFFSET + (float)i * MODEL_LENGTH);
        }

        this.start_model_index = 0;

        this.rooms[(this.start_model_index + 0) % MODEL_NUM].setOpen();
        this.rooms[(this.start_model_index + 1) % MODEL_NUM].setOpen();
        this.rooms[(this.start_model_index + 2) % MODEL_NUM].setClose();

        this.shoji_control = (Instantiate(this.shojiPrefab) as GameObject).GetComponent <ShojiControl>();

        this.rooms[(this.start_model_index + 0) % MODEL_NUM].attachShouji(this.shoji_control);

        //

        // 查找摄像机的实例
        this.main_camera = GameObject.FindGameObjectWithTag("MainCamera");

        this.scene_control = SceneControl.get();

        this.level_control = LevelControl.get();
    }
Beispiel #23
0
//-------------------------------------------------------------
    // Use this for initialization
    void Start()
    {
        LevelControl.init();
        LevelControl.loadLevelGameSituation();
        playing = false;
        balls   = new GameObject[6];
        //ballInit = GameObject.Instantiate( UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/prefab/ball.prefab", typeof(GameObject)) )as GameObject;
        //bombInit = GameObject.Instantiate( UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/prefab/BombSpark.prefab", typeof(GameObject)) )as GameObject;
        ///////////////////////////////////////////////////////////////////////////////////////
        // LevelControl class
        LevelControl.setRequierLevel(ballInit, bombInit, sky);
        for (int i = 0; i < 6; i++)
        {
            balls [i] = LevelControl.balls [i];
        }
        ///////////////////////////////////////////////////////////////////////////////////////
        if (cameraInstance == null)
        {
            cameraInstance = Camera.main;
        }
        Vector3 upperCorner = new Vector3(Screen.width, Screen.height, 0.0f);
        Vector3 targetWidth = cameraInstance.ScreenToWorldPoint(upperCorner);
        float   ballWidth   = balls [0].GetComponent <Renderer> ().bounds.extents.x;

        maxWidth = targetWidth.x - ballWidth;
    }
 public void create()
 {
     this.level_control = new LevelControl();
     this.level_control.initialize();                  // レベルデータを初期化
     this.level_control.loadLevelData(this.levelData); // データを読み込む
     this.level_control.selectLevel();                 // レベルを選択
 }
Beispiel #25
0
    // Use this for initialization
    void Start()
    {
        //查找玩家的实例
        this.player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>();

        //查找摄像机的实例对象
        this.main_camera = GameObject.FindGameObjectWithTag("MainCamera");

        this.level_control = new LevelControl();
        this.level_control.scene_control  = this;
        this.level_control.player         = this.player;
        this.level_control.OniGroupPrefab = this.OniGroupPrefab;
        this.level_control.Create();


        scoreControl = GetComponent <ScoreControl>();


        //清空游戏的结果
        this.result.oni_defeat_num = 0;
        this.result.eval_count     = new int[(int)EVALUATION.NUM];
        this.result.rank           = 0;
        this.result.score          = 0;
        this.result.score_max      = 0;

        for (int i = 0; i < this.result.eval_count.Length; i++)
        {
            this.result.eval_count[i] = 0;
        }

        //this.GetComponent

        //直接游戏
        this.step = Step.Game;
    }
Beispiel #26
0
    // 적을 펑하고 스폰한다(Action, 게스트용).
    public void             create_enemy_internal_pedigree(string pedigree)
    {
        // 등록된 적 중에서 랜덤하게 선택.

        do
        {
            string[] tokens = pedigree.Split('.');

            if (tokens.Length < 3)
            {
                break;
            }

            string enemy_name = tokens[0] + "." + tokens[1];

            if (!System.Enum.IsDefined(typeof(Enemy.BEHAVE_KIND), tokens[2]))
            {
                break;
            }

            Enemy.BEHAVE_KIND behave = (Enemy.BEHAVE_KIND)System.Enum.Parse(typeof(Enemy.BEHAVE_KIND), tokens[2]);

            chrBehaviorEnemy enemy = LevelControl.get().createCurrentRoomEnemy <chrBehaviorEnemy>(enemy_name);

            if (enemy == null)
            {
                break;
            }

            enemy.name = enemy_name;
            enemy.setBehaveKind(behave, null);
            enemy.beginSpawn(this.transform.position + Vector3.up * 3.0f, this.transform.forward);
        } while(false);
    }
Beispiel #27
0
    // Use this for initialization
    void Start()
    {
        vanishingTime = 0;

        LC = new LevelControl();
        LC.initialize();
        LC.loadLevelData(levelData);
    }
Beispiel #28
0
 void Awake()
 {
     cloudMaterial    = GetComponentInChildren <MeshRenderer>().material;
     networkDiscovery = NetworkDiscoveryWithAnchors.Instance;
     anchorManager    = UNetAnchorManager.Instance;
     levelState       = LevelControl.Instance;
     allPlayers.Add(this);
 }
Beispiel #29
0
 public static void saveLevelGame()
 {
     if ((levelGame + 1) < 4 && LevelControl.getScore() >= LevelControl.thresholdLevel)
     {
         SaveLoadPlayerData.playerLevel = levelGame + 1;
         SaveLoadPlayerData.Save();
     }
 }
Beispiel #30
0
 private void CountBlock()
 {
     if (tag == "Breakable")
     {
         level = FindObjectOfType <LevelControl>();
         level.RegisterBlock();
     }
 }
Beispiel #31
0
 void Start()
 {
     spawn         = GameObject.FindGameObjectWithTag("Spawner");
     LevelControl  = spawn.GetComponent <LevelControl>();
     Enemy         = GetComponent <NavMeshAgent>();
     currentHealth = maxHealth;
     healthBar.SetMaxHealth(maxHealth);
 }
Beispiel #32
0
    public void explode()
    {
        if (endlessFlag == 1)
        {
            lvl.endlessReset();
        }
        lvl = Camera.main.GetComponent<LevelControl>();
        Camera.main.GetComponent<AudioSource>().PlayOneShot(lvl.tiengNoEffect);

        GameObject objTemp = lvl.pool.getData("noEffect");
        objTemp.transform.position  = this.transform.position + new Vector3(0,0.6f,-0.27216f);
        objTemp.GetComponent<ParticleSystem>().Play();
        GetComponent<Animation>().wrapMode = WrapMode.Once;
        GetComponent<Animation>().Play ("no");
    }
    void Awake()
    {
        I = this;

        if (CurrentLevel >= Levels.Count)
        {
            CurrentLevel = 0;
        }
        Levels[CurrentLevel].gameObject.SetActive(true);
        Player.transform.position = Levels[CurrentLevel].StartPos.position;
        Player.transform.rotation = Levels[CurrentLevel].StartPos.rotation;

        Trailer.transform.position = Levels[CurrentLevel].StartPos.position;
        Trailer.transform.rotation = Levels[CurrentLevel].StartPos.rotation;
    }
 void Update()
 {
     if (Botton.transform.localScale != new Vector3((Screen.width / 13333.3f) * 2.2f, (Screen.height / 15000f) * 3.3f, transform.localScale.z))
     {
         Botton.transform.localScale = new Vector3((Screen.width / 13333.3f) * 2.2f, (Screen.height / 15000f) * 3.3f, transform.localScale.z);
     }
     if(Application.loadedLevel != 7)
     {
         if(Can == null)
         {
             Can = GameObject.Find("LevelController").GetComponent<LevelControl>();
         }
         if(Can != null && Can.CanPlay)
         {
             Seconds += Time.deltaTime;
             if (Seconds >= 1)
             {
                 Seconds = 0;
                 TotalTime += 1;
             }
             if(TotalTime < 10)
             {
                 TimeCounter.text = TotalTime.ToString();
             }
             else if(TotalTime < 100)
             {
                 string Blood = TotalTime.ToString();
                 U = Blood[1];
                 D = Blood[0];
                 TimeCounter.text = D + " " + U;
             }
             else
             {
                 string Blood = TotalTime.ToString();
                 U = Blood[2];
                 D = Blood[1];
                 C = Blood[0];
                 TimeCounter.text = C + " " + D + " " + U;
             }
         }
     }
 }
Beispiel #35
0
	public void InitEvents ()
	{
		fc = FlowControl.Instance;
		lc = LevelControl.Instance;
		sc = ScoreControl.Instance;
		uic = UIControl.Instance;
		dc = DataControl.Instance;
		shootC = GameObject.Find ("Player").GetComponent<ShootingController> ();

		lc.BallsChanged += OnBallsChanged;
		lc.LevelChanged += OnLevelChanged;
		lc.TargetsChanged += OnTargetsChanged;
		sc.ScoreChanged += OnScoreChanged;
		shootC.InitPowerSlider += OnInitPowerSlider;
		shootC.UpdatePowerSlider += OnUpdatePowerSlider;

		string levelKind = dc.GetLevel (fc.Level).Kind;
		if (levelKind.Equals ("T"))
			GameObject.Find ("Player").GetComponent<MoveOnTrails> ().TrailsEndReached += OnTrailsEndReached;
	}
Beispiel #36
0
	public void Proceed ()
	{
		if (Status == STATUS.PLAYING) {
			EventControl.Instance.InitEvents ();

			lc = LevelControl.Instance;
			lc.Level = level;

			Level lev = DataControl.Instance.GetLevel (level);
			lc.BallsInitial = lev.Balls; 
			lc.Targets = lev.Targets;

			sc = ScoreControl.Instance;
			sc.Score = 0;

			Cursor.visible = false;
		} else {
			Cursor.visible = true;
		}
	}
    void Start()
    {
        Star = 0;
        TempoS = GameObject.Find("Canvas").GetComponent<TimeScript>();
        try
        {
            MainLevel = GameObject.Find("LevelController").GetComponent<LevelControl>();
            counterToWin = 0;
            counter = 0;
            j = 0;
            i = 0;
            ToWin = 0;
            FacesMini = GameObject.Find("MiniCube").GetComponent<ColorDefault>();
            FacesBig = GameObject.Find("CubeM").GetComponent<ColorDefault>();
            FacesToMini = FacesMini.Faces;
            FacesToBig = FacesBig.Faces;
         }
         catch
         {

         }
    }
Beispiel #38
0
    private int block_count = 0; // 만든 블록 개수.

    #endregion Fields

    #region Methods

    // ================================================================ //
    // 블록을 만든다.
    public void createBlock(LevelControl.CreationInfo current_block, Vector3 block_position)
    {
        if(current_block.block_type == Block.TYPE.FLOOR) {

            // 다음에 만들 블록의 종류를 결정한다.
            // blockPrefabs에 설정된 블록이 차례로 나온다.
            //
            int		next_block_type = this.block_count%this.blockPrefabs.Length;

            GameObject		go        = GameObject.Instantiate(this.blockPrefabs[next_block_type]) as GameObject;
            BlockControl	new_block = go.GetComponent<BlockControl>();

            new_block.transform.position = block_position;

            // BlockControl 클래스에 MapCreator를 기록해 둔다.
            // (BlockControl 클래스에서 MapCreator 클래스의 메소드를 호출하기 위해).
            //
            new_block.map_creator = this.map_creator;

            this.block_count++;
        }
    }
 void Update()
 {
     if(Can == null)
     {
         Can = GameObject.Find("LevelController").GetComponent<LevelControl>();
     }
     if(MVelS == null)
     {
         MVelS = GameObject.Find("Acelerator").GetComponent<AceleratorScript>();
     }
     if (Application.platform == RuntimePlatform.Android)
     {
         Touched = MyTouch.tapCount > 0 ? true : false;
     }
     if (!Down && !Touched && GameObject.FindGameObjectWithTag("blocoUsing") == null)
     {
         transform.Rotate(0.01f, 0.01f, 0.01f);
     }
     if(Input.GetMouseButtonDown(1))
     {
         Down = true;
     }
     else if(Input.GetMouseButtonUp(1))
     {
         Down = false;
     }
     if (Can.CanPlay)
     {
         if (Application.platform == RuntimePlatform.Android && GameObject.FindGameObjectWithTag("blocoUsing") == null && MVelS.isPressed == false)
         {
             transform.Rotate(Input.GetTouch(0).deltaPosition.y * 400 / 10f * Time.deltaTime, Input.GetTouch(0).deltaPosition.x * - 400 / 10f * Time.deltaTime, 0f, Space.World);
             transform.Rotate(0f, 0f,((Input.GetTouch(1).deltaPosition.y * 400 / 10f * Time.deltaTime) + (Input.GetTouch(1).deltaPosition.x * -400 / 10f * Time.deltaTime))/2, Space.World);
         }
         else if (Down && GameObject.FindGameObjectWithTag("blocoUsing") == null && MVelS.isPressed == false)
         {
             transform.Rotate((Input.GetAxis("Mouse Y") * sensitivityY * Time.deltaTime), (Input.GetAxis("Mouse X") * -sensitivityX * Time.deltaTime), 0, Space.World);
         }
     }
 }
Beispiel #40
0
    private int block_count = 0; // 作ったブロックの個数.

    #endregion Fields

    #region Methods

    // ================================================================ //
    // ブロックを作る.
    public void createBlock(LevelControl.CreationInfo current_block, Vector3 block_position)
    {
        if(current_block.block_type == Block.TYPE.FLOOR) {

            // 次につくるブロックの種類を決める.
            // blockPrefabs にセットされたブロックがじゅんばんに出てくる.
            //
            int		next_block_type = this.block_count%this.blockPrefabs.Length;

            GameObject		go        = GameObject.Instantiate(this.blockPrefabs[next_block_type]) as GameObject;
            BlockControl	new_block = go.GetComponent<BlockControl>();

            new_block.transform.position = block_position;

            // BlockControl クラスに MapCreator を記録しておく.
            // (BlockControl クラスから MapCreator クラスのメソッドを呼び出すため).
            //
            new_block.map_creator = this.map_creator;

            this.block_count++;
        }
    }
 void Update()
 {
     if(Can == null)
     {
         Can = GameObject.Find("LevelController").GetComponent<LevelControl>();
     }
     ReservePosition1 = new MainCubesPrefabs[GameObject.FindGameObjectsWithTag("blocoMove").Length];
     if(Can.CanPlay)
     {
         MyButton.interactable = true;
     }
     try
     {
         AllBlocks1 = GameObject.FindGameObjectsWithTag("blocoMove");
         for (int i = 0; i < GameObject.FindGameObjectsWithTag("blocoMove").Length; i++)
         {
             ReservePosition1[i] = GameObject.FindGameObjectsWithTag("blocoMove")[i].GetComponent<MainCubesPrefabs>();
         }
     }
     catch{}
     if (isPressed && Can.CanPlay)
     {
         try
         {
             for (int i = 0; i < AllBlocks1.Length; i++)
             {
                 AllBlocks1[i].transform.position = new Vector3(AllBlocks1[i].transform.position.x - 0.08f, AllBlocks1[i].transform.position.y, AllBlocks1[i].transform.position.z);
             }
         }
         catch { }
         for (int i = 0; i < ReservePosition1.Length; i++)
         {
             ReservePosition1[i].lastPosition = new Vector3(ReservePosition1[i].lastPosition.x - 0.08f, ReservePosition1[i].lastPosition.y, ReservePosition1[i].lastPosition.z);
         }
         MyCreator.Seconds += Time.deltaTime * 2f/1.5f;
     }
 }
Beispiel #42
0
    // ================================================================ //
    // MonoBehaviour からの継承.
    void Start()
    {
        this.player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerControl>();

        //

        this.last_block.is_created = false;

        this.level_control = new LevelControl();
        this.level_control.initialize();
        this.level_control.loadLevelData(this.level_data_text);

        this.player.level_control = this.level_control;

        //

        this.game_root     = this.gameObject.GetComponent<GameRoot>();
        this.block_creator = this.gameObject.GetComponent<BlockCreator>();
        this.coin_creator  = this.gameObject.GetComponent<CoinCreator>();
        this.enemy_creator = this.gameObject.GetComponent<EnemyCreator>();

        this.block_creator.map_creator = this;
        this.coin_creator.map_creator = this;
        this.enemy_creator.map_creator = this;

        //

        this.create_floor_block();
    }
    /* -------------------------------------------------------------------------------------------------------- */
    /*
     * UNITY STUFF
     */
    /* -------------------------------------------------------------------------------------------------------- */
    void Awake()
    {
        Script = this;

        scoreScript = GameObject.Find("GameCode").GetComponent<ScoreCounter>();

        networkScript = GameObject.Find("NetworkCode").GetComponent<NetworkGame>();

        levelTimer = (2 + networkScript.levelTimeNetworkGame) * 60;
        //levelTimer = 5.0f;

        menuTime = Time.time;
    }
Beispiel #44
0
 // Use this for initialization
 void Start()
 {
     lvl = Camera.main.GetComponent<LevelControl> ();
     pos = new Vector3[GameSettings.size * GameSettings.size + 10];
     isMoving = false;
 }
    void FixedUpdate()
    {
        if(Can == null)
        {
            Can = GameObject.Find("LevelController").GetComponent<LevelControl>();
        }
        try
        {

            if (GameObject.FindGameObjectWithTag("blocoExit") != null)
            {
                CountTo += Time.deltaTime;
                if (CountTo > 0.002f)
                {
                    CountTo = 0;
                    Destroy(GameObject.FindGameObjectWithTag("blocoExit"));
                }
            }
            else if (coloca && Catching)
            {
                CountTo += Time.deltaTime;
                if (CountTo > 0.004f)
                {
                    coloca = false;
                    Catching = false;
                }
            }
        }
        catch
        {

        }
        if (Can.CanPlay)
        {
            Seconds += Time.deltaTime;
        }
        if (Seconds > TimeTo)
        {
            Seconds = 0;
            int RandomP = Mathf.FloorToInt(Random.Range(0, 6));
            switch (RandomP)
            {
                case 0:
                    Instantiate(bloco_a, lugar, Quaternion.identity);
                    break;
                case 1:
                    Instantiate(bloco_am, lugar, Quaternion.identity);
                    break;
                case 2:
                    Instantiate(bloco_v, lugar, Quaternion.identity);
                    break;
                case 3:
                    Instantiate(bloco_ve, lugar, Quaternion.identity);
                    break;
                case 4:
                    Instantiate(bloco_l, lugar, Quaternion.identity);
                    break;
                case 5:
                    Instantiate(bloco_b, lugar, Quaternion.identity);
                    break;
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        this.player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerControl>();
        this.last_block.is_created = false;
        this.block_creator = this.gameObject.GetComponent<BlockCreator>();

        this.level_control = new LevelControl();
        this.level_control.initialize();

        //テキストからデータを読み出す
        this.level_control.loadLevelData(this.level_data_text);

        this.game_root = this.gameObject.GetComponent<GameRoot>();

        this.player.level_control = this.level_control;
    }
    // -------------------------------------------------------------------------------- //
    void Start()
    {
        // プレイヤーのインスタンスを探しておく.
        this.player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerControl>();

        this.player.scene_control = this;

        // スコアのインスタンスを探しておく.
        this.score_control = GetComponent<ScoreControl>();

        // カメラのインスタンスを探しておく.
        this.main_camera = GameObject.FindGameObjectWithTag("MainCamera");

        this.level_control = new LevelControl();
        this.level_control.scene_control = this;
        this.level_control.player = this.player;
        this.level_control.OniGroupPrefab = this.OniGroupPrefab;
        this.level_control.create();

        this.result_control = new ResultControl();

        // GUI 制御のスクリプト(コンポーネント).
        this.gui_control = this.GetComponent<GUIControl>();

        // フェードコントロールの追加
        fader = gameObject.AddComponent<FadeControl>();

        // ゲームの結果をクリアーしておく.
        this.result.oni_defeat_num = 0;
        this.result.eval_count = new int[(int)EVALUATION.NUM];
        this.result.rank = 0;
        this.result.score = 0;
        this.result.score_max = 0;

        for(int i = 0;i < this.result.eval_count.Length;i++) {

            this.result.eval_count[i] = 0;
        }

        // フェードインで開始
        this.fader.fade( 3.0f, new Color( 0.0f, 0.0f, 0.0f, 1.0f ), new Color( 0.0f, 0.0f, 0.0f, 0.0f ) );

        this.step = STEP.START;
    }
Beispiel #48
0
 public void create()
 {
     this.level_control = new LevelControl();
     this.level_control.initialize(); // 레벨 데이터 초기화.
     this.level_control.loadLevelData(this.levelData); // 데이터 읽기.
     this.level_control.selectLevel(); // 레벨 선택.
 }
Beispiel #49
0
    void Start()
    {
        this.player = GameObject.FindGameObjectWithTag(
            "Player").GetComponent<PlayerControl>();
        this.last_block.is_created = false;
        this.block_creator = this.gameObject.GetComponent<BlockCreator>();

        this.level_control = new LevelControl();
        this.level_control.initialize();
    }
Beispiel #50
0
 public void create()
 {
     this.level_control = new LevelControl();
     this.level_control.initialize(); // レベルデータを初期化.
     this.level_control.loadLevelData(this.levelData); // データを読み込む.
     this.level_control.selectLevel(); // レベルを選択.
 }
	public static LevelControl getInstance ()
	{
		if ( _meInstance == null )
		{
			_meInstance = GameObject.Find ( "_LevelObject" ).GetComponent < LevelControl > ();
		}
		
		return _meInstance;
	}
Beispiel #52
0
 // ================================================================ //
 public void create()
 {
     this.level_control = new LevelControl();
     this.level_control.initialize();
     this.level_control.loadLevelData(this.levelData);
     this.level_control.selectLevel();
 }
Beispiel #53
0
 // Use this for initialization
 void Start()
 {
     lvl = Camera.main.GetComponent<LevelControl> ();
 }
Beispiel #54
0
	// Use this for initialization
	void Start () {
		lvlCtrl = GameObject.Find ("LevelControl").GetComponent<LevelControl> ();
	}