public virtual void Update() { if (currentState != null) { currentState.Tick(); } if (monsterCanAttack) { if (!monsterAttacked) { if (monster.GetComponent <MonsterAI>().getCurrentStateName() == "CollisionMonsterState") { if (numCollisionsWithMonster % 3 == 0) { PlayMonsterSound(); nextMonsterTutorialEvent = MonsterTutorialEvent.SHAKE; } else { PlayExplosionSound(); this.shakePanel.Shake(); nextMonsterTutorialEvent = MonsterTutorialEvent.SCREEAM; } numCollisionsWithMonster++; monsterAttacked = true; } } else if (monsterAttacked && monster.GetComponent <MonsterAI>().getCurrentStateName() == "ChasePlayer" || monsterAttacked && monster.GetComponent <MonsterAI>().getCurrentStateName() == "UnAware") { monsterAttacked = false; } } }
void Start() { numCollisionsWithMonster = 0; nextMonsterTutorialEvent = MonsterTutorialEvent.SHAKE; monsterCanAttack = false; monsterAttacked = false; Button LogbookBtn = Logbook.GetComponent <Button>(); LogbookBtn.interactable = false; indexCurrentDialog = 0; this.shakePanel = GameObject.FindGameObjectWithTag("SubControlPanel").GetComponent <ShakeGUI>(); this.mySubmarineRadar = GameObject.Find("Radar").GetComponent <SubmarineRadar>(); monsterSoundClip = GameObject.Find("MonsterClip").GetComponent <AudioSource>(); monsterEye.SetActive(false); submarine = GameObject.Find("Submarine"); monster = GameObject.FindGameObjectWithTag("Monster"); explosionSoundClip = GameObject.Find("CrashClip").GetComponent <AudioSource>(); }