summaryrefslogtreecommitdiff
path: root/scripts/Airplane.gd
blob: b13ed3382de997c8d1dbd0cfd8445f30cdb76975 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class_name Airplane
extends Area

var starting_altitude: int = 0 # initial altitude for the turn, determines number of actions
var altitude: int = 0 # 0, 1, or 2
var pos_x: int 
var pos_y: int

onready var meshes = [$Fuselage, $Cone, $Wings, $Tail]

# bearings:         E,       NE,       NW,       W,      SW,     SE
const bearings = [ [0,1] , [-1, 0], [-1, -1], [0, -1], [1, 0], [1, 1] ]
var bearing: int = 0 # index of above list of potential bearings

var destination_num: int   # for display purposes only
var destination_col: Color # for display purposes only
var destination_name: String # for display purposes
var destination_id: int # determines above ^

var owner_id : String

var rotation_tween: Tween = null

var actions: Array = []

var plane_material

func _ready():
	plane_material = load("res://resources/blank_plane_material.material").duplicate()
	for mesh in meshes:
		mesh.set_surface_material(0, plane_material)
	
	var new_col = Color(randf(), randf(), randf() )
	set_color(new_col)

func set_color(color: Color):
	plane_material.set_albedo(color)

func _on_Plane_mouse_entered():
	$ActionIndicator.visible = true


func _on_Plane_mouse_exited():
	$ActionIndicator.visible = false


func _on_Plane_input_event(camera, event, position, normal, shape_idx):
	pass # Replace with function body.