Ejemplo n.º 1
0
    /// <summary>
    /// set the position to move to in world coords
    /// </summary>
    /// <param name="destentaion">the destination of the enemy</param>
    protected void MoveToWorldPos(Vector3 destentaion)
    {
        Vector2Int tileMapSpaceStart  = (Vector2Int)m_pathfinder.m_tileMap.WorldToCell(transform.position);
        Vector2Int tileMapSpaceTarget = (Vector2Int)m_pathfinder.m_tileMap.WorldToCell(destentaion);

        m_currentPath = m_pathfinder.PathFind(tileMapSpaceStart, tileMapSpaceTarget);

        if (showPath)
        {
            for (int i = 0; i < m_currentPath.Count; i++)
            {
                floortilemap.SetTileFlags(new Vector3Int(m_currentPath[i].x, m_currentPath[i].y, 0), TileFlags.None);
                floortilemap.SetColor(new Vector3Int(m_currentPath[i].x, m_currentPath[i].y, 0), Color.green);
                //Debug.Log(floortilemap.GetCellCenterWorld(new Vector3Int(m_currentPath[i].x, m_currentPath[i].y, 0)));
            }
        }
    }
Ejemplo n.º 2
0
    /// <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");
            }
        }
    }