public override void PostBeamRender(tk2dTiledSprite beam) { Material material = beam.GetComponent <Renderer>().material; material.SetFloat("_BlackBullet", 0.995f); material.SetFloat("_EmissiveColorPower", 4.9f); }
void PrepareRound() { MaxY = Camera.main.orthographicSize; MaxX = Camera.main.aspect * MaxY; // Clear all existing balloons var children = GetComponentsInChildren <Transform>(); foreach (Transform c in children) { if (c != transform) { DestroyObject(c.gameObject); } } if (SixthsGameState.PlayRound) { // Create goal balloons z = 0; for (int i = 0; i < SixthsGameState.CurrentGoals; i++) { CreateRandomBalloon(TargetBalloon); } // Create penalty balloons for (int i = 0; i < SixthsGameState.Noise; i++) { CreateRandomBalloon(PenaltyBalloon); } Cover.GetComponent <Renderer>().enabled = false; TransitionOut.Play(); } else { Cover.GetComponent <Renderer>().enabled = true; TransitionIn.Play(); } SixthsGameState.Timer = 10; }
public override void OnInspectorGUI() { tk2dTiledSprite sprite = (tk2dTiledSprite)target; base.OnInspectorGUI(); if (sprite.Collection == null) { return; } EditorGUILayout.BeginVertical(); var spriteData = sprite.GetCurrentSpriteDef(); // need raw extents (excluding scale) Vector3 extents = spriteData.boundsData[1]; bool newCreateBoxCollider = EditorGUILayout.Toggle("Create Box Collider", sprite.CreateBoxCollider); if (newCreateBoxCollider != sprite.CreateBoxCollider) { Undo.RegisterUndo(targetTiledSprites, "Create Box Collider"); sprite.CreateBoxCollider = newCreateBoxCollider; } // if either of these are zero, the division to rescale to pixels will result in a // div0, so display the data in fractions to avoid this situation bool editBorderInFractions = true; if (spriteData.texelSize.x != 0.0f && spriteData.texelSize.y != 0.0f && extents.x != 0.0f && extents.y != 0.0f) { editBorderInFractions = false; } if (!editBorderInFractions) { Vector2 newDimensions = EditorGUILayout.Vector2Field("Dimensions (Pixel Units)", sprite.dimensions); if (newDimensions != sprite.dimensions) { Undo.RegisterUndo(targetTiledSprites, "Tiled Sprite Dimensions"); foreach (tk2dTiledSprite spr in targetTiledSprites) { spr.dimensions = newDimensions; } } tk2dTiledSprite.Anchor newAnchor = (tk2dTiledSprite.Anchor)EditorGUILayout.EnumPopup("Anchor", sprite.anchor); if (newAnchor != sprite.anchor) { Undo.RegisterUndo(targetTiledSprites, "Tiled Sprite Anchor"); foreach (tk2dTiledSprite spr in targetTiledSprites) { spr.anchor = newAnchor; } } } else { GUILayout.Label("Border (Displayed as Fraction).\nSprite Collection needs to be rebuilt.", "textarea"); } Mesh mesh = sprite.GetComponent <MeshFilter>().sharedMesh; if (mesh != null) { GUILayout.Label(string.Format("Triangles: {0}", mesh.triangles.Length / 3)); } // One of the border valus has changed, so simply rebuild mesh data here if (GUI.changed) { foreach (tk2dTiledSprite spr in targetTiledSprites) { spr.Build(); EditorUtility.SetDirty(spr); } } EditorGUILayout.EndVertical(); }