public override void ChangeParameter() { WCC = GetComponent <WaterCannonController>(); BVC = GetComponent <BlockVisualController>(); FT = GetComponent <FireTag>(); if (!EnhancementEnabled) { Boiling = orginBoiling; } }
public override void OnSimulateStartAlways() { if (EnhancementEnabled) { WCC = GetComponent <WaterCannonController>(); BVC = GetComponent <BlockVisualController>(); FT = GetComponent <FireTag>(); SpeedSlider = WCC.StrengthSlider; //if (!EnhancementEnabled) { Boiling = orginBoiling; } } }
private void BlockSelect(BlockBehaviour block) { if (block != null) { if (block != AddPiece.SelectedBlock) { BlockVisualController componentInParent = null; if (AddPiece.SelectedBlock != null) { componentInParent = AddPiece.SelectedBlock.GetComponentInParent <BlockVisualController>(); if (componentInParent != null) { componentInParent.SetNormal(); } } componentInParent = block.GetComponentInParent <BlockVisualController>(); if (componentInParent != null) { componentInParent.SetSelected(); } AddPiece.SelectedBlock = (GenericBlock)block; } } }
public static MirrorBlock MakeFakeBlock(BlockVisualController bvc, Transform parent, bool colliders = false) { if (bvc.gameObject.layer == 27) { return(null); } bool b = false; Renderer r; GameObject go = new GameObject(bvc.Block.name + " holder"); go.transform.position = bvc.transform.position; go.transform.rotation = bvc.transform.rotation; go.transform.localScale = bvc.transform.lossyScale; go.transform.parent = parent; bool setToInvisible = false; if (!bvc.isVisible) { setToInvisible = true; bvc.SetVisible(); } Collider[] cols = new Collider[0]; List <MeshRenderer> rens = new List <MeshRenderer>(); List <MeshRenderer> brokens = new List <MeshRenderer>(); foreach (Renderer rend in bvc.renderers) { if (rend == null || !rend.enabled) { continue; } b = true; rens.Add(DisplayFake(rend, go.transform)); } r = bvc.shortVisRen; bool hasBroken = false; if (!b && r != null && r.enabled) { rens.Add(DisplayFake(r, go.transform)); } else if (bvc.hasFragment) { foreach (FilterRendererPair pair in bvc.Fragment.brokenVis) { MeshRenderer rend = pair.renderer; if (rend == null || !rend.enabled) { continue; } hasBroken = true; brokens.Add(DisplayFake(rend, go.transform)); } } ParticleSystem[] sourceParticles = bvc.GetComponentsInChildren <ParticleSystem>(); ParticleSystem[] particles = new ParticleSystem[sourceParticles.Length]; for (int i = 0; i < sourceParticles.Length; i++) { particles[i] = GameObject.Instantiate(sourceParticles[i]) as ParticleSystem; particles[i].transform.parent = go.transform; } if (Portal.SimulatePhysics() && colliders) { cols = MakeColliders(bvc.Block, go.transform); } if (Portal.mirroredBodies) { Rigidbody body = go.AddComponent <Rigidbody>(); body.isKinematic = true; body.useGravity = false; } MirrorBlock m = go.AddComponent <MirrorBlock>(); m.Setup(bvc.Block, rens.ToArray(), cols, particles, sourceParticles, brokens.ToArray(), hasBroken); if (setToInvisible) { bvc.SetInvisible(); } return(m); //what about visAddedToMe }