Leo - storage finished2.0

This commit is contained in:
2022-12-10 13:09:57 +01:00
parent 7d8127e151
commit 797396b4f2
9 changed files with 26 additions and 20 deletions

View File

@@ -19,13 +19,10 @@ animations = [{
"speed": 2.0
}]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_p76ml"]
radius = 0.500599
height = 1.99403
[sub_resource type="CylinderShape3D" id="CylinderShape3D_h8ivv"]
radius = 0.494048
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ndwdl"]
radius = 1.26679
height = 2.53358
[sub_resource type="CylinderShape3D" id="CylinderShape3D_8lrgm"]
[node name="CharacterBody3D" type="CharacterBody3D"]
script = ExtResource("1_dta8q")
@@ -43,10 +40,12 @@ visible = false
texture = ExtResource("2_yjfj7")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("CapsuleShape3D_p76ml")
transform = Transform3D(1.57581, 0, 0, 0, 2.47805, 0, 0, 0, 1.5749, 0, 0, 0)
shape = SubResource("CylinderShape3D_h8ivv")
[node name="HitBox" type="Area3D" parent="."]
collision_mask = 5
[node name="CollisionShape3D" type="CollisionShape3D" parent="HitBox"]
shape = SubResource("CapsuleShape3D_ndwdl")
transform = Transform3D(2.74062, 0, 0, 0, 2.24144, 0, 0, 0, 2.70992, 0, 0, 0)
shape = SubResource("CylinderShape3D_8lrgm")

View File

@@ -5,13 +5,14 @@
[sub_resource type="CylinderShape3D" id="CylinderShape3D_c1ipa"]
height = 3.60519
radius = 1.29067
radius = 2.08877
[node name="Storage" type="StaticBody3D"]
script = ExtResource("1_guwoh")
currentType = 0
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1.10389, 0, 0, 0, 1, 0, 0, 0)
shape = SubResource("CylinderShape3D_c1ipa")
[node name="Sprite3D" type="Sprite3D" parent="."]

View File

@@ -29,7 +29,7 @@ _global_script_classes=[{
"language": &"GDScript",
"path": "res://scripts/Logic/MapNode.gd"
}, {
"base": "Node",
"base": "StaticBody3D",
"class": &"Module",
"language": &"GDScript",
"path": "res://scripts/Modules/Module.gd"

View File

@@ -5,5 +5,5 @@ class_name Bin
@onready var train = get_parent() as Train
#------------Methods-------------#
func interact():
func interact(player):
train.get_node("CharacterBody3D").inventory = 0

View File

@@ -15,7 +15,7 @@ func _ready():
currentStashValue = 1
currentState = STATE.INACTIVE
#TODO: FINISH
func interact():
func interact(player):
if currentState == STATE.INACTIVE:
#TODO: RELOADING

View File

@@ -15,7 +15,7 @@ func _ready():
currentStashValue = 100
currentState = STATE.RUNNING
#TODO: FINISH
func interact():
func interact(player):
if currentState == STATE.RUNNING:
if (train.current_speed + refuelRate) <= maxSpeed:
train.current_speed += refuelRate

View File

@@ -20,7 +20,7 @@ enum MODULE_TYPE {CANNON, STEERING, ENGINE, STORAGE}
#------------Methods-------------#
func interact():
func interact(player):
pass

View File

@@ -11,11 +11,12 @@ func _ready():
var root = get_tree().root.get_child(0)
root.ammo_pickup.connect(_on_signal_storing)
maxStashValue = 5
currentStashValue = 0
func interact():
currentStashValue = 5
func interact(player):
if currentStashValue >= 1:
currentStashValue -= 1
player.fill_inventory(currentType)
return
func _on_signal_storing():

View File

@@ -3,13 +3,14 @@ extends CharacterBody3D
#-----------Parameters--------------#
var SPEED = 10
var movement = Vector3(0,0,0)
var collisionLayer = 3
var inventory = 0 #1 - full, 0 - empty inventory
var resource = 0
var is_alive = true
@onready var is_player1 = true
enum TYPE {AMMO, GUNPOWDER, FUEL}
#---------------Methods--------------#
func _physics_process(delta):
@@ -65,6 +66,10 @@ func check_interaction():
if body is Module:
#Storage interaction
if not inventory && body is Storage:
body.interact()
body.interact(self)
elif inventory && not body is Storage:
body.interact()
body.interact(self)
func fill_inventory(type):
self.inventory = 1
self.resource = type