mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-08 01:49:35 +01:00
Now the dungeon teleporters switch between 2 materials for hover / normal states. This way only the hovered one will light up, instead of all. Also reworked them to use mesh data resources.
This commit is contained in:
parent
4a907a37c5
commit
df071af39c
@ -0,0 +1,5 @@
|
||||
[gd_resource type="MeshDataResource" format=2]
|
||||
|
||||
[resource]
|
||||
array = [ PoolVector3Array( -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5 ), PoolVector3Array( 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0 ), null, null, PoolVector2Array( 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1 ), null, null, null, PoolIntArray( 0, 1, 2, 2, 3, 0, 4, 6, 5, 4, 7, 6, 8, 9, 10, 10, 11, 8, 12, 14, 13, 12, 15, 14, 16, 17, 18, 18, 19, 16, 20, 22, 21, 20, 23, 22 ) ]
|
||||
aabb = AABB( -0.5, -0.5, -0.5, 1, 1, 1 )
|
@ -1,25 +1,23 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/dungeons/teleporters/dung_back_teleporter.gd" type="Script" id=1]
|
||||
[ext_resource path="res://textures/bricks/test_brick_albedo.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="CubeMesh" id=1]
|
||||
size = Vector3( 1, 1, 1 )
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=2]
|
||||
flags_vertex_lighting = true
|
||||
albedo_color = Color( 0.494118, 0.494118, 0.494118, 1 )
|
||||
albedo_texture = ExtResource( 2 )
|
||||
[ext_resource path="res://props/teleporters/dungeon/simple_dungeon_teleporter_material.tres" type="Material" id=3]
|
||||
[ext_resource path="res://props/teleporters/dungeon/simple_dungeon_teleporter_highlight_material.tres" type="Material" id=4]
|
||||
[ext_resource path="res://models/teleporters/dungeon/simple_dungeon_teleporter.tres" type="MeshDataResource" id=5]
|
||||
|
||||
[sub_resource type="BoxShape" id=3]
|
||||
extents = Vector3( 0.5, 0.5, 0.5 )
|
||||
|
||||
[node name="DungeonBackTeleporter" type="StaticBody"]
|
||||
script = ExtResource( 1 )
|
||||
default_material = ExtResource( 3 )
|
||||
hover_material = ExtResource( 4 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
mesh = SubResource( 1 )
|
||||
material/0 = SubResource( 2 )
|
||||
[node name="MeshDataInstance" type="MeshDataInstance" parent="."]
|
||||
mesh_data = ExtResource( 5 )
|
||||
texture = ExtResource( 2 )
|
||||
material = ExtResource( 3 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="."]
|
||||
shape = SubResource( 3 )
|
||||
|
@ -1,28 +1,25 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/dungeons/teleporters/dung_teleporter.gd" type="Script" id=1]
|
||||
[ext_resource path="res://props/teleporters/dungeon/simple_dungeon_back_teleporter.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://models/teleporters/dungeon/simple_dungeon_teleporter.tres" type="MeshDataResource" id=3]
|
||||
[ext_resource path="res://textures/bricks/test_brick_albedo.png" type="Texture" id=4]
|
||||
|
||||
[sub_resource type="CubeMesh" id=1]
|
||||
size = Vector3( 1, 1, 1 )
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=2]
|
||||
flags_vertex_lighting = true
|
||||
albedo_color = Color( 0.494118, 0.494118, 0.494118, 1 )
|
||||
albedo_texture = ExtResource( 4 )
|
||||
[ext_resource path="res://props/teleporters/dungeon/simple_dungeon_teleporter_material.tres" type="Material" id=5]
|
||||
[ext_resource path="res://props/teleporters/dungeon/simple_dungeon_teleporter_highlight_material.tres" type="Material" id=6]
|
||||
|
||||
[sub_resource type="BoxShape" id=3]
|
||||
extents = Vector3( 0.5, 0.5, 0.5 )
|
||||
|
||||
[node name="DungeonTeleporter" type="StaticBody"]
|
||||
script = ExtResource( 1 )
|
||||
default_albedo = Color( 0.521569, 0.521569, 0.521569, 1 )
|
||||
default_material = ExtResource( 5 )
|
||||
hover_material = ExtResource( 6 )
|
||||
dungeon_back_teleporter = ExtResource( 2 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
mesh = SubResource( 1 )
|
||||
material/0 = SubResource( 2 )
|
||||
[node name="MeshDataInstance" type="MeshDataInstance" parent="."]
|
||||
mesh_data = ExtResource( 3 )
|
||||
texture = ExtResource( 4 )
|
||||
material = ExtResource( 5 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="."]
|
||||
shape = SubResource( 3 )
|
||||
|
@ -0,0 +1,9 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://shaders/5_standard_shader_nouv2.tres" type="Shader" id=1]
|
||||
[ext_resource path="res://textures/bricks/test_brick_albedo.png" type="Texture" id=2]
|
||||
|
||||
[resource]
|
||||
shader = ExtResource( 1 )
|
||||
shader_param/albedo = Color( 0.65098, 0.65098, 0.65098, 1 )
|
||||
shader_param/texture_albedo = ExtResource( 2 )
|
@ -0,0 +1,9 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://shaders/5_standard_shader_nouv2.tres" type="Shader" id=1]
|
||||
[ext_resource path="res://textures/bricks/test_brick_albedo.png" type="Texture" id=2]
|
||||
|
||||
[resource]
|
||||
shader = ExtResource( 1 )
|
||||
shader_param/albedo = Color( 0.521569, 0.521569, 0.521569, 1 )
|
||||
shader_param/texture_albedo = ExtResource( 2 )
|
@ -1,7 +1,7 @@
|
||||
extends StaticBody
|
||||
|
||||
export(Color) var default_albedo : Color = Color(0.494118, 0.494118, 0.494118)
|
||||
export(Color) var hover_albedo : Color = Color(0.65098, 0.65098, 0.65098)
|
||||
export(Material) var default_material : Material = null
|
||||
export(Material) var hover_material : Material = null
|
||||
export(float) var use_range : float = 5
|
||||
|
||||
var _dungeon : Spatial = null
|
||||
@ -17,20 +17,20 @@ func _ready():
|
||||
connect("mouse_entered", self, "on_mouse_entered")
|
||||
connect("mouse_exited", self, "on_mouse_exited")
|
||||
|
||||
var mat = $MeshInstance.get_surface_material(0)
|
||||
mat.albedo_color = default_albedo
|
||||
if default_material:
|
||||
$MeshDataInstance.material = default_material
|
||||
|
||||
func on_mouse_entered():
|
||||
var mat = $MeshInstance.get_surface_material(0)
|
||||
mat.albedo_color = hover_albedo
|
||||
if hover_material:
|
||||
$MeshDataInstance.material = hover_material
|
||||
|
||||
Input.set_default_cursor_shape(Input.CURSOR_POINTING_HAND)
|
||||
|
||||
_mouse_hover = true
|
||||
|
||||
func on_mouse_exited():
|
||||
var mat = $MeshInstance.get_surface_material(0)
|
||||
mat.albedo_color = default_albedo
|
||||
if default_material:
|
||||
$MeshDataInstance.material = default_material
|
||||
|
||||
Input.set_default_cursor_shape(Input.CURSOR_ARROW)
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
extends StaticBody
|
||||
|
||||
export(Color) var default_albedo : Color = Color(0.494118, 0.494118, 0.494118)
|
||||
export(Color) var hover_albedo : Color = Color(0.65098, 0.65098, 0.65098)
|
||||
export(Material) var default_material : Material = null
|
||||
export(Material) var hover_material : Material = null
|
||||
|
||||
export(float) var use_range : float = 5
|
||||
|
||||
export(PackedScene) var dungeon : PackedScene
|
||||
@ -29,20 +30,20 @@ func _ready():
|
||||
connect("mouse_entered", self, "on_mouse_entered")
|
||||
connect("mouse_exited", self, "on_mouse_exited")
|
||||
|
||||
var mat = $MeshInstance.get_surface_material(0)
|
||||
mat.albedo_color = default_albedo
|
||||
if default_material:
|
||||
$MeshDataInstance.material = default_material
|
||||
|
||||
func on_mouse_entered():
|
||||
var mat = $MeshInstance.get_surface_material(0)
|
||||
mat.albedo_color = hover_albedo
|
||||
if hover_material:
|
||||
$MeshDataInstance.material = hover_material
|
||||
|
||||
Input.set_default_cursor_shape(Input.CURSOR_POINTING_HAND)
|
||||
|
||||
_mouse_hover = true
|
||||
|
||||
func on_mouse_exited():
|
||||
var mat = $MeshInstance.get_surface_material(0)
|
||||
mat.albedo_color = default_albedo
|
||||
if default_material:
|
||||
$MeshDataInstance.material = default_material
|
||||
|
||||
Input.set_default_cursor_shape(Input.CURSOR_ARROW)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user