void Start() { fade = GetComponent <FadeAway>(); body = GetComponent <Rigidbody2D>(); netLayerMask = LayerMask.NameToLayer("Net"); stickLayerMask = LayerMask.NameToLayer("Stick"); }
public void ShutDown() { target = null; if (this.gameObject.activeInHierarchy) { fadeAway = new FadeAway(); fadeAway.Init(this.gameObject, .2f, Dispose); } }
// Use this for initialization void Start() { imageCounter = 0; rotationCounter = 0; maxRotation = 180; textures = FindObjectOfType <SwapTexture> (); fade = FindObjectOfType <FadeAway> (); }
GameObject CreatePart(Vector3 center, Vector3 size, float mass) { // add cube GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube); cube.layer = gameObject.layer; cube.name = "Blockify block"; cube.transform.localPosition = center; cube.EachRenderer(renderer => renderer.material = material); // add box collider BoxCollider box = cube.GetComponent <BoxCollider>(); box.center = Vector3.zero; box.size = Vector3.one; cube.transform.localScale = size; // add rigidbody Rigidbody parentRb = gameObject.GetComponent <Rigidbody>(); Rigidbody rb = cube.AddComponent <Rigidbody>(); rb.mass = mass; rb.drag = parentRb.drag; rb.angularDrag = parentRb.angularDrag; rb.velocity = parentRb.velocity; rb.angularVelocity = parentRb.angularVelocity; rb.useGravity = true; //Rigidbody test = part.GetComponent<Rigidbody>(); //Debug.Log(test); FadeAway w = cube.AddComponent <FadeAway>(); w.SetFadePeriod(5f); /* * BrightFadeInGeneric fadein = cube.AddComponent<BrightFadeInGeneric>(); * fadein.period = 2f; * fadein.startColor = Color.yellow; * fadein.OnEnable(); */ return(cube); }
private void ResetBlock() { while (fadeAways.Count > 0) { FadeAway fadeAway = fadeAways[0]; fadeAway.Cancel(); fadeAways.RemoveAt(0); } while (fadeIns.Count > 0) { FadeIn fadeIn = fadeIns[0]; fadeIn.Cancel(); fadeIns.RemoveAt(0); } fadeAways.Clear(); fadeIns.Clear(); up_left.GetComponent <SpriteRenderer> ().color = defaultColor; up_right.GetComponent <SpriteRenderer> ().color = defaultColor; up_down.GetComponent <SpriteRenderer> ().color = defaultColor; down_left.GetComponent <SpriteRenderer> ().color = defaultColor; down_right.GetComponent <SpriteRenderer> ().color = defaultColor; down_up.GetComponent <SpriteRenderer> ().color = defaultColor; }
public void ShutDown() { fadeAway = new FadeAway(); fadeAway.Init(this.gameObject, .2f, Dispose); }
private void OnUiLoaded() { playerStatus = GameObject.FindGameObjectWithTag(Tags.PlayerStatus).GetComponent<Text>(); instructionsLabel = GameObject.FindGameObjectWithTag(Tags.InstructionsLabel).GetComponent<Text>(); fadeAwayComponent = instructionsLabel.GetComponent<FadeAway>(); }