Big big update
This commit is contained in:
@@ -25,5 +25,10 @@
|
||||
</Entity>
|
||||
-->
|
||||
|
||||
<Entity classname="trigger_deleter">
|
||||
<Position x="5.6301" y="1.5930" z="6.9631"/>
|
||||
<IsDisableled value="false" />
|
||||
</Entity>
|
||||
|
||||
</Entities>
|
||||
</Level>
|
||||
@@ -2,6 +2,7 @@
|
||||
<LevelDescription>
|
||||
<SceneFile filename="zavod.scene"/>
|
||||
<Skybox name="skybox/sky_01.dae"/>
|
||||
<AmbientColor r="0.0" g="0.0" b="0.0"/>
|
||||
</LevelDescription>
|
||||
|
||||
<Entities>
|
||||
@@ -22,7 +23,7 @@
|
||||
<Entity classname="Light">
|
||||
<Position x="11.56" y="1.39" z="-4.14" />
|
||||
<IsDisableled value="false" />
|
||||
<Color r="0.7" g="0.5" b="0.5"/>
|
||||
<Color r="0.7" g="0.7" b="0.9"/>
|
||||
<Radius value="5"/>
|
||||
</Entity>
|
||||
|
||||
@@ -38,14 +39,14 @@
|
||||
<Entity classname="Light">
|
||||
<Position x="1.72" y="1.39" z="-0.37" />
|
||||
<IsDisableled value="false" />
|
||||
<Color r="0.7" g="0.5" b="0.5"/>
|
||||
<Color r="0.7" g="0.7" b="0.9"/>
|
||||
<Radius value="5"/>
|
||||
</Entity>
|
||||
|
||||
<Entity classname="Light">
|
||||
<Position x="6.33" y="1.39" z="-0.37" />
|
||||
<IsDisableled value="false" />
|
||||
<Color r="0.7" g="0.5" b="0.5"/>
|
||||
<Color r="0.7" g="0.7" b="0.9"/>
|
||||
<Radius value="5"/>
|
||||
</Entity>
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ local BLUE_COLOR = { 0.0, 0.0, 1.0, 1.0 }
|
||||
local BLACK_COLOR = { 0.0, 0.0, 0.0, 1.0 }
|
||||
local WHITE_COLOR = { 1.0, 1.0, 1.0, 1.0 }
|
||||
|
||||
local draw_test_hud = false
|
||||
local draw_test_hud = true
|
||||
local draw_example_test_hud = true
|
||||
local draw_debug_string = false
|
||||
local debug_string_text = ""
|
||||
local debug_string_time = 0.0
|
||||
@@ -15,14 +16,16 @@ function game_hud_draw( )
|
||||
return
|
||||
end
|
||||
|
||||
-- example of color
|
||||
local color = { 0.5, 0.5, 0.1, 1.0 }
|
||||
if draw_example_test_hud then
|
||||
-- example of color
|
||||
local color = { 0.5, 0.5, 0.1, 1.0 }
|
||||
|
||||
-- example of drawing
|
||||
ui.draw_rect(100.0, 100.0, 400.0, 400.0, BLUE_COLOR)
|
||||
ui.draw_image("data/textures/koshka1.jpg", 110.0, 110.0, 390.0, 390.0, WHITE_COLOR)
|
||||
ui.draw_text("Hello, world!", 200.0, 200.0, GREEN_COLOR)
|
||||
end
|
||||
|
||||
-- example of drawing
|
||||
ui.draw_rect(150.0, 150.0, 350.0, 350.0, BLUE_COLOR)
|
||||
ui.draw_image("data/textures/koshka1.jpg", 160.0, 160.0, 340.0, 340.0, WHITE_COLOR)
|
||||
ui.draw_text("Hello, world!", 200.0, 200.0, GREEN_COLOR)
|
||||
|
||||
if g_player then
|
||||
game_player_hud_draw()
|
||||
end
|
||||
|
||||
@@ -7,13 +7,13 @@ load_script("game_object.lua")
|
||||
load_script("test_object.lua")
|
||||
|
||||
load_script("weapons/weapon_base.lua")
|
||||
|
||||
load_script("weapons/weapon_ump.lua")
|
||||
|
||||
load_script("actors/actor_base.lua")
|
||||
|
||||
load_script("actors/actor_player.lua")
|
||||
|
||||
load_script("triggers/trigger_deleter.lua")
|
||||
|
||||
-- глобальные переменные
|
||||
g_player = nil
|
||||
|
||||
@@ -22,18 +22,24 @@ g_entity_table = {
|
||||
-- Lua class -- CPP class -- Description
|
||||
|
||||
-- Actors
|
||||
|
||||
{ "actor_player", "ActorBase", "Player entity" },
|
||||
{ "actor_player", "ActorBase", "Player entity" },
|
||||
|
||||
-- Weapons
|
||||
{ "weapon_ump", "WeaponBase", "Weapon UMP" },
|
||||
{ "weapon_ump", "WeaponBase", "Weapon UMP" },
|
||||
|
||||
-- Triggers
|
||||
{ "trigger_deleter", "TriggerBase", "Example trigger" },
|
||||
|
||||
-- Simple entity
|
||||
{ "test_object", "Entity", "Test entity" },
|
||||
|
||||
|
||||
{ "test_object", "Entity", "Test entity" },
|
||||
}
|
||||
|
||||
function sv_game_init( )
|
||||
console.print("--- Game initialization ---")
|
||||
end
|
||||
|
||||
function sv_on_game_start( )
|
||||
console.print("Welcome to our Engine")
|
||||
|
||||
|
||||
end
|
||||
|
||||
24
data/scripts/triggers/trigger_deleter.lua
Normal file
24
data/scripts/triggers/trigger_deleter.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
-- тестовый класс
|
||||
trigger_deleter = inherit_table(game_object)
|
||||
|
||||
function trigger_deleter:on_init()
|
||||
game_object.on_init(self)
|
||||
|
||||
self:create_box_body(1.0, 1.0, 1.0, 0.0, 0.0, 0.0, true, false)
|
||||
end
|
||||
|
||||
function trigger_deleter:on_shutdown()
|
||||
game_object.on_shutdown(self)
|
||||
end
|
||||
|
||||
function trigger_deleter:on_update(dt)
|
||||
game_object.on_shutdown(self, dt)
|
||||
end
|
||||
|
||||
function trigger_deleter:on_collide(other)
|
||||
console.print(string.format("trigger_deleter:on_collide: %s", other:get_classname()))
|
||||
put_debug_string_to_screen(string.format("trigger_deleter:on_collide: %s", other:get_classname()), 4)
|
||||
|
||||
-- FOR TEST
|
||||
other:mark_for_delete()
|
||||
end
|
||||
@@ -45,7 +45,8 @@ function weapon_base:on_fsm_state_update(dt)
|
||||
|
||||
-- проверка на стрельбу
|
||||
if (self.m_state == WEAPON_FSM_STATE_ATTACK or
|
||||
self.m_state == WEAPON_FSM_STATE_ATTACK2) and
|
||||
self.m_state == WEAPON_FSM_STATE_ATTACK2 or
|
||||
self.m_state == WEAPON_FSM_STATE_RELOAD) and
|
||||
self.m_state_time >= self.m_end_state_time then
|
||||
|
||||
-- переходим в ожидание
|
||||
@@ -113,6 +114,10 @@ function weapon_base:on_state_switch(state)
|
||||
|
||||
local anim_id = self:find_animation(fsm_state.anim)
|
||||
self:play_animation(anim_id, fsm_state.anim_playback)
|
||||
|
||||
if fsm_state.anim_sound then
|
||||
engine.play_sound(fsm_state.anim_sound)
|
||||
end
|
||||
end
|
||||
|
||||
function weapon_base:set_relative_position_to_camera( ent )
|
||||
|
||||
@@ -17,14 +17,16 @@ weapon_ump.m_fsm[WEAPON_FSM_STATE_IDLE] = {
|
||||
weapon_ump.m_fsm[WEAPON_FSM_STATE_ATTACK] = {
|
||||
anim = "shoot1", -- имя анимации
|
||||
anim_playback = ANIM_PLAYBACK_NONE,
|
||||
anim_speed = 1.0 -- обычная скорость анимации
|
||||
anim_speed = 1.0, -- обычная скорость анимации
|
||||
anim_sound = "data/sounds/weapons/ump45_shoot.wav"
|
||||
}
|
||||
|
||||
-- перезарядка
|
||||
weapon_ump.m_fsm[WEAPON_FSM_STATE_RELOAD] = {
|
||||
anim = "reload", -- имя анимации
|
||||
anim_playback = ANIM_PLAYBACK_NONE,
|
||||
anim_speed = 1.0 -- обычная скорость анимации
|
||||
anim_speed = 1.0, -- обычная скорость анимации
|
||||
anim_sound = "data/sounds/weapons/ump45_reload.wav"
|
||||
}
|
||||
|
||||
function weapon_ump:on_init()
|
||||
|
||||
Reference in New Issue
Block a user