Пример #1
0
    void Start()
    {
        PlayerSetting player = null;

        foreach (var obj in FindObjectsOfType <PlayerSetting>())
        {
            if (!MyNetworkLobbyManager.s_singleton.IsTutorial)
            {
                if (!obj.isLocalPlayer)
                {
                    continue;
                }
            }
            player = obj;
        }

        var is_server = player.isServer;

        if (player == null)
        {
            is_server = true;               // Debug
        }
        var owner = GameObject.Find(is_server ? "Le-mon" : "Apumon").transform;
        var enemy = GameObject.Find(is_server ? "Apumon" : "Le-mon").transform;

        owner.localPosition = OWNER_POS;
        enemy.localPosition = ENEMY_POS;

        var p1 = GameObject.Find("Player_1");
        var p2 = GameObject.Find("Player_2");

        p1.GetComponent <GaugeSpriteSelecter>().Setup(is_server);
        p2.GetComponent <GaugeSpriteSelecter>().Setup(!is_server);
    }
    private void Start()
    {
        Conductor.instance.songBPM = SongDataLoadedFromJson(GameInfo.songName).songBPM;

        Conductor.instance.secPerBeat = 60 / Conductor.instance.songBPM;

        PlayerSetting playerSetting = PlayerSettingLoadedFromJson();

        switch (playerSetting.noteSpeed)
        {
        case 0:
            Conductor.instance.BeatsShownInAdvance = 8;
            break;

        case 1:
            Conductor.instance.BeatsShownInAdvance = 4;
            break;

        case 2:
            Conductor.instance.BeatsShownInAdvance = 2;
            break;
        }

        for (int i = 0; i < playerSetting.keyCodes.Length; i++)
        {
            GamePlayController.instance.keyCodes[i] = (KeyCode)System.Enum.Parse(typeof(KeyCode), playerSetting.keyCodes[i]);
        }



        //Conductor.instance.totalBeats = Conductor.instance.gameObject.GetComponent<AudioSource>().clip.length / Conductor.instance.secPerBeat;
    }
Пример #3
0
 /*
  * デフォルトとして初期化
  */
 public void Initialize(PlayerSetting playerSetting, int num)
 {
     this.playerSetting = playerSetting;
     numText.text       = "" + (num);
     inputField.text    = "";
     placeholder.text   = "プレイヤー" + (num);
 }
    public PlayerSetting PlayerSettingLoadedFromJson()
    {
        // Get data from path : Application.dataPath/SongDatas/[songName]/NoteData.txt
        string path = Path.Combine(Application.dataPath, "Player.txt");

        if (!File.Exists(path))
        {
            PlayerSetting data = new PlayerSetting();

            // Data To Json String
            string jsonInfo = JsonUtility.ToJson(data, true);

            // Json String Save in text file
            File.WriteAllText(path, jsonInfo);

            return(data);
        }

        string loadData;

        loadData = File.ReadAllText(path);

        //把字串轉換成Data物件
        return(JsonUtility.FromJson <PlayerSetting>(loadData));
    }
Пример #5
0
    // the frame is from clips
    private float RootMotionCost(MotionFrame frame, MotionFrame current,
                                 PlayerSetting playerSetting)
    {
        var velocity = Mathf.Abs(frame.Velocity - current.Velocity);

        return(playerSetting.RootMotionCostFactor * velocity);
    }
Пример #6
0
    void Start()
    {
        l_bar_ = GameObject.Find("Left");
        r_bar_ = GameObject.Find("Right");

        foreach (var player in FindObjectsOfType <PlayerSetting>())
        {
            if (!MyNetworkLobbyManager.s_singleton.IsTutorial)
            {
                if (!player.isLocalPlayer)
                {
                    continue;
                }
                player_ = player;
            }
            else
            {
                player_ = player;
            }
        }

        var l_render = l_bar_.GetComponent <SpriteRenderer>();
        var r_render = r_bar_.GetComponent <SpriteRenderer>();

        l_render.color = player_.isServer ? Color.yellow : Color.red;
        r_render.color = player_.isServer ? Color.red : Color.yellow;
    }
