Skip to content

Instantly share code, notes, and snippets.

@kazumalab
Created March 30, 2017 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazumalab/17cae7249be801ffb82b10557cf7f188 to your computer and use it in GitHub Desktop.
Save kazumalab/17cae7249be801ffb82b10557cf7f188 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Notice : MonoBehaviour {
public Sprite warning; // default
public Sprite discovery;
private SpriteRenderer spRender;
private void Awake () {
spRender = GetComponent<SpriteRenderer> ();
Init ();
}
private void Init () {
spRender.enabled = true;
spRender.sprite = warning;
}
// Use this for initialization
public void Created (Enemy.Status st) {
if (st == Enemy.Status.Discovery)
spRender.sprite = discovery;
Destroy (gameObject, 3f);
}
public void ChangeStatus (Enemy.Status st) {
if (st == Enemy.Status.Discovery) {
spRender.sprite = discovery;
} else {
spRender.sprite = warning;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment