public void make_starseed(int start, Vector3 startLocation, int end, Vector3 endLocation, float speed, bool isred = false) { GameObject starseed = isred? RezFind("spamseed_icon"): RezFind("starseed_icon"); if (GameDad.get_particle_system_scale != null) { float scale = GameDad.get_particle_system_scale(); starseed.transform.localScale *= scale; speed *= Mathf.Sqrt(scale); } Action whenhit = delegate() { if (!isred) { // a green starseed has hit a star // check if the hooks we need even exist if (GameDad.is_green == null || GameDad.get_green == null) { return; } // if the destination star is bare, then: // 1. call give_chance_to_make_red_star // 2. if this is false, then make it green if (!GameDad.is_green(end)) { bool stop = false; if (GameDad.give_chance_to_make_red_star != null) { stop = GameDad.give_chance_to_make_red_star(start, startLocation, end, endLocation); } if (GameDad.is_green(end)) { stop = true; } if (!stop) { GameDad.add_green(end, null); if (GameDad.update_best != null) { GameDad.update_best(); } } } else if (GameDad.get_green(end).type == greenstar.Type.Red) // test // a green starseed has hit a red star. // send a red starseed back { if (GameDad.send_red_hook != null) { GameDad.send_red_hook(end, start); } } /* * var star = new greenstar(); * star.isred = true; * GameDad.add_green(end, star); */ } else { // a red starseed has hit a star if (GameDad.spamseed_lands_on_star != null) { GameDad.spamseed_lands_on_star(end, endLocation - startLocation); // test if (GameDad.update_best != null) { GameDad.update_best(); } } } }; starseeds[id++] = new starseed_owner(startLocation, endLocation, speed, starseed, whenhit, isred); }