Пример #7
0
    void LoadedDataSetting()
    {
        playerSetting = MainMenuController.instance.dataCtrl.PlayerSettingLoadedFromJson();

        volumeSlider.value = playerSetting.volume;

        volumeTxt.text = playerSetting.volume.ToString();

        float value = playerSetting.volume / 2f - 50f;

        audioMixer.SetFloat("MasterVolume", value);

        speedStatus = playerSetting.noteSpeed;

        Color color;

        foreach (Button btn in speed_Btns)
        {
            if (ColorUtility.TryParseHtmlString("#999999", out color))
            {
                btn.GetComponentInChildren <Text>().color = color;
            }
        }

        if (ColorUtility.TryParseHtmlString(speedColors[speedStatus], out color))
        {
            speed_Btns[speedStatus].GetComponentInChildren <Text>().color = color;
        }

        for (int i = 0; i < keyCodes.Length; i++)
        {
            keyCodes[i] = (KeyCode)System.Enum.Parse(typeof(KeyCode), playerSetting.keyCodes[i]);
        }
    }
Пример #8
0

        
Пример #9
0
        private void SetPlayers(int p1Setting, int p2Setting)
        {
            PlayerSetting p1 = (PlayerSetting)p1Setting;
            PlayerSetting p2 = (PlayerSetting)p2Setting;

            playerTypes.Add(P1_MARKER, p1.ToString());
            playerTypes.Add(P2_MARKER, p2.ToString());
        }
Пример #10
0
    //frameBone is the bone we look at, which is from animation clips
    private float BoneCost(MotionJointPoint frameBone, MotionJointPoint currentBone,
                           PlayerSetting playerSetting)
    {
        var rotationCost = RotationCost(frameBone, currentBone);
        var posCost      = PosCost(frameBone, currentBone);

        return(playerSetting.BoneRotFactor * rotationCost + playerSetting.BonePosFactor * posCost);
    }
Пример #11
0
    void Awake()
    {
        _instance = this;
        DontDestroyOnLoad(this);

        playerSetting = new PlayerSetting();
        whichAndroid  = new WhichAndroid();
    }
Пример #12
0
 /*
  * 名前を設定して初期化
  */
 public void Initialize(PlayerSetting playerSetting, int num, string name)
 {
     this.playerSetting = playerSetting;
     numText.text       = "" + (num);
     inputField.text    = name;
     Debug.Log(name + "/" + inputField.text);
     placeholder.text = "プレイヤー" + (num);
 }
Пример #13
0

        
    void Start()
    {
        gameController = new GameController();

        playerSetting = GetComponent <PlayerSetting>();
        tableManager  = transform.parent.GetComponent <TableManager>();

        childCount = transform.childCount;
    }
    // Use this for initialization
    void Awake()
    {
        Instance             = this;
        playerCoinsText.text = PlayerData.Instance.playerCoins.ToString();

        //setting the default player name(Player#12)
        //it will set the player name in LobbyNetwork.cs, CreateRoom.cs, RoomSetting.cs
        playerName = PlayerData.Instance.playerName;
    }
Пример #16
0
 /// <summary>
 /// Setting UI에서 설정한 값을 파일에 반영하는 함수
 /// </summary>
 /// <param name="simulationData">Setting UI에 설정된 시뮬레이션 설정 값</param>
 /// <param name="playerData">PlayerSetting에 설정된 플레이어 설정 값</param>
 public void SetFileData(SimulationSetting simulationData, PlayerSetting playerData)
 {
     File.WriteAllText(simulationSettingPath,
                       JsonUtility.ToJson(simulationData),
                       Encoding.Default);
     File.WriteAllText(playerSettingPath,
                       JsonUtility.ToJson(playerData),
                       Encoding.Default);
 }
        /// <summary>
        /// json 설정파일을 수정하기 위해 SettingUI의 Player 데이터를 읽어들이는 함수
        /// </summary>
        public PlayerSetting GatheringPlayerSetting()
        {
            var playerData = new PlayerSetting();

            playerData.scrollSpeed  = scrollSpeed.value;
            playerData.rotateXSpeed = rotateXSpeed.value;
            playerData.rotateYspeed = rotateYspeed.value;
            playerData.moveSpeed    = moveSpeed.value;
            playerData.keyMoveSpeed = keyMoveSpeed.value;

            return(playerData);
        }
Пример #18
0
 void Awake()
 {
     if (setting == null)
     {
         setting = this;
         DontDestroyOnLoad(gameObject);
         Load();
     }
     else
     {
         Destroy(gameObject);
     }
 }
        private void SpreaderData()
        {
            // 데이터 읽어오기
            var simulationData = new SimulationSetting();
            var playerData     = new PlayerSetting();

            manager.FileManager.GetFileData(ref simulationData, ref playerData);

            // 데이터 뿌려주기
            manager.GPUBoids?.GetSettingData(simulationData);
            manager.SharkManager.GetSettingData(simulationData);
            manager.CameraOperate.GetSettingData(playerData);
        }
        /// <summary>
        /// 실행파일이 처음 실행된경우
        /// 셋팅 json파일의 값을 읽고 UI에 뿌려줌
        /// </summary>
        void Start()
        {
            // 데이터 받아오기
            var fileMgr = LobbyManager.instance.FileManager;

            var simulationData = new SimulationSetting();
            var playerData     = new PlayerSetting();

            fileMgr.GetFileData(ref simulationData, ref playerData);

            // 데이터 뿌려주기
            UIDataChange(simulationData, playerData);
        }
