示例#1
0
 static public Factory_UFO getInstance()
 {
     if (_instance == null)
     {
         _instance = new Factory_UFO();
     }
     return(_instance as Factory_UFO);
 }
示例#2
0
    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);
    }
示例#3
0
 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);
         }
     }
 }