/// <summary> /// Activates this instance. /// Calling this on a already fired projectile does nothing. /// Calling this on a projectile marked for deactivation will unmark the projectile and keep it from deactivating. /// </summary> public void Activate() { to_deactivate = false; runtime.Add(this); if (!is_active && OnActivate != null) { OnActivate(this); } is_active = true; frames = 0; time = 0f; }
public void MatchPrefab(DanmakuPrefab prefab) { if (prefab == null) { Debug.LogError("Tried to match a null prefab"); return; } if (this.prefab != prefab) { this.prefab = prefab; if (is_active) { runtime.Remove(this); runtime = prefab.GetRuntime(); runtime.Add(this); } else { runtime = prefab.GetRuntime(); } Vector2 scale = runtime.cachedScale; colliderType = runtime.collisionType; switch (colliderType) { default: case ColliderType.Point: colliderSize = Vector2.zero; sizeSquared = 0; break; case ColliderType.Circle: colliderSize = runtime.colliderSize * scale.Max(); break; case ColliderType.Line: colliderSize = runtime.colliderSize; break; } sizeSquared = colliderSize.y * colliderSize.y; colliderOffset = scale.Hadamard2(runtime.colliderOffset); } Tag = runtime.cachedTag; Color = runtime.Color; Scale = 1f; layer = runtime.cachedLayer; colliderMask = collisionMask [layer]; AddController(runtime.ExtraControllers); }