コード例 #1
0
    public void ShowPlayerVSPlayer()
    {
        PlayerSO p1 = GamePlay.instance.Player1_SO;
        PlayerSO p2 = GamePlay.instance.Player2_SO;

        InitializedPlayerVsPlayer(p1, p2);
    }
コード例 #2
0
ファイル: Room.cs プロジェクト: origami99/Dungeon-Blast
        private void Start()
        {
            _camera = Camera.main;

            _playerData = GameObject
                          .FindGameObjectWithTag(Tags.Player)
                          .GetComponent <Player.Player>().PlayerData;

            if (_enemyContainer != null)
            {
                _activeEnemies = _enemyContainer
                                 .GetComponentsInChildren <Enemy>()
                                 .Select(x => x.gameObject)
                                 .Where(x => x.activeSelf)
                                 .ToList();

                _initialEnemies = _enemyContainer
                                  .GetComponentsInChildren <Enemy>()
                                  .Select(x => Instantiate(x.gameObject, _enemyContainer))
                                  .ToList();

                _initialEnemies.ForEach(x =>
                {
                    x.SetActive(false);
                });
            }

            if (this.NextRoom != null)
            {
                this.NextRoom.PrevRoom = this;
            }
        }
コード例 #3
0
 public void SelectCharacter(PlayerSO player)
 {
     this.CharcterName.text   = player.Name;
     this.CharacterPic.sprite = player.ProfilePic;
     this.WeaponName.text     = player.weapon.Name;
     SelectedPlayer           = player;
 }
コード例 #4
0
    public void InitializedPlayerVsPlayer(PlayerSO p1, PlayerSO p2)
    {
        CharcterName1.text   = p1.Name;
        CharacterPic1.sprite = p1.ProfilePic;

        CharcterName2.text   = p2.Name;
        CharacterPic2.sprite = p2.ProfilePic;
    }
コード例 #5
0
    //MenuFuctions
    public void SetPlayersFromScriptable(int index_p1, int index_p2)
    {
        Player1_SO = PlayersList[index_p1];
        Player2_SO = PlayersList[index_p2];
        weapon1    = Player1_SO.weapon;
        weapon2    = Player2_SO.weapon;

        logText.text = "UI player select ok";
        Debug.Log("UI player select ok");
    }
コード例 #6
0
    public void SetPlayersFromScriptable(PlayerSO player1, PlayerSO player2)
    {
        Player1_SO = player1;
        Player2_SO = player2;

        weapon1 = Player1_SO.weapon;
        weapon2 = Player2_SO.weapon;

        logText.text = "UI player select ok";
        Debug.Log("UI player select ok");
    }
コード例 #7
0
ファイル: Player.cs プロジェクト: jumberr/Journey3.0
 public Player(Transform player, PlayerHealth playerHealth, PlayerMovement playerMovement,
               WeaponController weaponController, Animator playerAnimator, float stamina, float staminaLess,
               float staminaRenew, PlayerController playerController, PlayerSO playerSo) : base(playerSo.Health, playerSo.Health, playerSo.MoveSpeed)
 {
     localPlayer      = this;
     Transform        = player;
     PlayerHealth     = playerHealth;
     PlayerMovement   = playerMovement;
     WeaponController = weaponController;
     PlayerSo         = playerSo;
     Stamina          = stamina;
     StaminaCurrent   = stamina;
     StaminaLess      = staminaLess;
     StaminaRenew     = staminaRenew;
     WeaponController = weaponController;
     PlayerController = playerController;
     PlayerAnimator   = playerAnimator;
 }
コード例 #8
0
ファイル: DataSaver.cs プロジェクト: unnameR/SomeWork
    //Load Data
    public static bool LoadData(PlayerSO loadTo, string dataFileName)
    {
        string tempPath = Path.Combine(Application.persistentDataPath, "data");

        tempPath = Path.Combine(tempPath, dataFileName + ".json");

        //Exit if Directory or File does not exist
        if (!Directory.Exists(Path.GetDirectoryName(tempPath)))
        {
            Debug.LogWarning("Directory does not exist");
            //return default(PlayerSO);
            return(false);
        }

        if (!File.Exists(tempPath))
        {
            Debug.Log("File does not exist");
            //return default(PlayerSO);
            return(false);
        }

        //Load saved Json
        byte[] jsonByte = null;
        try
        {
            jsonByte = File.ReadAllBytes(tempPath);
            //Debug.Log("Loaded Data from: " + tempPath.Replace("/", "\\"));
        }
        catch (Exception e)
        {
            Debug.LogWarning("Failed To Load Data from: " + tempPath.Replace("/", "\\"));
            Debug.LogWarning("Error: " + e.Message);
        }

        //Convert to json string
        string jsonData = Encoding.ASCII.GetString(jsonByte);

        //Convert to Object
        JsonUtility.FromJsonOverwrite(jsonData, loadTo);
        //object resultValue = JsonUtility.FromJson<T>(jsonData);
        //return (T)Convert.ChangeType(loadTo, typeof(T));
        return(true);
    }
コード例 #9
0
 void OnEnable()
 {
     playerParam = (PlayerSO)target;
 }
コード例 #10
0
 // Update is called once per frame
 public void InitializeItem(PlayerSO player)
 {
     this.icon.sprite = player.ProfilePic;
     this.player      = player;
 }