GlobalGameJame/Assets/Scripts/BlockManager.cs

46 lines
1.1 KiB
C#
Raw Normal View History

2020-01-31 20:47:30 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BlockManager : MonoBehaviour
{
2020-02-01 11:11:56 +00:00
public enum BlockType {None, Barricade, Door, Wood, Ammo};
2020-01-31 20:47:30 +00:00
public BlockType blockType = BlockType.None;
2020-01-31 21:32:05 +00:00
public float health = 100;
2020-02-01 11:11:56 +00:00
private Animator animator;
private bool action = false;
2020-01-31 20:47:30 +00:00
// Start is called before the first frame update
void Start()
{
2020-02-01 11:11:56 +00:00
if (blockType == BlockType.Door)
{
animator = this.GetComponent<Animator>();
}
2020-01-31 20:47:30 +00:00
}
// Update is called once per frame
void Update()
{
2020-02-01 11:11:56 +00:00
}
public void Action()
{
if (blockType == BlockType.Door)
{
if (!action)
{
this.GetComponent<BoxCollider>().isTrigger = true;
action = true;
}
else
{
this.GetComponent<BoxCollider>().isTrigger = false;
action = false;
}
animator.ResetTrigger("Door");
animator.SetTrigger("Door");
}
2020-01-31 20:47:30 +00:00
}
}