Пример #21
0

        
        /// <summary>
        /// 초기화 버튼을 눌렀을 경우 모든 설정값을 초기화하는 함수
        /// </summary>
        public void InitSettingFields()
        {
            // json 초기화
            var fileMgr = LobbyManager.instance.FileManager;

            fileMgr.InitFileData();

            // UI값 초기화
            var simulationData = new SimulationSetting();
            var playerData     = new PlayerSetting();

            UIDataChange(simulationData, playerData);
        }
Пример #23
0
    public float CalculateAllCost(MotionFrame motionFrame, MotionFrame currentFrame,
                                  PlayerSetting playerSetting)
    {
        float allCost = 0;

        for (int j = 0; j < motionFrame.Joints.Length; j++)
        {
            allCost += BoneCost(motionFrame.Joints[j], currentFrame.Joints[j], playerSetting);
        }
        allCost += RootMotionCost(motionFrame, currentFrame, playerSetting);
        allCost += TrajectoryCost(motionFrame, currentFrame, playerSetting);

        return(allCost);
    }
Пример #24
0
        /// <summary>
        /// Setting 데이터를 모두 초기화하는 함수
        /// 초기값은 'SettingData.md' 파일 참조
        /// </summary>
        public void InitFileData()
        {
            var simulationData = new SimulationSetting();

            File.WriteAllText(simulationSettingPath,
                              JsonUtility.ToJson(simulationData),
                              Encoding.Default);

            var playerData = new PlayerSetting();

            File.WriteAllText(playerSettingPath,
                              JsonUtility.ToJson(playerData),
                              Encoding.Default);
        }
Пример #25
0
        // Update is called once per frame
        void Update()
        {
            if (setting == null)
            {
                PlayerSetting newSetting = PlayerManager.Inst.GetSetting(player.GetOwner());
                if (newSetting == null)
                    return;

                setting = newSetting;
            }

            transform.localScale = player.transform.localScale;
            textMesh.text = setting.name + "\n" + player.GetState().ToString() + "\n" + player.GetHealth();
        }
Пример #26
0
        /// <summary>
        /// Simuation Scene에서 설정용 Json파일을 읽기 위한 함수
        /// </summary>
        public void GetFileData(ref SimulationSetting simulationData, ref PlayerSetting playerData)
        {
            var simulFI  = new FileInfo(simulationSettingPath);
            var playerFI = new FileInfo(playerSettingPath);

            if (!simulFI.Exists || !playerFI.Exists)
            {
                Debug.Log("no exists file");
                InitFileData();
            }

            simulationData = JsonUtility.FromJson <SimulationSetting>(File.ReadAllText(simulationSettingPath));
            playerData     = JsonUtility.FromJson <PlayerSetting>(File.ReadAllText(playerSettingPath));
        }
Пример #27
0
        AMoveGenerator getMoveGenerator(string player)
        {
            PlayerSetting playerSetting = MenuSceneScript.myPlayerSetting;

            if (player == "MyMove")
            {
                playerSetting = MenuSceneScript.myPlayerSetting;
            }
            else if (player == "OppMove")
            {
                playerSetting = MenuSceneScript.oppPlayerSetting;
            }
            else
            {
                Debug.Log("ここには来ないはず");
            }

            switch (playerSetting)
            {
            case PlayerSetting.My:
                //Start()で呼ぶとなぜかfindできない
                return(Instantiate(MyMovePrefab).GetComponent <MyMove>());

            case PlayerSetting.Cpu:
                var cpuMove = Instantiate(CPUMovePrefab).GetComponent <CPUMoveBase>();
                cpuMove.SetNoccaObject(nocca);
                return(cpuMove);

            case PlayerSetting.MyOnline:
                //MyMoveとOppMoveには同じインスタンスが格納される
                MyMoveOnline myMoveOnline;
                if (MyMoveOnline.LocalMoveInstance == null)
                {
                    //Photon viewコンポーネントを含むprefabはPhotonNetwork.Instantiateでインスタンス化
                    myMoveOnline = PhotonNetwork.Instantiate(MyMoveOnlinePrefab.name, new Vector3(0, 0, 0), Quaternion.identity, 0).GetComponent <MyMoveOnline>();
                }
                else
                {
                    myMoveOnline = MyMoveOnline.LocalMoveInstance.GetComponent <MyMoveOnline>();
                }
                return(myMoveOnline);

            default:
                return(new MyMove());
            }
        }
