Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions UnityClient/.vsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Workload.ManagedGame"
]
}
21 changes: 21 additions & 0 deletions UnityClient/Assets/_DEV/Feature-Sample/CameraFacingBillboard.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraFacingBillboard : MonoBehaviour
{
private void Update()
{
Camera cam = Camera.main;

if (cam != null)
{
transform.LookAt(transform.position + cam.transform.rotation * Vector3.forward,
cam.transform.rotation * Vector3.up);
}
else
{
Debug.LogError("Main camera is NULL!");
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 72 additions & 0 deletions UnityClient/Assets/_DEV/Feature-Sample/Enemy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Enemy : MonoBehaviour
{
public int maxHealth = 1000;
public int currentHealth = 0;

public bool isAlive = true;
public bool resetHealthOnDeath = true;

public float healthResetDelay = 0.2f;

[SerializeField]
private RectTransform healthFill;

private Color defaultColor;
private Renderer renderer;

public float GetHealthPercentage()
{
return (float)currentHealth / maxHealth;
}

public void ResetHealth()
{
isAlive = true;
currentHealth = maxHealth;
}

public void ResetColor()
{
renderer.material.color = defaultColor;
}

public void ChangeColor(Color color, float resetDelay)
{
renderer.material.color = color;
Invoke("ResetColor", resetDelay);
}

public void TakeDamage(int value)
{
if (currentHealth > 0)
{
currentHealth -= value;
healthFill.localScale = new Vector3(GetHealthPercentage(), 1f, 1f);
}
else
{
isAlive = false;

if(resetHealthOnDeath)
Invoke("ResetHealth", healthResetDelay);
}
}
// Start is called before the first frame update
void Start()
{
renderer = GetComponent<Renderer>();
defaultColor = renderer.material.color;

ResetHealth();
}

// Update is called once per frame
void Update()
{

}
}
11 changes: 11 additions & 0 deletions UnityClient/Assets/_DEV/Feature-Sample/Enemy.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading