Exemple #1
0
	public override void initializeMap(GameRoot game_root)
	{
		MapCreator		map_creator   = MapCreator.get();
		PartyControl	party_control = PartyControl.get();

		map_creator.setRoomNum(1, 1);

		map_creator.floor_root_go = new GameObject("Floor");
		
		// 방 만들기.
		RoomController room = map_creator.createRoomFloor(new Map.RoomIndex(0, 0));

		// 더미 방 만들기.
		map_creator.createVacancy(new Map.RoomIndex(0, -1));

		// 방을 구분하는 벽을 만든다.
		map_creator.createRoomWall();

		// 외벽을 만든다.
		map_creator.createOuterWalls();

		GameRoot.get().createLocalPlayer();
		GameRoot.get().createNetPlayers();

		// 플레이어 위치 설정.

		chrBehaviorLocal	local_player = PartyControl.get().getLocalPlayer();

		Vector3		playerStartPosition = Vector3.zero;

		local_player.transform.position = playerStartPosition + PartyControl.get().getPositionOffset(local_player.control.global_index);
	
		for(int i = 0;i < PartyControl.get().getFriendCount();i++) {

			chrBehaviorPlayer	friend = PartyControl.get().getFriend(i);

			friend.control.cmdSetPositionAnon(playerStartPosition + PartyControl.get().getPositionOffset(friend.control.global_index));
		}

		party_control.setCurrentRoom(room);

		// ボスの作成.

		chrControllerEnemyBase	enemy;

		if(UsesHumanControlForBoss) {

			enemy = CharacterRoot.get().createEnemy("Boss1", "chrControllerEnemyBoss", "chrBehaviorEnemyBoss_Human") as chrControllerEnemyBase;

		} else {

			enemy = CharacterRoot.get().createEnemy("Boss1", "chrControllerEnemyBoss", "chrBehaviorEnemyBoss") as chrControllerEnemyBase;
		}

		enemy.cmdSetPosition(new Vector3 (0.0f, 0.0f, 20.0f));

		// 스테이터스 창.

		Navi.get().createStatusWindows();
	}
Exemple #2
0
    void Awake()
    {
        DontDestroyOnLoad(this);
        s_instance = this;
#if UNITY_EDITOR
        gameObject.AddComponent<LevelEditor>();
#endif
    }
Exemple #3
0
    public void ClickNoticeBtn()
    {
        audioSvc.PlayUIAudio(Constants.UIClickBtn);

        GameRoot.AddTips("没开发完");
    }
Exemple #4
0
	public int		RandomSeedForDebugMax = 100;		//< UseRandomSeedForDebug가 유효한 때 사용하는 랜덤 레인지.

	public override void initializeMap(GameRoot game_root)
	{
		MapCreator mapCreator = MapCreator.getInstance ();

		Vector3 start_position;

		int seed = 0;

		if (UseRandomSeedForDebug)
		{
			seed = Random.Range(RandomSeedForDebugMin, RandomSeedForDebugMax);
		}
		else
		{
			seed = LevelGeneratorSeed;
		}

		// 맵 자동 생성.

		mapCreator.generateLevel(seed);

		// 로컬 플레이어를 작성. FIXME: 통신 대응.
		PartyControl.getInstance().createLocalPlayer(GlobalParam.getInstance().global_account_id);
		
		// Put items including keys.
		mapCreator.generateItems(PartyControl.get().getLocalPlayer().getAcountID());
		
		// Put lairs in the map.
		//mapCreator.generateLairs();
		
		// FIXME: 이곳은 좌표 쓰기 명령이 되는 건가?
		// 일단 좌표를 직접 써넣는다.
		start_position = mapCreator.getPlayerStartPosition();

		PartyControl.getInstance().getLocalPlayer().transform.position = start_position;
		
		mapCreator.createFloorDoor();
		
		// Activate the start room.
		mapCreator.SetCurrentRoom(mapCreator.getRoomFromPosition(start_position));

		{
			string	local_player_id = PartyControl.get().getLocalPlayer().getAcountID();

			ItemManager.getInstance().createItem("cake00",    local_player_id);
			ItemManager.getInstance().createItem("candy00",   local_player_id);
			ItemManager.getInstance().createItem("ice00",     local_player_id);
			
			ItemManager.getInstance().createItem("key00",     local_player_id);
			ItemManager.getInstance().createItem("key01",     local_player_id);
			ItemManager.getInstance().createItem("key02",     local_player_id);
			ItemManager.getInstance().createItem("key03",     local_player_id);
			//ItemManager.getInstance().createItem("key04",     local_player_id);
			
			ItemManager.getInstance().setPositionToItem("cake00",    start_position + new Vector3(2.0f, 0.0f, 0.0f));
			ItemManager.getInstance().setPositionToItem("candy00",   start_position + new Vector3(4.0f, 0.0f, 0.0f));
			ItemManager.getInstance().setPositionToItem("ice00",     start_position + new Vector3(6.0f, 0.0f, 0.0f));
		
			ItemManager.getInstance().setPositionToItem("key00",     start_position + new Vector3( 2.0f, 0.0f, -2.0f));
			ItemManager.getInstance().setPositionToItem("key01",     start_position + new Vector3( 4.0f, 0.0f, -2.0f));
			ItemManager.getInstance().setPositionToItem("key02",     start_position + new Vector3( 6.0f, 0.0f, -2.0f));
			ItemManager.getInstance().setPositionToItem("key03",     start_position + new Vector3( 8.0f, 0.0f, -2.0f));
			//ItemManager.getInstance().setPositionToItem("key04",     start_position + new Vector3(10.0f, 0.0f, -2.0f));
		}
		/*{
			EnemyRoot.getInstance().createEnemy("Enemy_Kumasan").transform.Translate(new Vector3(0.0f, 0.0f, 5.0f));
			EnemyRoot.getInstance().createEnemy("Enemy_Obake").transform.Translate(new Vector3(-5.0f, 0.0f, 5.0f));
		}*/
	}
Exemple #5
0
    //协议处理
    private void ProgressMsg(GameMsg msg)
    {
        CMD       cmd = (CMD)msg.cmd;
        ErrorCode err = (ErrorCode)msg.err;

        //错误码处理
        if (err != ErrorCode.None)
        {
            switch (err)
            {
            case ErrorCode.AcctIsOnline:
                GameRoot.AddTips("当前账号已经在线");
                break;

            case ErrorCode.WrongPass:
                GameRoot.AddTips("账号或密码错误");
                break;

            case ErrorCode.UpdateDBError:
                //GameRoot.AddTips("更改异常");
                PECommon.Log("数据库更新异常", LogType.Error);
                GameRoot.AddTips("网络不稳定");
                break;

            case ErrorCode.ServerDataError:
                GameRoot.AddTips("客户端数据异常");
                break;

            case ErrorCode.MaxStar:
                GameRoot.AddTips("当前部位星级已满");
                break;

            case ErrorCode.LackLevel:
                GameRoot.AddTips("等级不够");
                break;

            case ErrorCode.LackCoin:
                GameRoot.AddTips("金币不足");
                break;

            case ErrorCode.LackDiamond:
                GameRoot.AddTips("钻石不足");
                break;

            case ErrorCode.LackCrystal:
                GameRoot.AddTips("水晶不足");
                break;

            case ErrorCode.LackPower:
                GameRoot.AddTips("体力不足");
                break;

            case ErrorCode.ClientDataError:
                GameRoot.AddTips("客户端数据错误");
                break;
            }

            switch (cmd)
            {
            case CMD.RspBuy:
                MainCitySys.instance.RspBuyError(msg);
                break;
            }

            //接收错误码后消息不进行下一步处理
            return;
        }

        //这是无错误码的情况下进行进一步处理
        //将消息按类型分配给响应模块处理
        switch (cmd)
        {
        case CMD.RspLogin:
            LoginSys.instance.RspLogin(msg);
            break;

        case CMD.RspRename:
            LoginSys.instance.RspRename(msg);
            break;

        case CMD.RspGuide:
            MainCitySys.instance.RspGuide(msg);
            break;

        case CMD.RspStrong:
            MainCitySys.instance.RspStrong(msg);
            break;

        case CMD.PshChat:
            MainCitySys.instance.PshChat(msg);
            break;

        case CMD.RspBuy:
            MainCitySys.instance.RspBuy(msg);
            break;

        case CMD.PshPower:
            MainCitySys.instance.PshPower(msg);
            break;

        case CMD.RspTaskReward:
            MainCitySys.instance.RspTakeTaskReward(msg);
            break;

        case CMD.PshTaskPrgs:
            MainCitySys.instance.PshTaskPrgs(msg);
            break;

        case CMD.RspFBFight:
            FubenSys.instance.RspFBFight(msg);
            break;

        default:
            break;
        }
    }
Exemple #6
0
 private void Start()
 {
     Instance = this;
     DontDestroyOnLoad(this);
     Init();
 }
Exemple #7
0
 public static GameRoot  get()
 {
     return(GameRoot.getInstance());
 }
Exemple #8
0
        private void CreateProjectiles(GameTime gameTime)
        {
            if (Projectiles.Count < projectileCount && (lastProjectile + projectileInterval) < gameTime.TotalGameTime.TotalMilliseconds)
            {
                var projectile = new Projectile(Art.Lazer, GameRoot.ScaleToHighDPI(projectileSize * ScaleX), GameRoot.ScaleToHighDPI(projectileSize * ScaleY));

                projectile.SetPosition(new Vector2(Position.X, Position.Y - (Height / 2)), new Vector2(0, -3 * projectileSpeed));
                Projectiles.Add(projectile);
                lastProjectile = gameTime.TotalGameTime.TotalMilliseconds;
            }
        }
Exemple #9
0
	public virtual void initializeMap(GameRoot game_root)
	{
	}
Exemple #10
0
    public int RandomSeedForDebugMax  = 100;                            //< UseRandomSeedForDebug가 유효한 때 사용하는 랜덤 레인지.

    public override void initializeMap(GameRoot game_root)
    {
        MapCreator mapCreator = MapCreator.getInstance();

        Vector3 start_position;

        int seed = 0;

        if (UseRandomSeedForDebug)
        {
            seed = Random.Range(RandomSeedForDebugMin, RandomSeedForDebugMax);
        }
        else
        {
            seed = LevelGeneratorSeed;
        }

        // 맵 자동 생성.

        mapCreator.generateLevel(seed);

        // 로컬 플레이어를 작성. FIXME: 통신 대응.
        PartyControl.getInstance().createLocalPlayer(GlobalParam.getInstance().global_account_id);

        // Put items including keys.
        mapCreator.generateItems(PartyControl.get().getLocalPlayer().getAcountID());

        // Put lairs in the map.
        //mapCreator.generateLairs();

        // FIXME: 이곳은 좌표 쓰기 명령이 되는 건가?
        // 일단 좌표를 직접 써넣는다.
        start_position = mapCreator.getPlayerStartPosition();

        PartyControl.getInstance().getLocalPlayer().transform.position = start_position;

        mapCreator.createFloorDoor();

        // Activate the start room.
        mapCreator.SetCurrentRoom(mapCreator.getRoomFromPosition(start_position));

        {
            string local_player_id = PartyControl.get().getLocalPlayer().getAcountID();

            ItemManager.getInstance().createItem("cake00", local_player_id);
            ItemManager.getInstance().createItem("candy00", local_player_id);
            ItemManager.getInstance().createItem("ice00", local_player_id);

            ItemManager.getInstance().createItem("key00", local_player_id);
            ItemManager.getInstance().createItem("key01", local_player_id);
            ItemManager.getInstance().createItem("key02", local_player_id);
            ItemManager.getInstance().createItem("key03", local_player_id);
            //ItemManager.getInstance().createItem("key04",     local_player_id);

            ItemManager.getInstance().setPositionToItem("cake00", start_position + new Vector3(2.0f, 0.0f, 0.0f));
            ItemManager.getInstance().setPositionToItem("candy00", start_position + new Vector3(4.0f, 0.0f, 0.0f));
            ItemManager.getInstance().setPositionToItem("ice00", start_position + new Vector3(6.0f, 0.0f, 0.0f));

            ItemManager.getInstance().setPositionToItem("key00", start_position + new Vector3(2.0f, 0.0f, -2.0f));
            ItemManager.getInstance().setPositionToItem("key01", start_position + new Vector3(4.0f, 0.0f, -2.0f));
            ItemManager.getInstance().setPositionToItem("key02", start_position + new Vector3(6.0f, 0.0f, -2.0f));
            ItemManager.getInstance().setPositionToItem("key03", start_position + new Vector3(8.0f, 0.0f, -2.0f));
            //ItemManager.getInstance().setPositionToItem("key04",     start_position + new Vector3(10.0f, 0.0f, -2.0f));
        }

        /*{
         *      EnemyRoot.getInstance().createEnemy("Enemy_Kumasan").transform.Translate(new Vector3(0.0f, 0.0f, 5.0f));
         *      EnemyRoot.getInstance().createEnemy("Enemy_Obake").transform.Translate(new Vector3(-5.0f, 0.0f, 5.0f));
         * }*/
    }
 protected override void OnConnected()
 {
     base.OnConnected();
     GameRoot.AddTips("连接服务器成功!");
 }
Exemple #12
0
 public void RspCreatePlayer()
 {
     GameRoot.AddTips("登录成功");
     createWnd.SetWndState();
     loginWnd.SetWndState(false);
 }
 protected override void OnDisConnected()
 {
     base.OnDisConnected();
     GameRoot.AddTips("断开服务器连接!");
 }
Exemple #14
0
 /// <summary>
 /// Score constructor
 /// </summary>
 /// <param name="game"></param>
 public EndScore(GameRoot game) : base(game)
 {
     this.game   = game;
     this.colour = Color.White;
 }
Exemple #15
0
        public void Portal(int _x, int _y)
        {
            MapField field = GameRoot.GetInstance().MapField;

            field.PortalEntity(this, _x, _y);
        }
	public override void initializeMap(GameRoot game_root)
	{
		MapCreator		map_creator   = MapCreator.get();
		PartyControl	party_control = PartyControl.get();

		map_creator.setRoomNum(1, 1);

		// Floor 루트 생성.
		map_creator.floor_root_go = new GameObject("Floor");

		// 무기 선택 플로어에서는 방의 블록을 3 x 4로 변경.
		map_creator.setRoomGridNum(3, 4);

		// 방 만들기.
		RoomController room = map_creator.createRoomFloor(new Map.RoomIndex(0, 0));

		// 더미 방 만들기.
		RoomController	vacancy = map_creator.createVacancy(new Map.RoomIndex(0, -1));

		// 방 구분 벽 만들기.
		map_creator.createRoomWall();

		// 외벽 만들기.
		GameObject	outer_walls = map_creator.createOuterWalls();

		// 플로어 이동 도어를 하나만 만든다.
		map_creator.createFloorDoor(new Map.RoomIndex(0, 0), new Map.BlockIndex(1, 3), Map.EWSN.NORTH);

		// ---------------------------------------------------------------- //

		Renderer[]	renderers = outer_walls.GetComponentsInChildren<Renderer>();

		foreach(var render in renderers) {

			render.material.shader = this.map_shader;
		}

		//

		renderers = vacancy.GetComponentsInChildren<Renderer>();

		foreach(var render in renderers) {

			render.material.shader = this.map_shader;
		}

		renderers = room.GetComponentsInChildren<Renderer>();

		foreach(var render in renderers) {

			render.material.shader = this.map_shader;
		}

		// ---------------------------------------------------------------- //
		// 무 아저씨.

		chrController	kabusan = CharacterRoot.get().createNPC("NPC_Kabu_San");

		kabusan.cmdSetPositionAnon(chrBehaviorKabu.getStayPosition());
		kabusan.cmdSetDirectionAnon(chrBehaviorKabu.getStayDirection());

		// ---------------------------------------------------------------- //
		// 로컬 플레이어.

		party_control.createLocalPlayer(GlobalParam.getInstance().global_account_id);

		chrBehaviorLocal	player = PartyControl.get().getLocalPlayer();

		player.control.cmdSetPositionAnon(new Vector3( 0.0f, 0.0f, -9.0f));
		player.changeBulletShooter(SHOT_TYPE.EMPTY);

		// ---------------------------------------------------------------- //
		// 아이템 생성.

		this.generateItems(game_root);

		party_control.setCurrentRoom(room);

		ItemWindow.get().setActive(false);
	}
Exemple #17
0
    public void ShowTimer(GameMsg msg)
    {
        ShowTimer showTimer = msg.showTimer;

        GameRoot.AddTips(showTimer.time.ToString());
    }
Exemple #18
0
    private void Awake()
    {
        current = this;

        if (saboteur == -1)
        {
            StartCoroutine(StartSaboteurSequence());
        }
    }
Exemple #19
0
 override public void EnterScene()
 {
     GameRoot.GetInstance().StartBattle();
 }
Exemple #20
0
 /// <summary>
 /// Title constructor
 /// </summary>
 /// <param name="game"></param>
 /// <param name="text"></param>
 public Title(GameRoot game, string text) : base(game)
 {
     this.game   = game;
     this.colour = Color.White;
     this.text   = string.IsNullOrEmpty(text) ? "Placeholder" : text;
 }
Exemple #21
0
    //#################
    //	Update
    //#################
    void Update()
    {
        //現在のアニメーション名を取得
        AnimatorStateInfo animStateInfo = animator.GetCurrentAnimatorStateInfo(0);

        //-------------------------//
        //	状態の切り替えチェック
        //-------------------------//
        //このUpdateまでに次ステップが決まっていなければ
        //次ステップの状態を現ステップと変えるべきかどうかチェックする
        //ジャンプが押されたか、着地しているか、などなど
        //特に状態を変えなくてよい場合、nextStepはNONEのままになる
        if (this.nextStep == STEP.NONE)
        {
            switch (this.step)
            {
            case STEP.IDLE:
                //攻撃ボタンが押されたら、次のステップ->ATTACK
                if (Input.GetMouseButtonDown(0))
                {
                    this.nextStep = STEP.ATTACK;
                    GameRoot.log("playTime : " + GameRoot.gameTimer);
                    GameRoot.log("PLAYER -> ATTACK");
                }
                break;

            case STEP.ATTACK:
                //攻撃判定有効時間が終わっていたら、次のステップ->IDLE
                if (attackTimer < 0.0f)
                {
                    this.nextStep = STEP.IDLE;
                    GameRoot.log("playTime : " + GameRoot.gameTimer);
                    GameRoot.log("PLAYER -> ATTACK END");
                }
                break;

            case STEP.DAMAGED:
                //現在のアニメーションが「待機」になっていたら、次のステップ->IDLE
                if (animStateInfo.fullPathHash == stateIdle)
                {
                    this.nextStep = STEP.IDLE;
                    GameRoot.log("playTime : " + GameRoot.gameTimer);
                    GameRoot.log("PLAYER -> IDLE");
                }
                break;

            default:
                break;
            }
        }

        //=========================//
        //	状態変化時の初期処理
        //=========================//
        //次ステップが決まっている場合、それは状態が変化するということなので
        //その際に必要な処理を実行
        //状態が変化しない場合はこの中には入らない
        //whileを使っているので、nextStepがNONEにならない限り、繰り返し処理し続ける
        while (this.nextStep != STEP.NONE)
        {
            this.step     = this.nextStep;
            this.nextStep = STEP.NONE;
            //一旦すべてのアニメーションフラグをfalseにする
            animator.SetBool("Idle", false);
            animator.SetBool("Attack", false);
            animator.SetBool("Damaged", false);

            switch (this.step)
            {
            case STEP.IDLE:
                //攻撃判定オブジェクトを非アクティブにする
                //DAMAGEDから遷移してくる時は必要ない処理なのだが…
                transform.Find("AttackRange").gameObject.SetActive(false);
                animator.SetBool("Idle", true);
                break;

            case STEP.ATTACK:
                animator.SetBool("Attack", true);
                //攻撃判定オブジェクトをアクティブにする
                transform.Find("AttackRange").gameObject.SetActive(true);
                //攻撃判定発生タイマーを起動
                attackTimer = ATTACK_TIME;

                //ボイス
                vc = (Random.value < 0.5)? VCattack01 : VCattack02;
                audiosrc.PlayOneShot(vc);

                GameRoot.log("PLAYER -> ATTACK START!");
                break;

            case STEP.DAMAGED:
                animator.SetBool("Damaged", true);
                //ボイス
                vc = (Random.value < 0.5)? VCdamaged01 : VCdamaged02;
                audiosrc.PlayOneShot(vc);
                break;

            default:
                break;
            }
        }

        //=========================//
        //	毎フレームの処理
        //=========================//
        //現ステップの状態に応じた各種処理
        //移動速度の調整など
        switch (this.step)
        {
        case STEP.IDLE:
            break;

        case STEP.ATTACK:
            //攻撃判定発生タイマーをカウントダウン
            attackTimer -= Time.deltaTime;
            break;

        case STEP.DAMAGED:
            break;

        default:
            break;
        }
    }