Пример #28
0
        public bool CreatePlayerSetting(PlayerSetting playerSetting)
        {
            outpostwarsEntities entities = new outpostwarsEntities();

            try
            {
                // Add tew New Player into the player Collection
                entities.PlayerSettings.Add(playerSetting);
                // Save changes
                return(entities.SaveChanges() == 1);
            }
            catch (DbEntityValidationException ex)
            {
                LogCriticalError(ex);
            }
            return(false);
        }
Пример #29
0
        private string ValidateInput(PlayerSetting playersetting)
        {
            if (playersetting.PlayerSettingTypeID == 1000000) // Integer
            {
                try
                {
                    int i = Convert.ToInt32(playersetting.PlayerSettingValue);
                }
                catch
                {
                    return("Please enter a valid integer value");
                }
            }
            else if (playersetting.PlayerSettingTypeID == 1000001) // String
            {
                if (String.IsNullOrEmpty(playersetting.PlayerSettingValue))
                {
                    return("Please enter a valid string value");
                }
            }
            else if (playersetting.PlayerSettingTypeID == 1000002) // Float
            {
                try
                {
                    double d = Convert.ToDouble(playersetting.PlayerSettingValue);
                }
                catch
                {
                    return("Please enter a valid floating point value");
                }
            }
            else if (playersetting.PlayerSettingTypeID == 1000003) // Boolean
            {
                if (playersetting.PlayerSettingValue != "True" && playersetting.PlayerSettingValue != "False")
                {
                    return("Please enter either True or False");
                }
            }

            return(String.Empty);
        }
Пример #30
0
    //キー操作をチェックする
    void Update()
    {
        PlayerSetting setting = gameObject.GetComponent <PlayerSetting>();

        if (Input.GetKeyUp(KeyCode.UpArrow))
        {
            Move(setting.GetMove(KeyCode.UpArrow));
        }
        if (Input.GetKeyUp(KeyCode.DownArrow))
        {
            Move(setting.GetMove(KeyCode.DownArrow));
        }
        if (Input.GetKeyUp(KeyCode.LeftArrow))
        {
            Move(setting.GetMove(KeyCode.LeftArrow));
        }
        if (Input.GetKeyUp(KeyCode.RightArrow))
        {
            Move(setting.GetMove(KeyCode.RightArrow));
        }
    }
Пример #31
0
    public void ApplySetting(PlayerSetting setting)
    {
        startingHealth        = setting.StartingHealth;
        flyingSpeed           = setting.FlySpeed;
        rebirthProtectionTime = setting.RebirthPortection;
        life = setting.Life;

        bulletSpeed = setting.BulletSpeed;
        fireRate    = setting.BulletFireRate;

        missleCount    = setting.MissleStartCount;
        missleMaxCount = setting.MissleMaxCount;
        missleSpeed    = setting.MissleSpeed;

        EMPStunSec = setting.EMPStunSec;

        SetupHealth();
        rebirthProtectionTimer = new Timer(rebirthProtectionTime);
        fireRateTimer          = new Timer(fireRate);
        stunTimer = new Timer(EMPStunSec);
        UpdateHealthBar();
    }
Пример #32
0
    void Start()
    {
        l_bar_ = GameObject.Find("Left");
        r_bar_ = GameObject.Find("Right");

        foreach (var player in FindObjectsOfType<PlayerSetting>()) {
            if (!MyNetworkLobbyManager.s_singleton.IsTutorial)
            {
                if (!player.isLocalPlayer) continue;
                player_ = player;
            }
            else
            {
                player_ = player;
            }

        }

        var l_render = l_bar_.GetComponent<SpriteRenderer>();
        var r_render = r_bar_.GetComponent<SpriteRenderer>();

        l_render.color = player_.isServer ? Color.yellow : Color.red;
        r_render.color = player_.isServer ? Color.red : Color.yellow;
    }
Пример #33
0
 // Use this for initialization
 void Start()
 {
     setting = null;
     player = transform.parent.gameObject.GetComponent<ServerPlayer>();
 }