Skip to content

Commit a580582

Browse files
committed
feat: Finished the entity skeleton + editor
Finished the complete skeleton for the entity class, created the inspector gui for it and a cooldowncontroller
1 parent 02948d4 commit a580582

34 files changed

+2372
-4
lines changed

Editor/EngineCreatorEditor.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,41 @@ public class EngineCreatorEditor : EditorWindow
1111
private static void ShowWindow() {
1212
var window = GetWindow<EngineCreatorEditor>();
1313
window.titleContent = new GUIContent("Create Engine");
14-
window.maxSize = new Vector2(400,80);
14+
window.maxSize = new Vector2(400,180);
1515
window.Show();
16-
window.minSize = new Vector2(400,80);
16+
window.minSize = new Vector2(400,180);
1717
}
1818

1919
void OnGUI()
2020
{
21+
//Packages/com.bigasdev.bigastools/Res/logoaseprite400.png
22+
Texture banner = (Texture)AssetDatabase.LoadAssetAtPath("Packages/com.bigasdev.bigastools/Res/logoaseprite400.png", typeof(Texture));
23+
var style = new GUIStyle(GUI.skin.label) {alignment = TextAnchor.MiddleCenter};
24+
GUILayout.Box(banner, style);
2125
EditorGUILayout.LabelField("Welcome to Bigas Tools! With this Editor view you can launch the 'Engine' GameObject in the current scene, this object will contain everything necessary to run with the package.", EditorStyles.wordWrappedLabel);
2226
if (GUILayout.Button("Create Engine")) {
2327
var g = new GameObject();
2428
var audioController = new GameObject();
2529
var resourceController = new GameObject();
30+
var cooldownController = new GameObject();
2631
var stateController = new GameObject();
2732
var bGameInput = new GameObject();
2833
audioController.transform.SetParent(g.transform);
2934
resourceController.transform.SetParent(g.transform);
3035
stateController.transform.SetParent(g.transform);
36+
cooldownController.transform.SetParent(g.transform);
3137
bGameInput.transform.SetParent(g.transform);
3238

3339
g.name = "Engine";
3440
audioController.name = "Audio Controller";
3541
resourceController.name = "Resource Controller";
42+
cooldownController.name = "Cooldown Controller";
3643
stateController.name = "State Controller";
3744
bGameInput.name = "Input";
3845

3946
audioController.AddComponent<AudioController>();
4047
resourceController.AddComponent<ResourceController>();
48+
cooldownController.AddComponent<CooldownController>();
4149
stateController.AddComponent<StateController>();
4250
bGameInput.AddComponent<BGameInput>();
4351
this.Close();

Editor/EntityInspector.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
using UnityEngine.UIElements;
4+
using UnityEditor.UIElements;
5+
using BigasTools;
6+
7+
[CustomEditor(typeof(Entity))]
8+
public class EntityInspector : Editor
9+
{
10+
Entity myEntity;
11+
12+
public override void OnInspectorGUI()
13+
{
14+
myEntity = (Entity)target;
15+
//Packages/com.bigasdev.bigastools/Res/logoaseprite400.png
16+
Texture banner = (Texture)AssetDatabase.LoadAssetAtPath("Packages/com.bigasdev.bigastools/Res/logoaseprite400.png", typeof(Texture));
17+
var style = new GUIStyle(GUI.skin.label) {alignment = TextAnchor.MiddleCenter};
18+
19+
//Packages/com.bigasdev.bigastools/Materials/SpriteBlankMaterial.mat
20+
Material material = (Material)AssetDatabase.LoadAssetAtPath("Packages/com.bigasdev.bigastools/Materials/SpriteBlankMaterial.mat", typeof(Material));
21+
22+
if(myEntity.blinkMaterial == null)myEntity.blinkMaterial = material;
23+
24+
GUILayout.Box(banner, style);
25+
if(GUILayout.Button("Check runtime stats")){
26+
27+
}
28+
if(GUILayout.Button("Load default stats")){
29+
myEntity.moveSpeedVariable = 4;
30+
myEntity.life = 100;
31+
myEntity.maxLife = 100;
32+
myEntity.spriteSquashSpeed = 4.5f;
33+
}
34+
BuildEverything();
35+
}
36+
void BuildEverything(){
37+
serializedObject.Update();
38+
var life = serializedObject.FindProperty("lifeVariable");
39+
var maxLife = serializedObject.FindProperty("maxLifeVariable");
40+
var squashSpeed = serializedObject.FindProperty("spriteSquashSpeed");
41+
EditorGUILayout.PropertyField(serializedObject.FindProperty("moveSpeedVariable"), new GUIContent("Move Speed", (Texture)AssetDatabase.LoadAssetAtPath("Packages/com.bigasdev.bigastools/Res/bootsIcon.png", typeof(Texture)),"Change the speed of the entity"));
42+
EditorGUILayout.PropertyField(life, new GUIContent("Life", (Texture)AssetDatabase.LoadAssetAtPath("Packages/com.bigasdev.bigastools/Res/heartIcon.png", typeof(Texture)),"Change the current health of the entity"));
43+
EditorGUILayout.PropertyField(maxLife, new GUIContent("Max Life", (Texture)AssetDatabase.LoadAssetAtPath("Packages/com.bigasdev.bigastools/Res/heartIcon.png", typeof(Texture)),"Change the max health of the entity"));
44+
EditorGUILayout.PropertyField(squashSpeed, new GUIContent("Squash Speed", (Texture)AssetDatabase.LoadAssetAtPath("Packages/com.bigasdev.bigastools/Res/blobsicon.png", typeof(Texture)),"Change the sprite squash speed of the entity"));
45+
//myEntity.moveSpeedVariable = EditorGUILayout.FloatField("Move Speed", myEntity.moveSpeedVariable);
46+
serializedObject.ApplyModifiedProperties();
47+
}
48+
}

Editor/EntityInspector.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/EntityInspector.uss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Label {
2+
font-size: 20px;
3+
-unity-font-style: bold;
4+
color: rgb(68, 138, 255);
5+
}

Editor/EntityInspector.uss.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Materials.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Materials/SpriteBlankMaterial.mat

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!21 &2100000
4+
Material:
5+
serializedVersion: 6
6+
m_ObjectHideFlags: 0
7+
m_CorrespondingSourceObject: {fileID: 0}
8+
m_PrefabInstance: {fileID: 0}
9+
m_PrefabAsset: {fileID: 0}
10+
m_Name: SpriteBlankMaterial
11+
m_Shader: {fileID: 10101, guid: 0000000000000000e000000000000000, type: 0}
12+
m_ShaderKeywords:
13+
m_LightmapFlags: 4
14+
m_EnableInstancingVariants: 0
15+
m_DoubleSidedGI: 0
16+
m_CustomRenderQueue: -1
17+
stringTagMap: {}
18+
disabledShaderPasses: []
19+
m_SavedProperties:
20+
serializedVersion: 3
21+
m_TexEnvs:
22+
- _AlphaTex:
23+
m_Texture: {fileID: 0}
24+
m_Scale: {x: 1, y: 1}
25+
m_Offset: {x: 0, y: 0}
26+
- _BumpMap:
27+
m_Texture: {fileID: 0}
28+
m_Scale: {x: 1, y: 1}
29+
m_Offset: {x: 0, y: 0}
30+
- _DetailAlbedoMap:
31+
m_Texture: {fileID: 0}
32+
m_Scale: {x: 1, y: 1}
33+
m_Offset: {x: 0, y: 0}
34+
- _DetailMask:
35+
m_Texture: {fileID: 0}
36+
m_Scale: {x: 1, y: 1}
37+
m_Offset: {x: 0, y: 0}
38+
- _DetailNormalMap:
39+
m_Texture: {fileID: 0}
40+
m_Scale: {x: 1, y: 1}
41+
m_Offset: {x: 0, y: 0}
42+
- _EmissionMap:
43+
m_Texture: {fileID: 0}
44+
m_Scale: {x: 1, y: 1}
45+
m_Offset: {x: 0, y: 0}
46+
- _MainTex:
47+
m_Texture: {fileID: 0}
48+
m_Scale: {x: 1, y: 1}
49+
m_Offset: {x: 0, y: 0}
50+
- _MetallicGlossMap:
51+
m_Texture: {fileID: 0}
52+
m_Scale: {x: 1, y: 1}
53+
m_Offset: {x: 0, y: 0}
54+
- _OcclusionMap:
55+
m_Texture: {fileID: 0}
56+
m_Scale: {x: 1, y: 1}
57+
m_Offset: {x: 0, y: 0}
58+
- _ParallaxMap:
59+
m_Texture: {fileID: 0}
60+
m_Scale: {x: 1, y: 1}
61+
m_Offset: {x: 0, y: 0}
62+
m_Floats:
63+
- PixelSnap: 0
64+
- _BumpScale: 1
65+
- _Cutoff: 0.5
66+
- _DetailNormalMapScale: 1
67+
- _DstBlend: 0
68+
- _EnableExternalAlpha: 0
69+
- _GlossMapScale: 1
70+
- _Glossiness: 0.5
71+
- _GlossyReflections: 1
72+
- _Metallic: 0
73+
- _Mode: 0
74+
- _OcclusionStrength: 1
75+
- _Parallax: 0.02
76+
- _SmoothnessTextureChannel: 0
77+
- _SpecularHighlights: 1
78+
- _SrcBlend: 1
79+
- _UVSec: 0
80+
- _ZWrite: 1
81+
m_Colors:
82+
- _Color: {r: 1, g: 1, b: 1, a: 1}
83+
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
84+
- _Flip: {r: 1, g: 1, b: 1, a: 1}
85+
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
86+
m_BuildTextureStacks: []

Materials/SpriteBlankMaterial.mat.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Res.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Res/blobsicon.png

183 Bytes
Loading

0 commit comments

Comments
 (0)