Skip to content

Instantly share code, notes, and snippets.

@11
Created July 27, 2018 14:41
Show Gist options
  • Save 11/978bfbd5094ef69a8628b1fee2de91c0 to your computer and use it in GitHub Desktop.
Save 11/978bfbd5094ef69a8628b1fee2de91c0 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ExampleState : IState {
private AudioSource sound;
private AudioClip shootSound;
private GameObject object;
public void Init(){
sound = GetComponent<AudioSource>();
gb = new GameObject();
}
public void Update(){
// update logic
if(gb.position.x > 10){
source.PlayOneShot(shootSound, 5);
}
}
public void Render(){
// render game object
gb.render()
}
public void Dispose(){
// When we're doing, we can just throw away this game object
gb.remove();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment