private void Update() { if (player == null) { player = FindObjectOfType <Player_Pawn>(); } }
public void Awake() { if (player_controller == null) { player_controller = this; } player = FindObjectOfType <Player_Pawn>(); }
public override void Awake() { playerpawn = this; player_collider = GetComponent <CircleCollider2D>(); renderer = GetComponent <SpriteRenderer>(); manager = GameManager.Instance; DontDestroyOnLoad(this); }
public static void SavePlayer(Player_Pawn player) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/hai.zen"; FileStream stream = new FileStream(path, FileMode.Create); PlayerData data = new PlayerData(player); formatter.Serialize(stream, data); stream.Close(); }
void Start() { currentHealth = maxHealth; //Current health is set to a defined max health currentMana = maxMana; //Current mana is set to a defined max mana //The fill amount will only take values between 0 and 1. By dividing the current and the max value //of our Health, Mana, and Level Progression, we'll always stay between 0 and 1 healthUI.fillAmount = currentHealth / maxHealth; manaUI.fillAmount = currentMana / maxMana; levelProgressionUI.fillAmount = levelProgression; playerPrefab = FindObjectOfType <Player_Pawn>().gameObject; player = FindObjectOfType <Player_Pawn>(); playerPrefab.SetActive(false); }
public PlayerData(Player_Pawn player) { health = GameManager.Instance.currentHealth; maxHealth = GameManager.Instance.maxHealth; healthFill = health / maxHealth; mana = GameManager.Instance.currentMana; maxMana = GameManager.Instance.maxMana; manaFill = mana / maxMana; level = GameManager.Instance.level; levelProgression = GameManager.Instance.levelProgression; levelProFill = levelProgression / 100f; location = GameManager.Instance.Scene_Name; position[0] = player.transform.position.x; position[1] = player.transform.position.y; position[2] = player.transform.position.z; }
// Start is called before the first frame update void Start() { player = FindObjectOfType <Player_Pawn>(); poolDictionary = new Dictionary <string, Queue <GameObject> >(); foreach (Pool pool in pools) //For each pool that we create { Queue <GameObject> objectPool = new Queue <GameObject>(); //We create a queue full of objects //We make sure that we want to add all of the objects into the queue for (int i = 0; i < pool.size; i++) { GameObject obj = Instantiate(pool.prefab); DontDestroyOnLoad(obj); obj.SetActive(false); objectPool.Enqueue(obj); } poolDictionary.Add(pool.tag, objectPool); //Add our queue into our dictionary } }
private void Awake() { player = FindObjectOfType <Player_Pawn>(); Instance = this; }
// Start is called before the first frame update public override void Start() { base.Start(); sorcerer = GetComponent <Sorcerer_Pawn>(); player = FindObjectOfType <Player_Pawn>(); }