Exemple #22
0
    private void ProcessMsg(GameMsg msg)
    {
        if (msg.err != (int)ErrorCode.None)
        {
            switch ((ErrorCode)msg.err)
            {
            case ErrorCode.ServerDataError:
                PECommon.Log("服务器数据异常", LogType.Error);
                GameRoot.AddTips("客户端数据异常");
                break;

            case ErrorCode.UpdateDBError:
                PECommon.Log("数据库更新异常", LogType.Error);
                GameRoot.AddTips("网络不稳定");
                break;

            case ErrorCode.ClientDataError:
                PECommon.Log("客户端数据异常", LogType.Error);
                break;

            case ErrorCode.AcctIsOnline:
                GameRoot.AddTips("当前账号已经上线");
                break;

            case ErrorCode.WrongPass:
                GameRoot.AddTips("密码错误");
                break;

            case ErrorCode.LackLevel:
                GameRoot.AddTips("角色等级不够");
                break;

            case ErrorCode.LackCoin:
                GameRoot.AddTips("金币数量不够");
                break;

            case ErrorCode.LackCrystal:
                GameRoot.AddTips("水晶数量不够");
                break;

            case ErrorCode.LackDiamond:
                GameRoot.AddTips("钻石数量不够");
                break;
            }
            return;
        }
        switch ((CMD)msg.cmd)
        {
        case CMD.RspLogin:
            LoginSys.Instance.RspLogin(msg);
            break;

        case CMD.RspRename:
            LoginSys.Instance.RspRename(msg);
            break;

        case CMD.RspGuide:
            MainCitySys.Instance.RspGuide(msg);
            break;

        case CMD.RspStrong:
            MainCitySys.Instance.RspStrong(msg);
            break;

        case CMD.PshChat:
            MainCitySys.Instance.PshChat(msg);
            break;

        case CMD.RspBuy:
            MainCitySys.Instance.RspBuy(msg);
            break;

        case CMD.PshPower:
            MainCitySys.Instance.PshPower(msg);
            break;

        case CMD.RspTakeTaskReward:
            MainCitySys.Instance.RspTakeTaskReward(msg);
            break;

        case CMD.PshTaskPrgs:
            MainCitySys.Instance.PshTaskPrgs(msg);
            break;
        }
    }
Exemple #23
0
    /// <summary>
    /// 消息分发处理
    /// </summary>
    /// <param name="msg"></param>
    private void ProcessMsg(GameMsg msg)
    {
        // 错误码提示处理
        if (msg.err != (int)ErrorCode.None)
        {
            switch ((ErrorCode)msg.err)
            {
            case ErrorCode.UpdateDBError:
                Common.Log("数据库更新异常", LogType.Error);
                GameRoot.AddTips("网络不稳定");
                break;

            case ErrorCode.AcctIsOnline:
                GameRoot.AddTips("当前账号已被登陆");
                break;

            case ErrorCode.WrongPassword:
                GameRoot.AddTips("密码错误");
                break;

            case ErrorCode.ServerDataError:
                Common.Log("服务器数据与客户端数据不一致,客户端可能外挂", LogType.Error);
                GameRoot.AddTips("客户端数据异常");
                break;

            case ErrorCode.ClientDataError:
                Common.Log("客户端数据与客户端数据不一致,客户端可能外挂", LogType.Error);
                break;

            case ErrorCode.LackLevel:
                GameRoot.AddTips("角色等级不够");
                break;

            case ErrorCode.LackCoin:
                GameRoot.AddTips("金币数量不够");
                break;

            case ErrorCode.LackCrystal:
                GameRoot.AddTips("水晶数量不够");
                break;

            case ErrorCode.LackPower:
                GameRoot.AddTips("体力数量不够");
                break;

            default:
                break;
            }

            return;
        }

        // 消息分发处理
        switch ((CMD)msg.cmd)
        {
        case CMD.RspLogin:
            LoginSys.Instance.RspLogin(msg);
            break;

        case CMD.RspRename:
            LoginSys.Instance.RspRename(msg);
            break;

        case CMD.RspGuide:
            MainCitySys.Instance.RspGuide(msg);
            break;

        case CMD.RspStrong:
            MainCitySys.Instance.RspStrong(msg);
            break;

        case CMD.PshChat:
            MainCitySys.Instance.PshChat(msg);
            break;

        case CMD.RspBuy:
            MainCitySys.Instance.RspBuy(msg);
            break;

        case CMD.PshPower:
            MainCitySys.Instance.PshPower(msg);
            break;

        case CMD.RspTakeTaskReward:
            MainCitySys.Instance.RspTakeTaskReward(msg);
            break;

        case CMD.PshTaskPrgs:
            MainCitySys.Instance.PshTaskPrgs(msg);
            break;

        case CMD.RspFBFight:
            FubenSys.Instance.RspFBFight(msg);
            break;

        case CMD.RspFBFightEnd:
            BattleSys.Instance.RspFBFightEnd(msg);
            break;
        }
    }
