This repository has been archived on 2023-12-19. You can view files and clone it, but cannot push or open issues or pull requests.
MUR/scripts/player/base_inventory.gd
2019-07-23 19:49:04 +02:00

74 lines
1.4 KiB
GDScript

extends Spatial
class_name BaseInventory
var road_straights = [
roads_factory.BUMP,
roads_factory.BUMP_SMALL,
roads_factory.STRAIGHT,
roads_factory.STRAIGHT_SMALL,
]
var roads_left = [
roads_factory.CURVE_LEFT,
roads_factory.CURVE_LARGE_LEFT,
roads_factory.CURVE_SMALL_LEFT,
roads_factory.SKEW_LEFT,
roads_factory.CURVED_LEFT,
]
var roads_right = [
roads_factory.CURVE_RIGHT,
roads_factory.CURVE_LARGE_RIGHT,
roads_factory.CURVE_SMALL_RIGHT,
roads_factory.SKEW_RIGHT,
roads_factory.CURVED_RIGHT,
]
var roads_up = [
roads_factory.RAMP_UP,
roads_factory.RAMP_CURVED_UP,
roads_factory.RAMP_SMALL_UP,
]
var roads_down = [
roads_factory.RAMP_DOWN,
roads_factory.RAMP_CURVED_DOWN,
roads_factory.RAMP_SMALL_DOWN,
]
var roads_special = [
roads_factory.LOOP,
]
var roads = [ road_straights, roads_left, roads_right, roads_up, roads_down, roads_special ]
var player:Player
var route:Route
var item:Road
var type:int = 0
var index:int = 0
signal item_changed(index, player)
func _ready():
route = gamestate.game.route
func set_player(new_player:Player):
player = new_player
func set_item():
if is_network_master():
if item:
item.free()
item = roads_factory.get_road_instance(roads[type][index])
if player != null:
item.set_color(player.get_player_color())
item.rotate_y(PI/2)
emit_signal("item_changed", roads[type][index], player)