Open-sourced some code

This commit is contained in:
2019-03-08 09:54:14 +11:00
commit 645272872c
142 changed files with 3028 additions and 0 deletions
@@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Structures {
public class HazardController : MonoBehaviour {
//internals
int DamageValue { get; set; }
DamagerController damagerController;
void Awake() {
DamageValue = 1;
}
void Start() {
damagerController = GetComponent<DamagerController>();
damagerController.PushOnTriggerStay((Collider2D collider) => {
if (collider.gameObject.tag == "Player") {
//deal damage to the player
collider.gameObject.GetComponent<PlayerController>().HealthValue -= DamageValue;
//NOTE: not every damager will deal damage
}
});
}
}
}