Exemplo n.º 1
0
        void UpdateNode(InternalPathNode from, InternalPathNode neighbor)
        {
            switch (neighbor.action)
            {
            case ActionType.WALK:
                var parent = parents.Get(from);
                InternalPathNode visibleParent = HasLineOfSight(parent.coord, neighbor.coord) ? parent : from;
                float            cost          = movementCosts.Get(visibleParent.coord) + Distance(visibleParent.coord, neighbor.coord) + level.GetCost(neighbor.coord);

                TrySetNodeValues(neighbor, visibleParent, cost);

                break;

            case ActionType.JUMP:
                TrySetNodeValues(neighbor, from, movementCosts.Get(from.coord) + jumpCost);

                break;

            case ActionType.FALL:
                TrySetNodeValues(neighbor, from, movementCosts.Get(from.coord) + fallCost);

                break;

            case ActionType.GAP_JUMP:
                TrySetNodeValues(neighbor, from, movementCosts.Get(from.coord) + gapJumpCost);

                break;

            default:
                Debug.LogWarning("Could not finding movement type for " + neighbor);
                break;
            }
        }