public void ShowPlayerVSPlayer() { PlayerSO p1 = GamePlay.instance.Player1_SO; PlayerSO p2 = GamePlay.instance.Player2_SO; InitializedPlayerVsPlayer(p1, p2); }
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; } }
public void SelectCharacter(PlayerSO player) { this.CharcterName.text = player.Name; this.CharacterPic.sprite = player.ProfilePic; this.WeaponName.text = player.weapon.Name; SelectedPlayer = player; }
public void InitializedPlayerVsPlayer(PlayerSO p1, PlayerSO p2) { CharcterName1.text = p1.Name; CharacterPic1.sprite = p1.ProfilePic; CharcterName2.text = p2.Name; CharacterPic2.sprite = p2.ProfilePic; }
//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"); }
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"); }
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; }
//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); }
void OnEnable() { playerParam = (PlayerSO)target; }
// Update is called once per frame public void InitializeItem(PlayerSO player) { this.icon.sprite = player.ProfilePic; this.player = player; }