Esempio n. 1
0
    public void ShowPlayerVSPlayer()
    {
        PlayerSO p1 = GamePlay.instance.Player1_SO;
        PlayerSO p2 = GamePlay.instance.Player2_SO;

        InitializedPlayerVsPlayer(p1, p2);
    }
Esempio n. 2
0
        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;
            }
        }
Esempio n. 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;
 }
Esempio n. 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;
    }
Esempio n. 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");
    }
Esempio n. 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");
    }
Esempio n. 7
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;
 }
Esempio n. 8
0
    //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);
    }
Esempio n. 9
0
 void OnEnable()
 {
     playerParam = (PlayerSO)target;
 }
Esempio n. 10
0
 // Update is called once per frame
 public void InitializeItem(PlayerSO player)
 {
     this.icon.sprite = player.ProfilePic;
     this.player      = player;
 }