Exemple #24
0
    void    Update()
    {
        this.scene_timer += Time.deltaTime;
        this.disp_timer  -= Time.deltaTime;

        // ---------------------------------------------------------------- //
        // 다음 상태로 이동할지 체크합니다.

        switch (this.step.do_transition())
        {
        case STEP.GAME:
        {
        }
        break;
        }

        // ---------------------------------------------------------------- //
        // 상태가 전환될 때 초기화.

        while (this.step.get_next() != STEP.NONE)
        {
            switch (this.step.do_initialize())
            {
            case STEP.CHARACTER_CHANGE:
            {
                GlobalParam.get().account_name     = this.account_name_net;
                GlobalParam.get().skip_enter_event = true;

                Application.LoadLevel("GameScene 1");
            }
            break;

            case STEP.GAME:
            {
                this.account_name_local = GlobalParam.get().account_name;
                this.account_name_net   = GameRoot.getPartnerAcountName(this.account_name_local);

                if (this.owner == this.account_name_local)
                {
                    this.is_host = true;
                }
                else
                {
                    // 다른 플레이어의 마을에 갔을 때.
                    this.is_host = false;
                }

                // 플레이어를 만듭니다.
                this.local_player = CharacterRoot.get().createPlayerAsLocal(this.account_name_local);

                this.local_player.cmdSetPosition(Vector3.zero);

                if (GlobalParam.get().is_in_my_home == GlobalParam.get().is_remote_in_my_home)
                {
                    this.net_player = CharacterRoot.get().createPlayerAsNet(this.account_name_net);

                    this.net_player.cmdSetPosition(Vector3.left * 1.0f);
                }

                // 레벨 데이터(level_data.txt)를 읽고 NPC/아이템을 배치합니다.
                MapCreator.get().loadLevel(this.account_name_local, this.account_name_net, !this.is_host);

                SoundManager.get().playBGM(Sound.ID.TFT_BGM01);

                //

                if (!GlobalParam.get().skip_enter_event)
                {
                    EnterEvent enter_event = EventRoot.get().startEvent <EnterEvent>();

                    if (enter_event != null)
                    {
                        enter_event.setPrincipal(this.local_player.behavior as chrBehaviorPlayer);
                        enter_event.setIsLocalPlayer(true);
                    }
                }

                foreach (ItemManager.ItemState istate in GlobalParam.get().item_table.Values)
                {
                    if (istate.state == ItemController.State.Picked)
                    {
                        // 이미 아이템을 획득했다면 가져갈 수 있게 합니다.
                        ItemManager.get().finishGrowingItem(istate.item_id);
                        chrController controll = CharacterRoot.getInstance().findPlayer(istate.owner);
                        if (controll != null)
                        {
                            QueryItemPick query = controll.cmdItemQueryPick(istate.item_id, false, true);
                            if (query != null)
                            {
                                query.is_anon = true;
                                query.set_done(true);
                                query.set_success(true);
                            }
                        }
                    }
                }
            }
            break;

            // 다른 플레이어가 찾아왔습니다.
            case STEP.WELCOME:
            {
                if (this.net_player == null)
                {
                    EnterEvent enter_event = EventRoot.get().startEvent <EnterEvent>();

                    if (enter_event != null)
                    {
                        this.net_player = CharacterRoot.getInstance().createPlayerAsNet(this.account_name_net);

                        this.net_player.cmdSetPosition(Vector3.left);

                        enter_event.setPrincipal(this.net_player.behavior as chrBehaviorPlayer);
                        enter_event.setIsLocalPlayer(false);
                    }
                }
            }
            break;

            // 다른 플레이어가 돌아갑니다.
            case STEP.BYEBYE:
            {
                if (this.net_player != null)
                {
                    LeaveEvent leave_event = EventRoot.get().startEvent <LeaveEvent>();

                    if (leave_event != null)
                    {
                        leave_event.setPrincipal(this.net_player.behavior as chrBehaviorPlayer);
                        leave_event.setIsLocalPlayer(false);
                    }
                }
            }
            break;

            case STEP.VISIT:
            {
                GlobalParam.get().is_in_my_home = false;
                Application.LoadLevel("GameScene 1");
            }
            break;

            case STEP.GO_HOME:
            {
                // 자기 마을로 돌아옵니다.
                GlobalParam.get().is_in_my_home = true;
                Application.LoadLevel("GameScene 1");
            }
            break;

            case STEP.TO_TITLE:
            {
                Application.LoadLevel("TitleScene");
            }
            break;
            }
        }

        // ---------------------------------------------------------------- //
        // 각 상태에서의 실행 처리.

        switch (this.step.do_execution(Time.deltaTime))
        {
        case STEP.GAME:
        {
        }
        break;
        }

        // ---------------------------------------------------------------- //
        // 통신에 의한 이벤트 처리.

        // Network 클래스의 컴포넌트 획득.
        GameObject go      = GameObject.Find("Network");
        Network    network = go.GetComponent <Network>();

        if (network != null)
        {
            if (network.IsCommunicating() == true)
            {
                if (request_connet_event)
                {
                    // 접속 이벤트를 발동합니다.
                    GlobalParam.get().is_connected = true;
                    request_connet_event = false;
                }
                else if (GlobalParam.get().is_connected == false)
                {
                    // 접속했습니다.
                    Debug.Log("Guest connected.");
                    request_connet_event = true;
                    disp_timer           = 5.0f;
                }
            }
        }

        // 접속 종료 이벤트를 발동합니다.
        if (request_disconnet_event)
        {
            GlobalParam.get().is_disconnected = true;
            request_disconnet_event = false;
            // 접속 종료 시 이벤트.
            disconnect_event();
        }

        // ---------------------------------------------------------------- //

        if (Input.GetKeyDown(KeyCode.Z))
        {
            dbwin.console().print("로그 테스트 " + this.log_test_count);
            this.log_test_count++;
        }
    }
Exemple #25
0
    public void ClickNotice()
    {
        GameRoot.AddTips("该模块暂时未开发!");

        audioSvc.PlayUIAudio(Constants.UIClickBtn);
    }
Exemple #26
0
        public override void UpdateScale(float scaleX, float scaleY, float screenWidth, float screenHeight)
        {
            foreach (var projectile in Projectiles)
            {
                projectile.UpdateScale(GameRoot.ScaleToHighDPI(projectileSize * scaleX), GameRoot.ScaleToHighDPI(projectileSize * scaleY), screenWidth, screenHeight);
            }

            base.UpdateScale(scaleX, scaleY, screenWidth, screenHeight);
        }
 public void ClickNoticeBtn()
 {
     GameRoot.AddTips("功能正在开发中...");
 }
Exemple #28
0
 public void ClickNoticeBtn()
 {
     audioSev.PlayUIAudio(Constans.UIClickBtnAudio);
     GameRoot.AddTips("功能开发中...");
 }
