private void Start() { m_pathfinder = GameObject.FindObjectOfType <Pathfinder_SebastianMol>(); m_scale = transform.localScale.x; m_lastPos = transform.position; m_startPos = transform.position; m_patrolIteratorMax = m_patrolPoints.Length - 1; m_patroleTimer = m_deleyBetweenPatrol; if (m_patrolPoints.Length > 0) { m_currentPatrolePos = m_patrolPoints[0]; } m_lookLeftAndRightTimerMax = m_lookLeftAndRightTimer; m_maxHealth = m_health; m_outOfSightTimer = m_outOfSightDeley; m_maxAttackRange = m_attackRange; m_inventory = GameObject.Find("Player").GetComponent <Inventory_JoaoBeijinho>(); m_playerStealthScript = FindObjectOfType <PlayerStealth_JoaoBeijinho>(); m_HitEffectElliott = GetComponent <HitEffectElliott>(); m_cameraShake = Camera.main.GetComponent <CameraShakeElliott>(); }
/// <summary> /// ovveride class that holds logic for what the enemy shoudl do when in the attack state /// </summary> internal override void AttackBehaviour() { if (m_currentEnemyType == m_enemyType.PETTIGER) { if (showPathBeforAttackTigerBoss) { if (doOnceShowPath) { doOnceShowPath = false; pathFinder = GameObject.FindObjectOfType <Pathfinder_SebastianMol>(); daPath = pathFinder.PathFind((Vector2Int)pathFinder.m_tileMap.WorldToCell(m_playerTransform.position), (Vector2Int)pathFinder.m_tileMap.WorldToCell(transform.position)); for (int i = 0; i < daPath.Count; i++) { Debug.Log(daPath[i].x + " " + daPath[i].y); floortilemap.SetTileFlags(new Vector3Int(daPath[i].x, daPath[i].y, 0), TileFlags.None); floortilemap.SetColor(new Vector3Int(daPath[i].x, daPath[i].y, 0), Color.red); } } } if (EnemyAttacks_SebastianMol.ChargeAttack(m_playerTransform, ref m_attackTimer, m_attackCollider, m_hitSpeed, gameObject, m_chargeAttackSpeed)) //make this ibnto a public variable { //here teh tatack has not yet happened if (showPathBeforAttackTigerBoss) { doOnceShowPath = true; for (int i = 0; i < daPath.Count; i++) { floortilemap.SetColor(new Vector3Int(daPath[i].x, daPath[i].y, 0), Color.white); } } } else { //here the attack has happened if (showPathBeforAttackTigerBoss) { if (doOnceShowPath) { doOnceShowPath = false; pathFinder = GameObject.FindObjectOfType <Pathfinder_SebastianMol>(); daPath = pathFinder.PathFind((Vector2Int)pathFinder.m_tileMap.WorldToCell(m_playerTransform.position), (Vector2Int)pathFinder.m_tileMap.WorldToCell(transform.position)); for (int i = 0; i < daPath.Count; i++) { Debug.Log(daPath[i].x + " " + daPath[i].y); floortilemap.SetTileFlags(new Vector3Int(daPath[i].x, daPath[i].y, 0), TileFlags.None); floortilemap.SetColor(new Vector3Int(daPath[i].x, daPath[i].y, 0), Color.red); } } } } } else { if (EnemyAttacks_SebastianMol.MelleAttack(ref m_attackTimer, m_hasChargeAttack, m_chargAttackPosibility, QuickAttack, ChargeAttack, StunAfterAttack, m_currentEnemyType, m_hitSpeed, GetComponent <Enemy_Animation_LouieWilliamson>())) { Debug.Log("attack"); } } }