public void sceneInit() { if (FindObjectOfType(typeof(AstarPath)) != null) { AstarPath.active.Scan(); } backEffect = (GameObject)Instantiate(Resources.Load("effect")); if (GameManager.Instance.playerInScene) { string temp = (string)GameManager.Instance.GetMainCharacter(); var Player = (GameObject)Instantiate(Resources.Load((temp))); Vector2 tempVec = transform.position; tempVec.x = GameManager.Instance.GetNextX(); tempVec.y = GameManager.Instance.GetNextY(); Player.transform.position = tempVec; player = Player.GetComponent <playerScript>(); player.canScale = true; player.GetComponent <playerScript> ().scaleInfo = new float[4] { minScale, maxScale, minY, maxY }; player.GetComponent <playerScript> ().baseSpeed = baseSpeed; } GameManager.Instance.updateMouseIcon("Walk_Icon"); }
void Update() { // one second tick timer. tell it to start from a skill. after a second sets tick bool to true, saying a second passed. remember to set tick to false in skill if (shouldTick) { t += (Time.deltaTime * Time.timeScale); if (t >= 1) { tick = true; t = 0; } } //handles healing skill if (doHeal) { durationTemp -= Time.deltaTime * Time.timeScale; if (tick && (player.maxHealth - player.currentHealth) >= skillTemp.power) { player.currentHealth += (int)skillTemp.power; theLevelMaster.UpdateUI(); tick = false; } else if (tick && (player.maxHealth - player.currentHealth) < skillTemp.power) { player.currentHealth += (player.maxHealth - player.currentHealth); theLevelMaster.UpdateUI(); tick = false; } else { theLevelMaster.UpdateUI(); tick = false; } if (durationTemp <= 0) { shouldTick = false; doHeal = false; //skillTemp.currentCool = skillTemp.coolDown; //skillTemp.cooling = true; t = 0; } } //Buff Timer if (doBuff) { durationTemp -= Time.deltaTime * Time.timeScale; //if damage gets reset at some point. rebuff if (player.GetComponent <playerScript>().damage != damageTemp) { player.GetComponent <playerScript>().damage = damageTemp; } if (durationTemp <= 0) { player.GetComponent <playerScript>().UpdateStats(); } } }
public void SetPlayerColor() { player = GameObject.Find("Player").GetComponent <playerScript>(); player.GetComponent <Light>().color = playerGlowColor; }
public void sceneInit(){ if (FindObjectOfType(typeof(AstarPath)) != null) AstarPath.active.Scan (); backEffect = (GameObject)Instantiate(Resources.Load("effect")); if (GameManager.Instance.playerInScene) { string temp = (string)GameManager.Instance.GetMainCharacter (); var Player = (GameObject)Instantiate (Resources.Load ((temp))); Vector2 tempVec = transform.position; tempVec.x = GameManager.Instance.GetNextX (); tempVec.y = GameManager.Instance.GetNextY (); Player.transform.position = tempVec; player = Player.GetComponent<playerScript>(); player.canScale = true; player.GetComponent<playerScript> ().scaleInfo = new float[4]{minScale, maxScale, minY, maxY}; player.GetComponent<playerScript> ().baseSpeed = baseSpeed; } GameManager.Instance.updateMouseIcon ("Walk_Icon"); }