-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38042a1
commit 9debd37
Showing
8 changed files
with
110 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ public interface IJobListener : IEmitterListener | |
{ | ||
void Schedule(World world); | ||
|
||
|
||
void Progress(World world); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class IndicatorBar : MonoBehaviour { | ||
|
||
public delegate float GetSize(); | ||
public GetSize GetSizeCallback; | ||
|
||
MeshRenderer meshRenderer; | ||
Mesh mesh; | ||
private float zLevel = -0.01f; | ||
|
||
static public IndicatorBar Instantiate(GameObject parent) | ||
{ | ||
GameObject go = new GameObject(); | ||
go.transform.SetParent(parent.transform); | ||
|
||
go.name = "indicator_bar"; | ||
|
||
IndicatorBar jobComponent = go.AddComponent<IndicatorBar>(); | ||
|
||
return jobComponent; | ||
} | ||
|
||
// Use this for initialization | ||
void Start () { | ||
gameObject.AddComponent<MeshFilter>(); | ||
meshRenderer = gameObject.AddComponent<MeshRenderer>(); | ||
|
||
|
||
mesh = new Mesh(); | ||
GetComponent<MeshFilter>().mesh = mesh; | ||
|
||
mesh.vertices = new Vector3[] { | ||
new Vector3(0,0,zLevel), | ||
new Vector3(1,0,zLevel), | ||
new Vector3(0,1,zLevel), | ||
new Vector3(1,1,zLevel) | ||
}; | ||
mesh.uv = new Vector2[] { | ||
new Vector2(0,0), | ||
new Vector2(1,0), | ||
new Vector2(0,1), | ||
new Vector2(1,1) | ||
}; | ||
mesh.triangles = new int[] { 0, 2, 1, 1, 2, 3 }; | ||
|
||
gameObject.transform.localPosition += new Vector3(-0.6f, -0.5f, 0); | ||
gameObject.transform.localScale = new Vector3(0.1f, 1, 1); | ||
} | ||
|
||
// Update is called once per frame | ||
void Update () { | ||
if(GetSizeCallback != null) | ||
{ | ||
gameObject.transform.localScale = new Vector3(0.1f, GetSizeCallback(), 1); | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Assets/Unity/Components/Subcomponents/IndicatorBar.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters