public void isEnemy(GameObject attacker) { GameObject player = GameObject.Find("player"); if (player == null) { return; } if (distanceFrom(player) < 2.0f) { hasAttacked = true; TurnController.takeAction(); if (TurnController.getActions() < 2) //REMOVE? { TurnController.takeAction(); hasAttacked = false; } if (checkAttack(player)) { DeathController target = player.GetComponent <DeathController> (); player.GetComponent <Stats> ().setHealth(1); } } else { TurnController.takeAction(); //REMOVE TurnController.takeAction(); } }
public void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Death")) { DeathController dController = other.GetComponent <DeathController>(); if (dController != null) { if (item != null) { Debug.Log("Death: There's already a item"); } else if (dController.currentItem.name == targetItemName) { Debug.Log("Death: Used item"); item = dController.currentItem; item.instance.transform.SetParent(transform); item.instance.transform.localPosition = Vector3.zero; item.instance.gameObject.SetActive(false); dController.currentItem = null; } else { Debug.Log("Death: Wrong item"); } } } }
public void OnYesFromDialog() { HUDDeath.YesNoQuestion yesNoQuestion = this.m_YesNoQuestion; if (yesNoQuestion != HUDDeath.YesNoQuestion.Quit) { if (yesNoQuestion != HUDDeath.YesNoQuestion.LoadGame) { if (yesNoQuestion == HUDDeath.YesNoQuestion.LoadLastSave) { DeathController.Get().StartRespawn(); CursorManager.Get().SetCursor(CursorManager.TYPE.Normal); } } else { MenuInGameManager.Get().ShowScreen(typeof(MenuLoad)); } } else { LoadingScreen.Get().Show(LoadingScreenState.ReturnToMainMenu); GreenHellGame.Instance.ReturnToMainMenu(); } this.m_YesNoQuestion = HUDDeath.YesNoQuestion.None; }
public override bool Activate(Activator activator = null) { if (SecondTarget != null) { SecondTarget.SetActive(true); } if (Target != null) { Target.SetActive(true); Target.transform.position = SpawnPoint.transform.position; AnimalController animalController = Target.GetComponent <AnimalController>(); if (animalController != null && animalController.AnimalType == AnimalType.Fox) { GameManager.Instance.SwitchActiveAnimalController(); } DeathController deathController = Target.GetComponent <DeathController>(); MovementController movementController = Target.GetComponent <MovementController>(); if (deathController != null) { deathController.IsDead = false; } if (movementController != null) { movementController.TryMoveNone(); movementController.CanMove = true; } return(true); } return(false); }
void Start() { Instance = this; previousInt = (int)timeToDeath; rt = text.GetComponent <RectTransform>(); text.alpha = 0; }
private void Awake() { // Finds the scripts dController = FindObjectOfType <DeathController>(); scoreDelay = scoreTimer; }
public void isEnemy(GameObject attacker) { Ray ray = new Ray(attacker.transform.position, attacker.transform.forward); RaycastHit hit; if (Physics.Raycast(ray, out hit, 2.0f)) { hasAttacked = true; TurnController.takeAction(); GameObject t = Instantiate(prefab, hit.collider.gameObject.transform.position, hit.collider.gameObject.transform.rotation); if (checkAttack(hit)) { int damage = Dice.d8(1)[0]; t.GetComponent <TextMesh> ().text = damage.ToString(); GameObject hitObject = hit.transform.gameObject; DeathController target = hitObject.GetComponent <DeathController> (); if (target != null) { enemyStats.setHealth(damage); if (enemyStats.getHealth() <= 0) { target.reactToHit(); } } } else { t.GetComponent <TextMesh> ().text = "MISS"; } } }
private void OnTriggerExit(Collider other) { if (other.gameObject.CompareTag("Player")) { Debug.Log(transform.name + " not focused by: " + other.gameObject.name); interactionSign.enabled = false; PlayerControllerCC player = other.gameObject.GetComponent <PlayerControllerCC>(); if (player != null) { player.onInteracting -= Interact; } } if (other.gameObject.CompareTag("Death")) { DeathController dController = other.GetComponent <DeathController>(); if (dController != null) { dController.onInteracting -= DeathInteract; } } if (other.gameObject.CompareTag("NPC")) { NPCController npcController = other.GetComponent <NPCController>(); if (npcController != null) { npcController.onInteracting -= VictimInteract; } } }
void OnCollisionEnter(Collision col) { if (col.gameObject.tag == "Player") { DeathController dc = col.gameObject.GetComponent <DeathController>(); dc.Die(); } }
void Start() { inventory = Inventory.instance; dController = DeathController.instance; npcController = NPCController.instance; interactionSign.enabled = false; }
private void Awake() { titleController = FindObjectOfType <TitleController>(); cinematicController = FindObjectOfType <CinematicController>(); gameplayController = FindObjectOfType <GameplayController>(); deathController = FindObjectOfType <DeathController>(); resultsController = FindObjectOfType <ResultsController>(); }
private void Awake() { // Finds the scripts dController = FindObjectOfType <DeathController>(); sController = FindObjectOfType <ScoreController>(); hs = FindObjectOfType <Highscores>(); // Initialises the currently selected options (for PS4) currentSelected = retryButton; currentButton = currentSelected.GetComponent <Button>(); }
private void Start() { maxHitpoints = 5; hitpoints = 5; isAlive = true; levelNumber = 1; player = FindObjectOfType <PlayerController>(); deathController = player.gameObject.GetComponent <DeathController>(); knockbackMovement = player.GetComponent <PlayerKnockbackMovement>(); }
private void Awake() { // Finds the scipts pController = FindObjectOfType <PlayerController>(); dController = FindObjectOfType <DeathController>(); sController = FindObjectOfType <ScoreController>(); // Adds the starting platforms to the platform list platforms.AddRange(GameObject.FindGameObjectsWithTag("LevelStart")); }
private void Awake() { if (instance != null) { Debug.LogWarning("More than one instance of DeathController found!"); return; } instance = this; }
void Awake() { animator = GetComponent <Animator>(); rb2d = GetComponent <Rigidbody2D>(); startPos = rb2d.position; if (SceneManager.GetActiveScene().name != "MenuScene") { deathController = GameObject.Find("Level Controller").GetComponent <DeathController>(); } }
private void GetReferences() { deathController = GetComponent <DeathController>(); movementController = GetComponent <MovementController>(); playerActionsController = GetComponent <PlayerActionsController>(); respawnController = GetComponent <RespawnController>(); pushController = GetComponentInChildren <PushController>(); rotationController = GetComponent <RotationController>(); afterImageController = GetComponent <AfterImageController>(); animator = GetComponent <Animator>(); }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.relativeVelocity.y >= 0f) { Rigidbody2D collidingBody = collision.collider.GetComponent <Rigidbody2D>(); if (collidingBody != null) { DeathController.Kill(); } } }
private void Update() { if (this.m_Initialized && this.m_Scenario != null) { this.UpdateSceneLoadUnload(); if (DeathController.Get().IsState(DeathController.DeathState.None)) { this.m_Scenario.Update(); } } }
void Start() { CollectibleController cc = GameObject.Find("Level Controller").GetComponent <CollectibleController>(); DeathController dc = GameObject.Find("Level Controller").GetComponent <DeathController>(); GameData data = GameController.instance.Data; levelMoneySumText.text = cc.levelMoneySum.ToString(); moneyTotalText.text = data.MoneyTotal.ToString(); levelDeathCountText.text = dc.levelDeathCount.ToString(); deathTotalText.text = data.DeathCount.ToString(); }
private void Awake() { // Finds the scripts dController = FindObjectOfType <DeathController>(); // Assigns the rigidbody and animator rb = GetComponent <Rigidbody>(); animator = GetComponent <Animator>(); //Cursor.lockState = CursorLockMode.Locked; //Cursor.visible = false; }
void Start() { movementSpeed = startSpeed; anim = GetComponent <Animator>(); rb = GetComponent <Rigidbody>(); if (gameObject.tag == "SmallFish") { deathController = GetComponent <DeathController>(); } col = GetComponent <CapsuleCollider>(); }
public void isEnemy(GameObject attacker) { Ray ray = new Ray(attacker.transform.position, attacker.transform.forward); RaycastHit hit; if (Physics.Raycast(ray, out hit, 2.0f)) { GameObject hitObject = hit.transform.gameObject; DeathController target = hitObject.GetComponent <DeathController> (); if (target != null) { target.reactToHit(); } } }
void Start() { movementSpeed = startSpeed; anim = GetComponent <Animator>(); rb = GetComponent <Rigidbody> (); // AudioSource [] audioSources = GetComponents<AudioSource> (); //audioSource = audioSources [0]; //sfxSource = audioSources [1]; if (gameObject.tag == "SmallFish") { deathController = GetComponent <DeathController> (); } }
private void Update() { if (!this.m_Initialized) { return; } if (this.m_Scenario == null) { return; } if (!DeathController.Get().IsState(DeathController.DeathState.None)) { return; } this.m_Scenario.Update(); }
private void UpdateEnergy() { if (this.m_Player.m_DreamActive) { return; } float deltaTime = Time.deltaTime; FPPController fppcontroller = this.m_Player.m_FPPController; if (!fppcontroller) { return; } DeathController deathController = this.m_Player.m_DeathController; if (deathController.IsActive()) { return; } ConsciousnessController component = this.m_Player.GetComponent <ConsciousnessController>(); if (component.IsActive()) { return; } if (!Cheats.m_GodMode && !this.m_LossParametersBlocked) { this.m_Energy -= this.m_EnergyConsumptionPerSecond * deltaTime; if (this.IsNutritionCarboCriticalLevel() || this.IsNutritionFatCriticalLevel() || this.IsNutritionProteinsCriticalLevel()) { this.m_Energy -= this.m_EnergyConsumptionPerSecondNoNutrition * deltaTime; } if (this.m_DiseasesModule.GetDisease(ConsumeEffect.Fever).IsActive()) { this.m_Energy -= this.m_EnergyConsumptionPerSecondFever * deltaTime; } if (this.m_DiseasesModule.GetDisease(ConsumeEffect.FoodPoisoning).IsActive()) { this.m_Energy -= this.m_EnergyConsumptionPerSecondFoodPoison * deltaTime; } } this.m_Energy = Mathf.Clamp(this.m_Energy, 0f, this.m_MaxEnergy); if (this.m_Energy <= PlayerSanityModule.Get().m_LowEnegryWhispersLevel) { PlayerSanityModule.Get().OnWhispersEvent(PlayerSanityModule.WhisperType.LowEnergy); } }
public void OnYesFromDialog() { switch (this.m_YesNoQuestion) { case HUDDeath.YesNoQuestion.LoadGame: MenuInGameManager.Get().ShowScreen(typeof(LoadGameMenu)); break; case HUDDeath.YesNoQuestion.LoadLastSave: DeathController.Get().StartRespawn(); CursorManager.Get().SetCursor(CursorManager.TYPE.Normal); break; case HUDDeath.YesNoQuestion.Quit: LoadingScreen.Get().Show(LoadingScreenState.ReturnToMainMenu); GreenHellGame.Instance.ReturnToMainMenu(); break; } this.m_YesNoQuestion = HUDDeath.YesNoQuestion.None; }
private void Start() { maxHealth = PlayerPrefs.GetInt("maxHealth", 10); maxMana = PlayerPrefs.GetInt("maxMana", 5); health = PlayerPrefs.GetInt("health", maxHealth); mana = PlayerPrefs.GetInt("mana", maxMana); strength = PlayerPrefs.GetInt("strength", 0); strengthModifier = PlayerPrefs.GetInt("strengthModifier", 2); gold = PlayerPrefs.GetInt("gold", 0); areasCleared = PlayerPrefs.GetInt("areasCleared", 0); equippedSword = PlayerPrefs.GetInt("sword", 0); sword.sprite = swordSprites[equippedSword]; exp = PlayerPrefs.GetInt("exp", 0); level = PlayerPrefs.GetInt("level", 0); expNeeded = 5 + level * 2 + Mathf.RoundToInt(Mathf.Pow(level, 2)); deathController = GetComponent <DeathController>(); }
void Start() { rb = GetComponent <Rigidbody2D>(); dc = GetComponent <DeathController>(); //Subscribing KillVelocity function to OnDeath Event dc.OnDeath += KillVelocity; dc.OnDeath += ResetExternalForce; dir = Vector2.zero; extForce = Vector2.zero; movementTimer = Vector2.zero; previousDir = Vector2.zero; thisWillFixShit = false; if (rb.gravityScale != 0f) { Debug.Break(); throw new System.Exception("Kindly change gravity scale on Movement script only! Contact Pr0b0b for help."); } }
public void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Death")) { DeathController dController = other.GetComponent <DeathController>(); if (dController != null && dController.dState == DeathController.DeathState.Search) { if (dController.currentItem == null) { dController.currentItem = item; transform.SetParent(dController.deathHand); transform.localPosition = Vector3.zero; base.triggerArea.enabled = false; itemCollider.enabled = false; rdb.isKinematic = true; dController.dState = DeathController.DeathState.Flee; } } } if (other.gameObject.CompareTag("Player")) { Debug.Log(item.name + " focused by: " + other.gameObject.name); interactionSign.enabled = true; PlayerControllerCC player = other.gameObject.GetComponent <PlayerControllerCC>(); if (player != null) { player.onInteracting = Interact; } } }