Merge branch 'main' of https://github.com/marcericmartel/MAD
This commit is contained in:
commit
441d033f53
@ -6,10 +6,7 @@
|
||||
- https://www.youtube.com/watch?v=7L6ZUYj1hs8
|
||||
|
||||
## 3d Assets
|
||||
- https://ace-spectre.itch.io/ps1-heavy-and-light-weapons-pack
|
||||
- https://loafbrr.itch.io/small-apartment-block
|
||||
- https://dripsone.itch.io/barrels-psx-low-poly
|
||||
- https://t-allen-studios.itch.io/turret-pack-01
|
||||
- https://davidoreilly.itch.io/everything-library-buildings
|
||||
|
||||
## Textures
|
||||
|
BIN
assets/meshes/nuke.glb
Normal file
BIN
assets/meshes/nuke.glb
Normal file
Binary file not shown.
23
assets/meshes/nuke.tscn
Normal file
23
assets/meshes/nuke.tscn
Normal file
@ -0,0 +1,23 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://py8i4xd737su"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c1jm7opwb0i3l" path="res://assets/meshes/nuke.glb" id="1_c0u7n"]
|
||||
|
||||
[node name="nuke" instance=ExtResource("1_c0u7n")]
|
||||
|
||||
[node name="barrel" parent="." index="0"]
|
||||
transform = Transform3D(13.841, 0, 1.81305, 0, 4.55649, 0, -1.81305, 0, 13.841, 0.425865, 0.923079, -2.34237)
|
||||
|
||||
[node name="barrel001" parent="." index="1"]
|
||||
transform = Transform3D(-10.859, -4.22546e-07, -1.42244, 3.53092e-06, -1.3106, 2.30277e-07, -1.42244, -2.75573e-08, 10.859, 0.149696, 5.33207, -2.48934)
|
||||
|
||||
[node name="Sphere" parent="." index="2"]
|
||||
transform = Transform3D(8.78036, 0, 0, 0, 7.04411, 0, 0, 0, 8.78036, 0.213692, 6.0137, -2.55096)
|
||||
|
||||
[node name="Sphere001" parent="." index="3"]
|
||||
transform = Transform3D(7.77461, 0, 0, 0, 6.23723, 0, 0, 0, 7.77461, 0.213692, 7.40261, -2.55096)
|
||||
|
||||
[node name="Sphere002" parent="." index="4"]
|
||||
transform = Transform3D(6.93864, 0, 0, 0, 5.56657, 0, 0, 0, 6.93864, 0.213692, 8.36782, -2.55096)
|
||||
|
||||
[node name="base018" parent="." index="5"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -3.57628e-09, -0.000221213, 0, 0.01, -7.9112e-11, 0.572624, 6.1917, -2.18874)
|
BIN
assets/meshes/nuke_barrel rust.png
Normal file
BIN
assets/meshes/nuke_barrel rust.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 115 KiB |
BIN
assets/meshes/nuke_barrel.png
Normal file
BIN
assets/meshes/nuke_barrel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 196 KiB |
BIN
assets/meshes/radiotower.glb
Normal file
BIN
assets/meshes/radiotower.glb
Normal file
Binary file not shown.
47
assets/meshes/radiotower.tscn
Normal file
47
assets/meshes/radiotower.tscn
Normal file
@ -0,0 +1,47 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cy2sb2tms48ir"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://b50ks0m7wbpwa" path="res://assets/meshes/radiotower.glb" id="1_ysm58"]
|
||||
|
||||
[node name="radiotower" instance=ExtResource("1_ysm58")]
|
||||
|
||||
[node name="base080" parent="." index="0"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -3.57628e-09, -0.01, 0, 0.01, -3.57628e-09, 11.2953, 0.137924, -9.25926)
|
||||
|
||||
[node name="refl014" parent="." index="1"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -3.57628e-09, -0.01, 0, 0.01, -3.57628e-09, 11.2953, 0.137924, -9.25926)
|
||||
|
||||
[node name="windowRefl062" parent="." index="2"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -3.57628e-09, -0.01, 0, 0.01, -3.57628e-09, 11.2953, 0.137924, -9.25926)
|
||||
|
||||
[node name="base054" parent="." index="3"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -3.04798e-09, -0.01, 0, 0.00852277, -3.57628e-09, -1.57031, 3.38902, 4.11092)
|
||||
|
||||
[node name="windowRefl037" parent="." index="4"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -3.04798e-09, -0.01, 0, 0.00852277, -3.57628e-09, -1.57031, 3.38902, 4.11092)
|
||||
|
||||
[node name="base055" parent="." index="5"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -3.04798e-09, -0.01, 0, 0.00852277, -3.57628e-09, -1.57031, 3.38902, 4.11092)
|
||||
|
||||
[node name="base056" parent="." index="6"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -3.04798e-09, -0.01, 0, 0.00852277, -3.57628e-09, -1.57031, 3.38902, 4.11092)
|
||||
|
||||
[node name="windowRefl038" parent="." index="7"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -3.04798e-09, -0.01, 0, 0.00852277, -3.57628e-09, -1.57031, 3.38902, 4.11092)
|
||||
|
||||
[node name="base057" parent="." index="8"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -3.04798e-09, -0.01, 0, 0.00852277, -3.57628e-09, -1.57031, 3.38902, 4.11092)
|
||||
|
||||
[node name="base058" parent="." index="9"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -3.04798e-09, -0.01, 0, 0.00852277, -3.57628e-09, -1.57031, 3.38902, 4.11092)
|
||||
|
||||
[node name="windowRefl039" parent="." index="10"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -3.04798e-09, -0.01, 0, 0.00852277, -3.57628e-09, -1.57031, 3.38902, 4.11092)
|
||||
|
||||
[node name="base059" parent="." index="11"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -3.04798e-09, -0.01, 0, 0.00852277, -3.57628e-09, -1.57031, 3.38902, 4.11092)
|
||||
|
||||
[node name="windowRefl040" parent="." index="12"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -3.04798e-09, -0.01, 0, 0.00852277, -3.57628e-09, -1.57031, 3.38902, 4.11092)
|
||||
|
||||
[node name="DblSided" parent="." index="13"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -3.57628e-09, -0.01, 0, 0.01, -3.57628e-09, -13.4613, 16.0958, 4.65294)
|
30
buildings/arms_buildings/nuke.tscn
Normal file
30
buildings/arms_buildings/nuke.tscn
Normal file
@ -0,0 +1,30 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://bh6e2nxqswoqg"]
|
||||
|
||||
[ext_resource type="Script" path="res://buildings/arms_building.cs" id="1_wbsyl"]
|
||||
[ext_resource type="PackedScene" uid="uid://py8i4xd737su" path="res://assets/meshes/nuke.tscn" id="2_upv26"]
|
||||
[ext_resource type="PackedScene" uid="uid://m3lrwoup4i4r" path="res://buildings/grass_block.tscn" id="3_xrkoj"]
|
||||
|
||||
[node name="radiotower" type="Node3D" node_paths=PackedStringArray("BlocksNode")]
|
||||
transform = Transform3D(-1, 0, -1.50996e-07, 0, 1, 0, 1.50996e-07, 0, -1, 0, 0, 0)
|
||||
script = ExtResource("1_wbsyl")
|
||||
Megaton = 10
|
||||
ApprovalDrop = 5
|
||||
BlocksNode = NodePath("blocks")
|
||||
DisplayName = "Radio Tower"
|
||||
KashCost = 30
|
||||
|
||||
[node name="nuke" parent="." instance=ExtResource("2_upv26")]
|
||||
transform = Transform3D(0.119675, 0, 0, 0, 0.119675, 0, 0, 0, 0.119675, -1.0343, 0.45843, -0.638305)
|
||||
|
||||
[node name="blocks" type="Node3D" parent="."]
|
||||
|
||||
[node name="grass_block" parent="blocks" instance=ExtResource("3_xrkoj")]
|
||||
|
||||
[node name="grass_block2" parent="blocks" instance=ExtResource("3_xrkoj")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, -1.74846e-07)
|
||||
|
||||
[node name="grass_block3" parent="blocks" instance=ExtResource("3_xrkoj")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.82782e-07, 0, -2)
|
||||
|
||||
[node name="grass_block4" parent="blocks" instance=ExtResource("3_xrkoj")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, -2)
|
@ -1,31 +1,57 @@
|
||||
using Godot;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class base_building : Node3D
|
||||
{
|
||||
[Export]
|
||||
public Node3D BlocksNode { get; set; } = null;
|
||||
private building_block[] _blocks = null;
|
||||
private List<building_block> _blocks = null;
|
||||
|
||||
[Export]
|
||||
public string DisplayName { get; set; } = "base_building";
|
||||
[Export]
|
||||
public int KashCost { get; set; } = 1;
|
||||
public bool IsPlaced { get; set; } = false;
|
||||
|
||||
public bool IsPlaceable
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
if (_blocks == null || _blocks.Count < 1)
|
||||
return false;
|
||||
|
||||
foreach (building_block block in _blocks)
|
||||
if (!block.IsPlaceable)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
if (BlocksNode != null)
|
||||
{
|
||||
|
||||
_blocks = new List<building_block>();
|
||||
foreach (Node child in BlocksNode.GetChildren())
|
||||
{
|
||||
_blocks.Add((building_block)child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
// if (!IsPlaced)
|
||||
//{
|
||||
//if (IsPlaceable)
|
||||
//{
|
||||
////show green highlight
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
////show red highlight
|
||||
//}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +1,18 @@
|
||||
using Godot;
|
||||
public enum TileTypes
|
||||
{
|
||||
NONE,
|
||||
Grass,
|
||||
Sand,
|
||||
Water,
|
||||
}
|
||||
|
||||
|
||||
public partial class building_block : Node3D
|
||||
{
|
||||
[Export]
|
||||
public RayCast3D _ray = null;
|
||||
|
||||
private RayCast3D _ground_ray;
|
||||
[Export]
|
||||
private TileTypes _compatible_tile = TileTypes.NONE;
|
||||
private RayCast3D _collision_ray;
|
||||
|
||||
public bool IsPlaceable
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ray == null || _compatible_tile == TileTypes.NONE)
|
||||
return false;
|
||||
|
||||
GodotObject collider = _ray.GetCollider();
|
||||
GD.Print(collider);
|
||||
|
||||
if (collider == null)
|
||||
return false;
|
||||
|
||||
return false;
|
||||
return _collision_ray.GetCollider() == null && _ground_ray.GetCollider() != null && _ground_ray.GetCollider().GetType() == typeof(GridMap);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,34 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://m3lrwoup4i4r"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://m3lrwoup4i4r"]
|
||||
|
||||
[ext_resource type="Script" path="res://buildings/building_block.cs" id="1_3ht4p"]
|
||||
[ext_resource type="PackedScene" uid="uid://cdakee12nn8un" path="res://assets/meshes/highlights_grass.tscn" id="2_m6bs4"]
|
||||
|
||||
[node name="grass_block" type="Node3D" node_paths=PackedStringArray("_ray")]
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_gr51o"]
|
||||
size = Vector3(1.8, 2, 1.8)
|
||||
|
||||
[node name="grass_block" type="Node3D" node_paths=PackedStringArray("_ground_ray", "_collision_ray")]
|
||||
script = ExtResource("1_3ht4p")
|
||||
_ray = NodePath("RayCast3D")
|
||||
_compatible_tile = 1
|
||||
_ground_ray = NodePath("Area3D/GroundCheck")
|
||||
_collision_ray = NodePath("Area3D/AreaCast")
|
||||
|
||||
[node name="highlights-grass" parent="." instance=ExtResource("2_m6bs4")]
|
||||
visible = false
|
||||
|
||||
[node name="RayCast3D" type="RayCast3D" parent="."]
|
||||
[node name="Area3D" type="Area3D" parent="."]
|
||||
collision_layer = 2
|
||||
collision_mask = 0
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
shape = SubResource("BoxShape3D_gr51o")
|
||||
|
||||
[node name="GroundCheck" type="RayCast3D" parent="Area3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.693845, 0)
|
||||
|
||||
[node name="AreaCast" type="RayCast3D" parent="Area3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.23187, 0)
|
||||
collision_mask = 2
|
||||
hit_from_inside = true
|
||||
collide_with_areas = true
|
||||
collide_with_bodies = false
|
||||
|
26
buildings/propaganda_buildings/radiotower.tscn
Normal file
26
buildings/propaganda_buildings/radiotower.tscn
Normal file
@ -0,0 +1,26 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://b8f1n3hp1fdlm"]
|
||||
|
||||
[ext_resource type="Script" path="res://buildings/propaganda_building.cs" id="1_oo36g"]
|
||||
[ext_resource type="PackedScene" uid="uid://cy2sb2tms48ir" path="res://assets/meshes/radiotower.tscn" id="2_4131e"]
|
||||
[ext_resource type="PackedScene" uid="uid://m3lrwoup4i4r" path="res://buildings/grass_block.tscn" id="3_pn4dl"]
|
||||
|
||||
[node name="radiotower" type="Node3D" node_paths=PackedStringArray("BlocksNode")]
|
||||
transform = Transform3D(-1, 0, -1.50996e-07, 0, 1, 0, 1.50996e-07, 0, -1, 0, 0, 0)
|
||||
script = ExtResource("1_oo36g")
|
||||
ApprovalGain = 10
|
||||
BlocksNode = NodePath("blocks")
|
||||
DisplayName = "Radio Tower"
|
||||
KashCost = 5
|
||||
|
||||
[node name="mesh" parent="." instance=ExtResource("2_4131e")]
|
||||
transform = Transform3D(0.0728245, 0, 0, 0, 0.107886, 0, 8.88178e-16, 0, 0.0995826, -0.758167, 0.0287335, -0.422459)
|
||||
|
||||
[node name="blocks" type="Node3D" parent="."]
|
||||
|
||||
[node name="grass_block" parent="blocks" instance=ExtResource("3_pn4dl")]
|
||||
|
||||
[node name="grass_block2" parent="blocks" instance=ExtResource("3_pn4dl")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, -1.74846e-07)
|
||||
|
||||
[node name="grass_block3" parent="blocks" instance=ExtResource("3_pn4dl")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.82782e-07, 0, -2)
|
@ -1,13 +0,0 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dffhktks7ro6y"]
|
||||
|
||||
[ext_resource type="Script" path="res://buildings/building_block.cs" id="1_xuxw4"]
|
||||
[ext_resource type="PackedScene" uid="uid://bea5tpiqs0m4b" path="res://assets/meshes/highlights_sand.tscn" id="2_pmjbb"]
|
||||
|
||||
[node name="sand_block" type="Node3D" node_paths=PackedStringArray("_ray")]
|
||||
script = ExtResource("1_xuxw4")
|
||||
_ray = NodePath("RayCast3D")
|
||||
_compatible_tile = 2
|
||||
|
||||
[node name="highlights-sand" parent="." instance=ExtResource("2_pmjbb")]
|
||||
|
||||
[node name="RayCast3D" type="RayCast3D" parent="."]
|
@ -1,13 +0,0 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://b3jpnuj1suvcj"]
|
||||
|
||||
[ext_resource type="Script" path="res://buildings/building_block.cs" id="1_p3ylt"]
|
||||
[ext_resource type="PackedScene" uid="uid://ds0lxspxtnkcp" path="res://assets/meshes/highlights-water.glb" id="2_53d7w"]
|
||||
|
||||
[node name="water_block" type="Node3D" node_paths=PackedStringArray("_ray")]
|
||||
script = ExtResource("1_p3ylt")
|
||||
_ray = NodePath("RayCast3D")
|
||||
_compatible_tile = 3
|
||||
|
||||
[node name="highlights-water" parent="." instance=ExtResource("2_53d7w")]
|
||||
|
||||
[node name="RayCast3D" type="RayCast3D" parent="."]
|
@ -1,9 +1,9 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://cbs0x36e3ranm"]
|
||||
|
||||
[ext_resource type="MeshLibrary" uid="uid://bo7ir5us230sa" path="res://assets/tilesets/tileset.tres" id="1_l447d"]
|
||||
[ext_resource type="MeshLibrary" uid="uid://dwo1m72yajrb1" path="res://assets/tilesets/tileset.tres" id="1_l447d"]
|
||||
[ext_resource type="PackedScene" uid="uid://b5gb5paiupum" path="res://player/player.tscn" id="2_ojnju"]
|
||||
[ext_resource type="PackedScene" uid="uid://2pw0p13lcklv" path="res://buildings/kash_buildings/factory.tscn" id="3_08gdj"]
|
||||
[ext_resource type="AudioStream" uid="uid://bba7tiqty57ek" path="res://music/jazz.ogg" id="3_brvx4"]
|
||||
[ext_resource type="AudioStream" uid="uid://byo1w5vecks0m" path="res://music/jazz.ogg" id="3_brvx4"]
|
||||
[ext_resource type="PackedScene" uid="uid://c2casdi4d2o3j" path="res://shaders/water_plane.tscn" id="3_ga7wg"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_lo4sd"]
|
||||
|
243
player/player.cs
243
player/player.cs
@ -3,32 +3,31 @@ using System;
|
||||
|
||||
public partial class player : Camera3D
|
||||
{
|
||||
private const string _path = "/root/player/";
|
||||
private const string _path = "/root/player/";
|
||||
|
||||
[Export]
|
||||
private Label _con;
|
||||
[Export]
|
||||
private Label _mousePosLabel;
|
||||
[Export]
|
||||
private Label _cursorPosLabel;
|
||||
[Export]
|
||||
private RayCast3D _cursor;
|
||||
[Export]
|
||||
private Node3D _cursorPoint;
|
||||
private bool _mUp, _mDown, _mLeft, _mRight, _wIn, _wOut;
|
||||
|
||||
[Export]
|
||||
private Label _con;
|
||||
[Export]
|
||||
private Label _mousePosLabel;
|
||||
[Export]
|
||||
private Label _cursorPosLabel;
|
||||
[Export]
|
||||
private RayCast3D _cursor;
|
||||
[Export]
|
||||
private Node3D _cursorPoint;
|
||||
private bool _mUp, _mDown, _mLeft, _mRight, _wIn, _wOut;
|
||||
[Export]
|
||||
private PackedScene _test_building;
|
||||
|
||||
[Export]
|
||||
private PackedScene _test_building;
|
||||
[Export]
|
||||
private TextureProgressBar _nuke, _pr, _kash;
|
||||
|
||||
[Export]
|
||||
private TextureProgressBar _nuke, _pr, _kash;
|
||||
[Export]
|
||||
private Label _chatter;
|
||||
|
||||
[Export]
|
||||
private Label _chatter;
|
||||
|
||||
[Export]
|
||||
private AudioStreamPlayer _sndChtr, _sndBtn;
|
||||
[Export]
|
||||
private AudioStreamPlayer _sndChtr, _sndBtn;
|
||||
|
||||
[Export]
|
||||
private Timer _tmrChtr, _tmrCashGen;
|
||||
@ -49,107 +48,104 @@ public partial class player : Camera3D
|
||||
}
|
||||
}
|
||||
|
||||
public Node3D CurrentBuilding { get; set; }
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
//for debugging TODO: Remove
|
||||
game_manager.CurrentState = game_manager.State.Building;
|
||||
if (_test_building != null)
|
||||
{
|
||||
CurrentBuilding = _test_building.Instantiate<Node3D>();
|
||||
GD.Print(CurrentBuilding);
|
||||
public base_building CurrentBuilding { get; set; }
|
||||
|
||||
GetTree().Root.CallDeferred("add_child", CurrentBuilding);
|
||||
}
|
||||
_tmrChtr.Start();
|
||||
_tmrChtr.Timeout += () => Chatter = "";
|
||||
_tmrCashGen.Timeout += MakeMoney;
|
||||
}
|
||||
public override void _Ready()
|
||||
{
|
||||
//for debugging TODO: Remove
|
||||
game_manager.CurrentState = game_manager.State.Building;
|
||||
if (_test_building != null)
|
||||
{
|
||||
CurrentBuilding = _test_building.Instantiate<base_building>();
|
||||
GetTree().Root.CallDeferred("add_child", CurrentBuilding);
|
||||
}
|
||||
_tmrChtr.Start();
|
||||
_tmrChtr.Timeout += () => Chatter = "";
|
||||
_tmrCashGen.Timeout += MakeMoney;
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
Vector3 rot = this.Rotation;
|
||||
bool zin = true, zout = true;
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
Vector3 rot = this.Rotation;
|
||||
bool zin = true, zout = true;
|
||||
|
||||
if (Input.IsActionPressed("CamNorth"))
|
||||
_mUp = true;
|
||||
if (Input.IsActionPressed("CamSouth"))
|
||||
_mDown = true;
|
||||
if (Input.IsActionPressed("CamEast"))
|
||||
_mRight = true;
|
||||
if (Input.IsActionPressed("CamWest"))
|
||||
_mLeft = true;
|
||||
if (Input.IsActionPressed("CamNorth"))
|
||||
_mUp = true;
|
||||
if (Input.IsActionPressed("CamSouth"))
|
||||
_mDown = true;
|
||||
if (Input.IsActionPressed("CamEast"))
|
||||
_mRight = true;
|
||||
if (Input.IsActionPressed("CamWest"))
|
||||
_mLeft = true;
|
||||
|
||||
this.Rotation -= rot;
|
||||
if (this.Position.Y < 5)
|
||||
zin = false;
|
||||
else if (this.Position.Y > 45)
|
||||
zout = false;
|
||||
if (_mLeft && this.Position.X > -30)
|
||||
this.Translate(new Vector3((float)-delta * 10, 0, 0));
|
||||
if (_mRight && this.Position.X < 30)
|
||||
this.Translate(new Vector3((float)delta * 10, 0, 0));
|
||||
if (_mUp && this.Position.Z > -25)
|
||||
this.Translate(new Vector3(0, 0, (float)-delta * 10));
|
||||
if (_mDown && this.Position.Z < 25)
|
||||
this.Translate(new Vector3(0, 0, (float)delta * 10));
|
||||
this.Rotation += rot;
|
||||
this.Rotation -= rot;
|
||||
if (this.Position.Y < 5)
|
||||
zin = false;
|
||||
else if (this.Position.Y > 45)
|
||||
zout = false;
|
||||
if (_mLeft && this.Position.X > -30)
|
||||
this.Translate(new Vector3((float)-delta * 10, 0, 0));
|
||||
if (_mRight && this.Position.X < 30)
|
||||
this.Translate(new Vector3((float)delta * 10, 0, 0));
|
||||
if (_mUp && this.Position.Z > -25)
|
||||
this.Translate(new Vector3(0, 0, (float)-delta * 10));
|
||||
if (_mDown && this.Position.Z < 25)
|
||||
this.Translate(new Vector3(0, 0, (float)delta * 10));
|
||||
this.Rotation += rot;
|
||||
|
||||
if (_wIn && zin)
|
||||
this.Translate(new Vector3(0, 0, (float)-delta * 10));
|
||||
if (_wOut && zout)
|
||||
this.Translate(new Vector3(0, 0, (float)delta * 10));
|
||||
if (_wIn && zin)
|
||||
this.Translate(new Vector3(0, 0, (float)-delta * 10));
|
||||
if (_wOut && zout)
|
||||
this.Translate(new Vector3(0, 0, (float)delta * 10));
|
||||
|
||||
_con.Set("text", this.Position);
|
||||
_con.Set("text", this.Position);
|
||||
|
||||
|
||||
if (_cursor != null && _cursorPoint != null)
|
||||
{
|
||||
//Get the collision with map and change its X and Z value to always be in the center of a tile
|
||||
Vector3I collisionVector = (Vector3I)_cursor.GetCollisionPoint();
|
||||
_cursorPosLabel.Text = "Virtual Cursor Postion" + collisionVector.ToString();
|
||||
_cursorPoint.GlobalPosition = new Vector3(collisionVector.X - collisionVector.X % 2, 1.1f, collisionVector.Z - collisionVector.Z % 2);
|
||||
if (_cursor != null && _cursorPoint != null)
|
||||
{
|
||||
//Get the collision with map and change its X and Z value to always be in the center of a tile
|
||||
Vector3I collisionVector = (Vector3I)_cursor.GetCollisionPoint();
|
||||
_cursorPosLabel.Text = "Virtual Cursor Postion" + collisionVector.ToString();
|
||||
_cursorPoint.GlobalPosition = new Vector3(collisionVector.X - collisionVector.X % 2, 1.1f, collisionVector.Z - collisionVector.Z % 2);
|
||||
|
||||
if (game_manager.CurrentState == game_manager.State.Building)
|
||||
HandleBuilding();
|
||||
}
|
||||
}
|
||||
if (game_manager.CurrentState == game_manager.State.Building)
|
||||
HandleBuilding();
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
_mLeft = _mRight = _mUp = _mDown = _wIn = _wOut = false;
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
_mLeft = _mRight = _mUp = _mDown = _wIn = _wOut = false;
|
||||
|
||||
if (@event is InputEventMouseMotion mouse)
|
||||
{
|
||||
Vector2 vec = mouse.Position;
|
||||
if (vec.X < 5)
|
||||
_mLeft = true;
|
||||
else if (vec.X > 1915)
|
||||
_mRight = true;
|
||||
if (vec.Y < 20)
|
||||
_mUp = true;
|
||||
else if (vec.Y > 1060)
|
||||
_mDown = true;
|
||||
if (@event is InputEventMouseMotion mouse)
|
||||
{
|
||||
Vector2 vec = mouse.Position;
|
||||
if (vec.X < 5)
|
||||
_mLeft = true;
|
||||
else if (vec.X > 1915)
|
||||
_mRight = true;
|
||||
if (vec.Y < 20)
|
||||
_mUp = true;
|
||||
else if (vec.Y > 1060)
|
||||
_mDown = true;
|
||||
|
||||
|
||||
_mousePosLabel.Text = "Mouse position: " + vec.ToString();
|
||||
_mousePosLabel.Text = "Mouse position: " + vec.ToString();
|
||||
|
||||
_cursor.Position = new Vector3(
|
||||
(vec.X - GetViewport().GetVisibleRect().Size.X / 2) * this.Position.Y / 1000,
|
||||
-((vec.Y - GetViewport().GetVisibleRect().Size.Y / 2) * this.Position.Y / 1000)
|
||||
, 0
|
||||
);
|
||||
}
|
||||
else if (@event is InputEventMouseButton mousebtn)
|
||||
{
|
||||
if (mousebtn.ButtonIndex == MouseButton.WheelUp)
|
||||
_wIn = true;
|
||||
else if (mousebtn.ButtonIndex == MouseButton.WheelDown)
|
||||
_wOut = true;
|
||||
}
|
||||
|
||||
}
|
||||
_cursor.Position = new Vector3(
|
||||
(vec.X - GetViewport().GetVisibleRect().Size.X / 2) * this.Position.Y / 1000,
|
||||
-((vec.Y - GetViewport().GetVisibleRect().Size.Y / 2) * this.Position.Y / 1000)
|
||||
, 0
|
||||
);
|
||||
}
|
||||
else if (@event is InputEventMouseButton mousebtn)
|
||||
{
|
||||
if (mousebtn.ButtonIndex == MouseButton.WheelUp)
|
||||
_wIn = true;
|
||||
else if (mousebtn.ButtonIndex == MouseButton.WheelDown)
|
||||
_wOut = true;
|
||||
}
|
||||
|
||||
private void CheckGame() {
|
||||
bool gameover = false;
|
||||
@ -183,17 +179,26 @@ public partial class player : Camera3D
|
||||
CheckGame();
|
||||
}
|
||||
|
||||
public void HandleBuilding()
|
||||
{
|
||||
if (CurrentBuilding != null)
|
||||
{
|
||||
CurrentBuilding.GlobalPosition = _cursorPoint.GlobalPosition;
|
||||
|
||||
if (Input.IsActionJustPressed("build"))
|
||||
{
|
||||
Node3D tempBuilding = (Node3D)CurrentBuilding.Duplicate();
|
||||
GetTree().Root.CallDeferred("add_child", tempBuilding);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void HandleBuilding()
|
||||
{
|
||||
if (CurrentBuilding != null)
|
||||
{
|
||||
CurrentBuilding.GlobalPosition = _cursorPoint.GlobalPosition;
|
||||
|
||||
if (Input.IsActionJustPressed("rotate"))
|
||||
{
|
||||
CurrentBuilding.RotateY(Mathf.DegToRad(90));
|
||||
}
|
||||
|
||||
if (Input.IsActionJustPressed("build"))
|
||||
{
|
||||
if (CurrentBuilding.IsPlaceable)
|
||||
{
|
||||
base_building tempBuilding = (base_building)CurrentBuilding.Duplicate();
|
||||
GetTree().Root.CallDeferred("add_child", tempBuilding);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
[gd_scene load_steps=21 format=3 uid="uid://b5gb5paiupum"]
|
||||
[gd_scene load_steps=18 format=3 uid="uid://b5gb5paiupum"]
|
||||
|
||||
[ext_resource type="Script" path="res://player/player.cs" id="1_of2l4"]
|
||||
[ext_resource type="AudioStream" uid="uid://dye3nhm41yk6r" path="res://audio/chatter.wav" id="2_sa1qd"]
|
||||
[ext_resource type="AudioStream" uid="uid://c8dcqkmytnyay" path="res://audio/btn.wav" id="3_00x5l"]
|
||||
|
||||
[sub_resource type="CameraAttributesPhysical" id="CameraAttributesPhysical_1ejpb"]
|
||||
frustum_near = 0.032
|
||||
@ -69,6 +67,7 @@ height = 255
|
||||
font_size = 28
|
||||
|
||||
[node name="player" type="Camera3D" node_paths=PackedStringArray("_con", "_mousePosLabel", "_cursorPosLabel", "_cursor", "_cursorPoint", "_nuke", "_pr", "_kash", "_chatter", "_sndChtr", "_sndBtn", "_tmrChtr", "_tmrCashGen")]
|
||||
|
||||
attributes = SubResource("CameraAttributesPhysical_1ejpb")
|
||||
script = ExtResource("1_of2l4")
|
||||
_con = NodePath("Debug info/Label")
|
||||
@ -86,7 +85,6 @@ _tmrChtr = NodePath("tmr_Chatter")
|
||||
_tmrCashGen = NodePath("tmr_kash")
|
||||
|
||||
[node name="Debug info" type="Control" parent="."]
|
||||
visible = false
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
@ -226,3 +224,4 @@ one_shot = true
|
||||
|
||||
[node name="tmr_kash" type="Timer" parent="."]
|
||||
autostart = true
|
||||
|
||||
|
@ -15,12 +15,6 @@ run/main_scene="res://menu/start_game_menu.tscn"
|
||||
config/features=PackedStringArray("4.0", "C#", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=1920
|
||||
window/size/viewport_height=1080
|
||||
window/size/mode=3
|
||||
|
||||
[dotnet]
|
||||
|
||||
project/assembly_name="Mad"
|
||||
@ -57,6 +51,12 @@ build={
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":66,"key_label":0,"unicode":98,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
rotate={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":114,"echo":false,"script":null)
|
||||
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"pressed":false,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
|
@ -9,7 +9,7 @@ uniform sampler2D texture_normal2;
|
||||
uniform sampler2D texture_image;
|
||||
uniform vec2 wave_direction = vec2(2.0,0.0);
|
||||
uniform vec2 wave_direction2 = vec2(0.0,1.0);
|
||||
uniform float time_scale : hint_range(0.0, 0.2, 0.005) = 0.005;
|
||||
uniform float time_scale : hint_range(0.0, 0.2, 0.005) = 0.0;
|
||||
|
||||
float fresnel(float amount, vec3 normal, vec3 view){
|
||||
return pow((1.0 - clamp(dot(normalize(normal), normalize(view)),0.0,1.0)),amount);
|
||||
|
@ -38,7 +38,7 @@ shader_parameter/metallic = 0.0
|
||||
shader_parameter/roughness = 0.02
|
||||
shader_parameter/wave_direction = Vector2(2, 0)
|
||||
shader_parameter/wave_direction2 = Vector2(0, 1)
|
||||
shader_parameter/time_scale = 0.025
|
||||
shader_parameter/time_scale = 0.005
|
||||
shader_parameter/texture_normal = SubResource("NoiseTexture2D_ntr7e")
|
||||
shader_parameter/texture_normal2 = SubResource("NoiseTexture2D_wvpl0")
|
||||
shader_parameter/texture_image = ExtResource("2_83coh")
|
||||
|
Loading…
Reference in New Issue
Block a user