private void getManagerComponents() { mapper = GameObject.Find("ChunkManager").GetComponent<MapGenerator>(); player = GameObject.Find("Player").GetComponent<Player>(); trapper = GameObject.Find("TrapSpawner").GetComponent<TrapSpawner>(); scoreText = GameObject.Find("Canvas").GetComponentInChildren<Text>(); }
void Awake() { if (trapSpawner == null) { trapSpawner = this; } }
private static void HurnAndContinue(TrapSpawner spawner, GameObject triggered, Collider2D triggerer) { var player = triggerer.GetComponent <PlayerController>(); if (player != null) { CoroutineManager.Instance.StartCoroutine(Kill(player)); } }
private static void LootAndDisapear(TrapSpawner spawner, GameObject triggered, Collider2D triggerer) { var playerController = triggerer.transform.GetComponent <PlayerController>(); var lootInfo = triggered.GetComponent <Loot>(); if (playerController && lootInfo) { playerController.AddReward(lootInfo.value); //StartCoroutine(AutoDestroy()); } }
private static void HurtAndDisapear(TrapSpawner spawner, GameObject triggered, Collider2D triggerer) { var player = triggerer.GetComponent <PlayerController>(); if (player != null) { CoroutineManager.Instance.StartCoroutine(Kill(player)); } else { GameObject.Destroy(triggered.gameObject); } }
private void StopGame() { gameRunnning = false; gameSpeed = 0f; ts = FindObjectOfType <TrapSpawner>(); ts.StopSpawning(); player.StopPlayer(); monster.StopMonster(); if (points > highscore) { PlayerPrefs.SetInt("highscore", points); highscoreText.text = "New highscore!"; } else { highscoreText.text = ""; } endScoreText.text = "Score\n" + points.ToString(); PlayerPrefs.SetInt("lastScore", points); gameOverPanel.SetActive(true); }
public static void DoAction(TrapSpawner spawner, TrapActionsType action, GameObject triggered, Collider2D triggerer) { switch (action) { case TrapActionsType.None: break; case TrapActionsType.HurtAndDisapear: HurtAndDisapear(spawner, triggered, triggerer); break; case TrapActionsType.HurnAndContinue: HurnAndContinue(spawner, triggered, triggerer); break; case TrapActionsType.LootAndDisapear: LootAndDisapear(spawner, triggered, triggerer); break; default: throw new ArgumentOutOfRangeException("action", action, null); } }
// Use this for initialization void Start() { coreBlinkAnimation = GetComponentInChildren <BlinkDamageAnimation> (); currentHealth = maxHealth; difficulty = 0; wanderBehavior = GetComponent <WanderBehavior> (); wanderBehavior.setActive(true); followBehavior = GetComponent <FollowBehavior> (); wanderBehavior.setActive(false); shieldSpawner = GetComponentInChildren <ShieldSpawner> (); gunSpawner = GetComponentInChildren <GunSpawner> (); wallGunSpawner = GetComponentInChildren <WallGunSpawner> (); targetFire = GetComponent <TargettedFireBehavior> (); trapSpawner = GetComponentInChildren <TrapSpawner> (); nextBehaviorStartTime = Time.time + behaviorDelay; nextBehaviorEndTime = nextBehaviorStartTime + behaviorDuration; // targetFire.setStatus (true); // wallGunSpawner.setStatus (true); gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController> (); }
private void Start() { trapSpawner = FindObjectOfType <TrapSpawner>(); gameManager = FindObjectOfType <GameManager>(); audioManager = FindObjectOfType <AudioManager>(); }
private void Awake() { mummySpawner = GetComponentInChildren <MummySpawner>(); trapSpawner = GetComponentInChildren <TrapSpawner>(); }