Пример #1
0
 // Update is called once per frame
 void Update()
 {
     enemy.GetComponent <Transform>().position = new Vector3(enemyPos.x, 0, enemyPos.y);
     item.GetComponent <Transform>().position  = new Vector3(itemPos.x, 0, itemPos.y);
     Mapping();
     Debug.Log("アイテムと敵の距離" + influenceMap.PolygonalDistance(enemyPos, itemPos, (judge) =>
     {
         return(passableMap[judge.x, judge.y] == true);
     }));
 }
Пример #2
0
    /// <summary> playerを見つけたときtrue </summary>
    public bool FindPlayer()
    {
        Vector2Int diff = EnemyPosition - PlayerPosition;

        if (diff.x == 0 || diff.y == 0)
        {
            int pd = _influenceMap.PolygonalDistance(EnemyPosition, PlayerPosition,
                                                     position => _passableMap[position.x, position.y]);
            int mag = Mathf.Abs(diff.x + diff.y);
            if (pd == mag)
            {
                return(true);
            }
        }
        return(false);
    }