static public Factory_UFO getInstance() { if (_instance == null) { _instance = new Factory_UFO(); } return(_instance as Factory_UFO); }
public static Action getAction(int score, float _speed) { ThrowUFO action = ScriptableObject.CreateInstance <ThrowUFO>(); action.factory = Factory_UFO.getInstance(); action.ufo = action.factory.getProduct(); action.speed = _speed; action.ufo.Score = score; action.ufo.canHit = true; action.gameobject = action.ufo.gameobject; return(action); }
void OnCollisionEnter(Collision collision) { if (collision.gameObject.CompareTag("UFO") == true) { int id = collision.gameObject.GetInstanceID(); UFO ufo = Factory_UFO.getInstance().getProduct(id); if (ufo.canHit) { Scorer.getInstance().addScore(ufo.Score); } } }