Exemple #29
0
    public override void    execute()
    {
        CameraControl camera = CameraControl.get();

        // ---------------------------------------------------------------- //
        // 다음 상태로 이행할지 체크합니다..

        switch (this.step.do_transition())
        {
        // 이벤트 시작.
        case STEP.START:
        {
            this.step.set_next(STEP.OPEN_DOOR);
            //camera.module.parallelMoveTo(this.get_locator_position("cam_loc_0"));

            // 맵에 연관되지 않은 아이템은 가지고 돌아감.
            bool           isPickingup = false;
            string         current_map = MapCreator.get().getCurrentMapName();
            ItemController itemYuzu    = ItemManager.get().findItem("Yuzu");
            if (itemYuzu != null && itemYuzu.isActive())
            {
                if (current_map != itemYuzu.getProduction())
                {
                    // 가지고 돌아기는 아이템이 있었다.
                    this.player.controll.cmdItemQueryPick(itemYuzu.name, true, true);
                    isPickingup = true;
                }
            }

            ItemController itemNegi = ItemManager.get().findItem("Negi");
            if (itemNegi != null && itemNegi.isActive())
            {
                if (current_map != itemNegi.getProduction())
                {
                    // 가지고 돌아가는 아이템이 있었다.
                    this.player.controll.cmdItemQueryPick(itemNegi.name, true, true);
                    isPickingup = true;
                }
            }

            if (this.player.controll.item_carrier.isCarrying() && isPickingup == false)
            {
                ItemController item = this.player.controll.item_carrier.getItem();
                if (item.isExportable() == false)
                {
                    // 가지고 나갈 수 없는 것은 두고 갑니다.
                    QueryItemDrop query_drop = this.player.controll.cmdItemQueryDrop();

                    query_drop.is_drop_done = true;

                    this.player.controll.cmdItemDrop(this.player.controll.account_name);
                }
            }
        }
        break;

        // 배추가 옆으로 움직이고 & 대야가 등장.
        case STEP.OPEN_DOOR:
        {
            if (this.hakusai_fcurve.isDone() && this.tarai_fcurve.isDone())
            {
                this.step.set_next(STEP.RIDE_TARAI_0);
            }
        }
        break;

        // 대야를 탑니다(기슭까지 걷는다).
        case STEP.RIDE_TARAI_0:
        {
            if (!this.player_move.isMoving())
            {
                this.step.set_next(STEP.RIDE_TARAI_1);
            }
        }
        break;

        // 대야를 탑니다(대야를 향해 점프).
        case STEP.RIDE_TARAI_1:
        {
            if (!this.player_jump.isMoving())
            {
                this.step.set_next(STEP.CLOSE_DOOR);
            }
        }
        break;

        // 배추가 돌아오고 & 대야가 밖을 향해 이동.
        case STEP.CLOSE_DOOR:
        {
            if (this.hakusai_fcurve.isDone() && this.tarai_fcurve.isDone())
            {
                this.step.set_next(STEP.END);
            }
        }
        break;

        case STEP.END:
        {
            camera.module.popPosture();

            this.step.set_next(STEP.IDLE);
        }
        break;
        }

        // ---------------------------------------------------------------- //
        // 상태가 전환할 때의 초기화.

        while (this.step.get_next() != STEP.NONE)
        {
            dbwin.console().print(this.step.ToString());

            switch (this.step.do_initialize())
            {
            // 이벤트 시작.
            case STEP.START:
            {
                camera.module.pushPosture();

                this.player.beginOuterControll();
                this.tarai_fune.transform.position = this.tarai_enter_spline.curve.cvs.front().position;
            }
            break;

            // 배추가 옆으로 움직이고 & 대야가 등장.
            case STEP.OPEN_DOOR:
            {
                this.hakusai_set.setControl(true);
                this.hakusai_fcurve.setSlopeAngle(10.0f, 10.0f);
                this.hakusai_fcurve.setDuration(4.0f);
                this.hakusai_fcurve.start();
                this.hakusai_tracer.restart();

                this.tarai_fcurve.setSlopeAngle(60.0f, 10.0f);
                this.tarai_fcurve.setDuration(2.0f);
                this.tarai_fcurve.setDelay(2.0f);
                this.tarai_fcurve.start();
            }
            break;

            // 대야를 탑니다(기슭까지 걷는다).
            case STEP.RIDE_TARAI_0:
            {
                this.player_move.position.start = this.player.controll.getPosition();
                this.player_move.position.goal  = this.get_locator_position("chr_loc_0");
                this.player_move.startConstantVelocity(chrBehaviorLocal.MOVE_SPEED);
            }
            break;

            // 대야를 탑니다(대야를 향해서 점프).
            case STEP.RIDE_TARAI_1:
            {
                Vector3 start = this.player.controll.getPosition();
                Vector3 goal  = this.tarai_enter_spline.curve.cvs.back().position;

                this.player_jump.start(start, goal, 1.0f);
            }
            break;

            // 배추가 돌아오고 & 대야가 밖을 향해 이동.
            case STEP.CLOSE_DOOR:
            {
                this.hakusai_fcurve.setSlopeAngle(10.0f, 10.0f);
                this.hakusai_fcurve.setDuration(4.0f);
                this.hakusai_fcurve.start();
                this.hakusai_tracer.restart();
                this.hakusai_tracer.setCurrentByDistance(this.hakusai_tracer.curve.calcTotalDistance());

                this.tarai_tracer.attach(this.tarai_leave_spline.curve);
                this.tarai_tracer.restart();
                this.tarai_fcurve.reset();
                this.tarai_fcurve.setSlopeAngle(20.0f, 60.0f);
                this.tarai_fcurve.setDuration(2.0f);
                this.tarai_fcurve.start();
            }
            break;

            case STEP.END:
            {
                // 이벤트 종료.
                this.hakusai_set.reset();
                this.hakusai_set.setControl(false);

                if (this.is_local_player)
                {
                    if (this.is_map_change)
                    {
                        GlobalParam.get().skip_enter_event = false;
                        GlobalParam.get().fadein_start     = false;

                        if (GlobalParam.get().is_in_my_home)
                        {
                            GameRoot.get().step.set_next(GameRoot.STEP.VISIT);
                        }
                        else
                        {
                            GameRoot.get().step.set_next(GameRoot.STEP.GO_HOME);
                        }

                        // 정원 이동을 알림.
                        if (GlobalParam.get().request_move_home)
                        {
                            Debug.Log("NotifyFieldMoving Leave END.");
                            GameRoot.get().NotifyFieldMoving();
                        }
                    }
                    else
                    {
                        GlobalParam.get().is_in_my_home = !GlobalParam.get().is_in_my_home;
                        this.player.controll.cmdSetPosition(this.initial_player_position);
                        this.player.endOuterControll();
                    }
                }
                else
                {
                    // 아이템을 비활성화하고 나서 드롭하지 않으면 재생합니다.

                    ItemBehaviorFruit fruit = this.player.controll.getCarriedItem <ItemBehaviorFruit>();

                    if (fruit != null)
                    {
                        fruit.activeItem(false);
                    }

                    // 맵 이동이 없을 때 아이템을 가지고 돌아온 경우 아이템의 게임 오브젝트를.
                    // 폐기하지 않게 하고자 아이템을 버립니다.
                    this.player.controll.cmdItemDrop(this.player.name);

                    CharacterRoot.get().deletaCharacter(this.player.controll);
                }

                this.player = null;
            }
            break;
            }
        }

        // ---------------------------------------------------------------- //
        // 각 상태에서의 실행 처리.

        switch (this.step.do_execution(Time.deltaTime))
        {
        // 배추가 옆으로 움직이고 & 대야가 등장.
        case STEP.OPEN_DOOR:
        {
            this.hakusai_fcurve.execute(Time.deltaTime);
            this.hakusai_tracer.proceedToDistance(this.hakusai_tracer.curve.calcTotalDistance() * this.hakusai_fcurve.getValue());
            this.hakusai_set.setPosition(this.hakusai_tracer.getCurrent().position);

            this.tarai_fcurve.execute(Time.deltaTime);
            this.tarai_tracer.proceedToDistance(this.tarai_tracer.curve.calcTotalDistance() * this.tarai_fcurve.getValue());
            this.tarai_fune.setPosition(this.tarai_tracer.getCurrent().position);

            if (this.tarai_fcurve.isTriggerDone())
            {
                this.ripple_effect.is_created = false;
            }
        }
        break;

        // 대야를 탑니다(기슭까지 걷는다).
        case STEP.RIDE_TARAI_0:
        {
            this.player_move.execute(Time.deltaTime);
            this.player.controll.cmdSetPosition(this.player_move.position.current);
            this.player.controll.cmdSmoothHeadingTo(this.player_move.position.goal);
            this.player.playWalkMotion();
        }
        break;

        // 대야를 탑니다(대야를 향해서 점프).
        case STEP.RIDE_TARAI_1:
        {
            this.player_jump.execute(Time.deltaTime);
            this.player.controll.cmdSetPosition(this.player_jump.position);
            this.player.controll.cmdSmoothHeadingTo(this.player_jump.goal);
            this.player.stopWalkMotion();

            if (this.player_jump.is_trigger_bounce && this.player_jump.bounce_count == 1)
            {
                this.ripple_effect.is_created = false;
            }
        }
        break;

        // 배추가 돌아오고 & 대야가 밖을 향해 이동.
        case STEP.CLOSE_DOOR:
        {
            this.hakusai_fcurve.execute(Time.deltaTime);
            this.hakusai_tracer.proceedToDistance(this.hakusai_tracer.curve.calcTotalDistance() * (1.0f - this.hakusai_fcurve.getValue()));
            this.hakusai_set.setPosition(this.hakusai_tracer.cv.position);

            this.tarai_fcurve.execute(Time.deltaTime);
            this.tarai_tracer.proceedToDistance(this.tarai_tracer.curve.calcTotalDistance() * this.tarai_fcurve.getValue());

            SimpleSpline.ControlVertex cv = this.tarai_tracer.getCurrent();

            this.tarai_fune.setPosition(cv.position);
            this.player.controll.cmdSetPosition(cv.position);
            this.player.controll.cmdSmoothHeadingTo(cv.position + cv.tangent.Y(0.0f));
            this.player.stopWalkMotion();
        }
        break;
        }

        // 대야 뒤에 나오는 물결.
        if (!this.ripple_effect.is_created || Vector3.Distance(this.ripple_effect.last_position, this.tarai_fune.getPosition()) > 2.0f)
        {
            this.ripple_effect.is_created    = true;
            this.ripple_effect.last_position = this.tarai_fune.transform.position;

            EffectRoot.get().createRipple(this.ripple_effect.last_position);
        }

        // ---------------------------------------------------------------- //
    }
Exemple #30
0
 static void Main()
 {
     using (var game = new GameRoot())
         game.Run();
 }
Exemple #31
0
 protected override void OnConnected()
 {
     GameRoot.AddTips("连接服务器成功");
     PECommon.Log("Connect To Server Succ");
 }
    // 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;
    }
Exemple #33
0
 protected override void OnDisConnected()
 {
     GameRoot.AddTips("服务器断开连接");
     PECommon.Log("DisConnect To Server");
 }
Exemple #34
0
	public int		RandomSeedForDebugMax = 1000;	//< UseRandomSeedForDebug가 유효한 때 사용하는 랜덤 레인지.

	public override void initializeMap(GameRoot game_root)
	{
		MapCreator mapCreator = MapCreator.getInstance ();
		Vector3 playerStartPosition;
		int seed = 0;

		if (UseRandomSeedForDebug)
		{
			TimeSpan ts = new TimeSpan(DateTime.Now.Ticks);
			double seconds = ts.TotalSeconds;
			seed = (int) ((long)seconds - (long)(seconds/1000.0)*1000);
			//seed = Random.Range(RandomSeedForDebugMin, RandomSeedForDebugMax);
		}
		else
		{
			seed = GlobalParam.get().seed;
		}

		// 맵 자동 생성.
		Debug.Log("Use random seed:" + seed);
		mapCreator.generateLevel(seed);

		GameRoot.get().createLocalPlayer();
		GameRoot.get().createNetPlayers();

		chrBehaviorLocal	local_player = PartyControl.get().getLocalPlayer();

		// 아이템을 만든다.
		mapCreator.generateItems(local_player.getAcountID());
		
		mapCreator.createFloorDoor();

		// 플레이어의 위치 설정.

		playerStartPosition = mapCreator.getPlayerStartPosition();

		local_player.transform.position = playerStartPosition + PartyControl.get().getPositionOffset(local_player.control.global_index);
	
		for(int i = 0;i < PartyControl.get().getFriendCount();i++) {

			chrBehaviorPlayer	friend = PartyControl.get().getFriend(i);

			friend.control.cmdSetPositionAnon(playerStartPosition + PartyControl.get().getPositionOffset(friend.control.global_index));
		}

		PartyControl.get().setCurrentRoom(mapCreator.getRoomFromPosition(playerStartPosition));

		// 스테이터스 윈도우.

		Navi.get().createStatusWindows();

		//

		//

#if false
		string	local_player_id = PartyControl.get().getLocalPlayer().getAcountID();

		ItemManager.get().createItem("candy00", local_player_id);
		ItemManager.get().setPositionToItem("candy00", playerStartPosition + new Vector3( 0.0f, 0.0f,  4.0f));

		ItemManager.get().createItem("ice00", local_player_id);
		ItemManager.get().setPositionToItem("ice00", playerStartPosition + new Vector3( 7.0f, 0.0f,  0.0f));

		ItemManager.get().createItem("key00", local_player_id);
		ItemManager.get().setPositionToItem("key00", playerStartPosition + new Vector3(10.0f, 0.0f,  0.0f));
		ItemManager.get().createItem("key01", local_player_id);
		ItemManager.get().setPositionToItem("key01", playerStartPosition + new Vector3(10.0f, 0.0f,  0.0f));
		ItemManager.get().createItem("key02", local_player_id);
		ItemManager.get().setPositionToItem("key02", playerStartPosition + new Vector3(10.0f, 0.0f,  0.0f));
		ItemManager.get().createItem("key03", local_player_id);
		ItemManager.get().setPositionToItem("key03", playerStartPosition + new Vector3(10.0f, 0.0f,  0.0f));
#endif
	}
Exemple #35
0
    // Update is called once per frame
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Z))
        {
            if (!topCameraActive)
            {
                mainCamera.SetActive(false);
                topCamera.SetActive(true);
                topCameraActive = true;
            }
            else if (topCameraActive)
            {
                mainCamera.SetActive(true);
                topCamera.SetActive(false);
                topCameraActive = false;
            }
        }
        if (!MovementComplete)
        {
            if (Input.GetKeyDown(KeyCode.W))
            {
                W.GetComponent <Text>().color = Color.green;
                wComplete = true;
            }
            if (Input.GetKeyDown(KeyCode.A))
            {
                A.GetComponent <Text>().color = Color.green;
                aComplete = true;
            }
            if (Input.GetKeyDown(KeyCode.S))
            {
                S.GetComponent <Text>().color = Color.green;
                sComplete = true;
            }
            if (Input.GetKeyDown(KeyCode.D))
            {
                D.GetComponent <Text>().color = Color.green;
                dComplete = true;
            }
            if (dComplete && wComplete && aComplete && sComplete)
            {
                MovementTutorial.SetActive(false);
                TopViewTutorial.SetActive(true);
                MovementComplete = true;
            }
        }

        if (MovementComplete && !zComplete)
        {
            if (Input.GetKeyDown(KeyCode.Z) && zpressedonce == false)
            {
                Z.GetComponent <Text>().color = Color.green;
                zpressedonce = true;
            }

            else if (Input.GetKeyDown(KeyCode.Z) && zpressedonce)
            {
                Z2.GetComponent <Text>().color = Color.green;
                zpressedtwice = true;
            }

            if (zpressedonce && zpressedtwice)
            {
                TopViewTutorial.SetActive(false);
                FieldInput.SetActive(true);
                Questions.SetActive(true);
                zComplete = true;
            }
        }

        if (MovementComplete && zComplete && !rotateComplete)
        {
            if (inputedText == "5")
            {
                Debug.Log("Correct awnser inputted");
                FieldInput.SetActive(false);
                Questions.SetActive(false);
                SelectionTutorial.SetActive(true);
                rotateComplete = true;
            }
            if (Input.GetKeyDown(KeyCode.P))
            {
                Debug.Log(inputedText);
            }
        }

        if (MovementComplete && zComplete && rotateComplete)
        {
            if (selectionComplete)
            {
                SelectionTutorial.SetActive(false);
                Congrats.SetActive(true);
            }
        }



        // player = GameObject.FindGameObjectWithTag("Player");
        if (player.transform.position == previousPosition)
        {
            Debug.Log("Not Moving");
            timer += (int)Time.deltaTime;
            if (timer == 30)
            {
                GameRoot.ShowTips("Press 'R' to reset position.", true, false);
            }
        }
        else
        {
            Debug.Log("Moving");
            timer = 0;
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            player.transform.position = startPosition;
            Debug.Log("R pressed");
        }


        previousPosition = player.transform.position;
    }
	// 맵에 아이텝을 배치하는 메소드.
	private void generateItems(GameRoot gameRoot)
	{
		string	local_player_id = PartyControl.get().getLocalPlayer().getAcountID();

		string item_type = "shot_negi";
		string item_name = item_type + "." + local_player_id;
		ItemManager.get().createItem(item_type, item_name, local_player_id);
		ItemManager.get().setPositionToItem(item_name, WeaponSelectMapInitializer.getNegiItemPosition());

		item_type = "shot_yuzu";
		item_name = item_type + "." + local_player_id;
		ItemManager.get().createItem(item_type, item_name, local_player_id);
		ItemManager.get().setPositionToItem(item_name, WeaponSelectMapInitializer.getYuzuItemPosition());
	}
