void Awake() { if (gm == null) { gm = this; } }
void Start() { gameModeRef = FindObjectOfType <GM_Main>(); cam = GetComponent <Camera>(); originalCamSpeed = cameraSpeed; foreach (GameObject playerInstance in gameModeRef.playerInstances) { targets.Add(playerInstance.transform); } }
public void DamagePlayer(int damage) { stats.curHealth -= damage; if (stats.curHealth <= 0) { GM_Main.KillPlayer(this); Debug.Log("You Die!"); } statInd.SetHealth(stats.curHealth, stats.maxHealth); }
public void DamageEnemy(int damage) { stats.curHealth -= damage; if (stats.curHealth <= 0) { GM_Main.KillEnemy(this); Debug.Log("Enemy Die!"); } if (statInd != null) { statInd.SetHealth(stats.curHealth, stats.maxHealth); } }
// Start is called before the first frame update IEnumerator Start() { gameModeRef = FindObjectOfType <GM_Main>(); cameraToFollow = GameObject.FindWithTag("MainCamera").GetComponent <Camera>(); spritePortal = GetComponent <SpriteRenderer>(); minScale = transform.localScale; while (!gameModeRef.gameOver) { yield return(new WaitForSecondsRealtime(Random.Range(waitTimeMin, waitTimeMax))); yield return(Lerp(minScale, maxScale, lerpDuration)); yield return(Lerp(maxScale, minScale, lerpDuration)); } }
// Initialization void Awake() { inputJump = "P" + controllerNumber + "Jump"; inputSlide = "P" + controllerNumber + "Slide"; inputAction = "P" + controllerNumber + "Action"; inputHorizontal = "P" + controllerNumber + "Horizontal"; inputVertical = "P" + controllerNumber + "Vertical"; spriteRenderer = GetComponent <SpriteRenderer>(); animator = GetComponent <Animator>(); ipReference = GetComponent <ItemPickup>(); mainCamera = GameObject.FindWithTag("MainCamera"); mainCameraScript = (MultipleTargetCamera)mainCamera.GetComponent(typeof(MultipleTargetCamera)); /* * main = GameObject.FindWithTag("GameController"); * mainScript = (GM_Main)main.GetComponent(typeof(GM_Main)); * players = mainScript.getPlayers(); */ gameModeReference = FindObjectOfType <GM_Main>(); }