Exemple #37
0
 // Start is called before the first frame update
 private void Awake()
 {
     _instance = this;
     DontDestroyOnLoad(this);
     Init();
 }
Exemple #38
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();
    }
Exemple #39
0
    //当鼠标位于这个collider之上的时候,会在每一帧调用这个方法
    protected void OnMouseOver()
    {
        //当点击了NPC之后
        if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject())
        {
            if (isInGround)
            {
                //点击宝箱事件
                //OnMouseClick();

                //宝箱是打开状态下,锁定状态自动变为解锁
                if (isOn)
                {
                    isLocked = false;
                }
                if (isLocked)
                {
                    GameRoot.AddTips("宝箱锁住了,无法打开");
                    if (chestAudio != null)
                    {
                        chestAudio.clip = AudioManager.Instance.LoadAudioClip("Sound/wood_box_locked", true);
                        if (chestAudio.isPlaying)
                        {
                            chestAudio.Stop();
                        }
                        chestAudio.Play();
                    }
                }
                else
                {
                    isOn = !isOn;
                    if (isOn)
                    {
                        if (chestAudio != null)
                        {
                            chestAudio.clip = AudioManager.Instance.LoadAudioClip("Sound/wood_box_opened", true);
                            if (chestAudio.isPlaying)
                            {
                                chestAudio.Stop();
                            }
                            chestAudio.Play();
                        }
                    }
                    else
                    {
                        if (chestAudio != null)
                        {
                            chestAudio.clip = AudioManager.Instance.LoadAudioClip("Sound/wood_box_closed1", true);
                            if (chestAudio.isPlaying)
                            {
                                chestAudio.Stop();
                            }
                            chestAudio.Play();
                        }
                    }
                }
            }
            else
            {
                GameRoot.AddTips("距离太远,无法打开");
            }
        }
    }
Exemple #40
0
	public static GameRoot	getInstance()
	{
		if(GameRoot.instance == null) {

			GameRoot.instance = GameObject.Find("GameRoot").GetComponent<GameRoot>();
		}

		return(GameRoot.instance);
	}
Exemple #41
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.R))
        {
            player.transform.localPosition = startPosition;

            GameRoot.instance.IsLock(false);
            P03W.ShowChoicePanel(false);
            isTriggerQuestion = false;

            GameRoot.ShowTips("", true, false);
        }

        if (isRotate)
        {
            if (Mathf.Abs(diffRotation.x) <= 2f && Mathf.Abs(diffRotation.y) <= 2f && Mathf.Abs(diffRotation.z) <= 2f)
            {
                plane.transform.eulerAngles = finalRotation;
                isRotate = false;

                //Stop audio FX rotated puzzle environment
                plane.GetComponent <PuzzleEnvironmentController>().PlayRotatedSoundFX(false);
            }
            else
            {
                CalDiffRotation();

                currentRotation = Vector3.Slerp(currentRotation, finalRotation, 0.01f * rotatedSpeed);

                plane.transform.eulerAngles = currentRotation;
            }
        }

        if (Input.GetKeyDown(KeyCode.Z))
        {
            topCamera.depth = topCamera.depth == 0 ? 1 : 0;
        }

        //*********************** Interaction with the trigger and submission *************************

        if (isInQuestion && Input.GetKeyDown(KeyCode.E))
        {
            if (isTriggerQuestion)
            {
                GameRoot.instance.IsLock(false);
                GameRoot.isPuzzleLock = false;
                P03W.ShowChoicePanel(false);
                isTriggerQuestion = false;

                GameRoot.instance.audioService.PlayUIAudio(Constants.audioP03ExitQuestion);
            }
            else
            {
                isTriggerQuestion = true;
                GameRoot.instance.IsLock(true);
                GameRoot.isPuzzleLock = true;
                P03W.ShowChoicePanel(true);

                GameRoot.instance.audioService.PlayUIAudio(Constants.audioP03TriggerQuestion);
            }
        }
        // ***********************************************************************************************

        if (isTipsAnimate)
        {
            tipsPoint2.localPosition = Vector3.Lerp(tipsPoint2.localPosition, tipsPoint2FinalPos, tipsAnimationSpeed);
            tipsPoint3.localPosition = Vector3.Lerp(tipsPoint3.localPosition, tipsPoint3FinalPos, tipsAnimationSpeed);

            Vector3 diffTP2 = tipsPoint2FinalPos - tipsPoint2.localPosition;
            Vector3 diffTP3 = tipsPoint3FinalPos - tipsPoint3.localPosition;

            if ((Mathf.Abs(diffTP2.x) <= 0.05f && Mathf.Abs(diffTP2.y) <= 0.05f && Mathf.Abs(diffTP2.z) <= 0.05f) &&
                (Mathf.Abs(diffTP3.x) <= 0.05f && Mathf.Abs(diffTP3.y) <= 0.05f && Mathf.Abs(diffTP3.z) <= 0.05f))
            {
                tipsPoint2.localPosition = tipsPoint2FinalPos;
                tipsPoint3.localPosition = tipsPoint3FinalPos;

                isTipsAnimate = false;
            }
        }

        //When player finish sub-level, the puzzle environment shift into next sub-level
        if (isShiftPlane)
        {
            playerPosition.position = Vector3.Lerp(playerPosition.position, playerPositionList[subPuzzleID].position, planeShiftSpeed);

            Vector3 diffPP = playerPositionList[subPuzzleID].position - playerPosition.position;

            if (Mathf.Abs(diffPP.z) <= 0.05f)
            {
                if (subPuzzleID >= DBP03.subLevelPlanes.Length)
                {
                    playerPosition.position = playerPositionList[subPuzzleID].position;
                    SetActive(endWall, false);
                    P03W.ShowChoicePanel(false);

                    GameRoot.instance.IsLock(false);
                    GameRoot.ShowTips("", false, false);
                    isInQuestion = false;
                    P03W.SetInstructionalText("Go to the exit.");
                }

                isShiftPlane = false;
            }
        }

        previousPosition = player.transform.position;
    }