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; } } }
public Target(Collider collider) { this.collider = collider; if (Enable) { this.transform = collider.transform; this.rigidbody = collider.GetComponentInAll <Rigidbody>(); block = collider.GetComponentInAll <BlockBehaviour>(); entity = collider.GetComponentInAll <GenericEntity>(); fireTag = collider.GetComponentInAll <FireTag>(); rocket = collider.GetComponentInAll <TimedRocket>(); bomb = collider.GetComponentInAll <ExplodeOnCollideBlock>(); joint = collider.GetComponentInAll <Joint>(); RefreshWarningValue(); } }
protected virtual void AddFire() { fireTag = gameObject.AddComponent <FireTag>(); fireTag.basicInfo = GetComponent <BasicInfo>(); fireTag.bvc = GetComponent <BlockVisualController>(); fireTag.HasBasicInfo = true; fireTag.hasBvc = true; fireTag.block = fireTag.basicInfo as BlockBehaviour; fireTag.block.fireTag = fireTag; VisualController.canBeHeated = true; VisualController.heating.colToSet = "_EmissCol"; VisualController.heating.lerpSpeed = 2f; VisualController.heating.glowCol = new Color(1f, 0.263f, 0f); MeshRenderer canonVis = PrefabMaster.Instance.transform.FindChild("BLOCKS/Prefabs/Cannon/Vis").GetComponent <MeshRenderer>(); VisualController.renderers[0].material.SetTexture("_EmissMap", canonVis.material.GetTexture("_EmissMap")); }
protected void Ignite(RHInfo rH) { FireTag FT = rH.transform.GetComponentInChildren <FireTag>(); if (FT) // ignite { FT.Ignite(); } ///Just Ignite ///Meow /// /* * else if (rH.transform.GetComponent(typeof(IExplosionEffect))) // explode stuff * * else if (rH.transform.GetComponent<BreakOnForceNoSpawn>()) // explode stuff * rH.transform.GetComponent<BreakOnForceNoSpawn>().BreakExplosion(400f, rH.point, 10f, 0f); * else if (rH.transform.GetComponent<BreakOnForce>()) * rH.transform.GetComponent<BreakOnForce>().BreakExplosion(400f, rH.point, 10f, 0f); * else if (rH.transform.GetComponent<BreakOnForceNoScaling>()) * rH.transform.GetComponent<BreakOnForceNoScaling>().BreakExplosion(400f, rH.point, 10f, 0f); * else if (rH.transform.GetComponent<CastleWallBreak>()) // explode ipsilon stuff * rH.transform.GetComponent<CastleWallBreak>().BreakExplosion(400f, rH.point, 10f, 0f); */ }
void FireTagsGUI() { if (bp.fireTags == null) { bp.fireTags = new FireTag[0]; } List <FireTag> fireTags = new List <FireTag>(bp.fireTags); if (fireTags.Count != bp.ftFoldouts.Count) { bp.ftFoldouts = new List <bool>(new bool[fireTags.Count]); } if (fireTags.Count != bp.ftaFoldouts.Count) { bp.ftaFoldouts = new List <ActionFoldouts>(new ActionFoldouts[fireTags.Count]); if (bp.ftaFoldouts.Count > 0) { for (var zz = 0; zz < bp.ftaFoldouts.Count; zz++) { bp.ftaFoldouts[zz] = new ActionFoldouts(); } } } GUILayout.BeginHorizontal(); bp.ftFoldout = EditorGUILayout.Foldout(bp.ftFoldout, "FireTags"); if (GUILayout.Button("Collapse All", GUILayout.Width(150))) { bp.ftFoldout = !bp.ftFoldout; for (int zz = 0; zz < bp.ftFoldouts.Count; zz++) { bp.ftFoldouts[zz] = bp.ftFoldout; } } GUILayout.EndHorizontal(); if (bp.ftFoldout) { EditorGUI.indentLevel++; var removeIndex = -1; var moveIndex = -1; for (var l = 0; l < fireTags.Count; l++) { EditorGUIUtility.labelWidth = 160; EditorGUIUtility.fieldWidth = 120; GUILayout.BeginHorizontal(); var str = "FireTag " + (l + 1); bp.ftFoldouts[l] = EditorGUILayout.Foldout(bp.ftFoldouts[l], str); if (GUILayout.Button("Down", GUILayout.Width(50))) { moveIndex = l; } if (GUILayout.Button("Remove", GUILayout.Width(80))) { removeIndex = l; } GUILayout.EndHorizontal(); EditorGUILayout.Space(); if (bp.ftFoldouts[l]) { GUI.changed = false; EditorGUI.indentLevel++; if (GUI.changed) { SceneView.RepaintAll(); } FireTagActionsGUI(l); EditorGUI.indentLevel--; EditorGUILayout.Space(); } } // if the "down" button was pressed then we move that array index down one time, MAGIC if (moveIndex >= 0 && moveIndex != fireTags.Count - 1) { var temp = fireTags[moveIndex]; fireTags[moveIndex] = fireTags[moveIndex + 1]; fireTags[moveIndex + 1] = temp; var temp2 = bp.ftFoldouts[moveIndex]; bp.ftFoldouts[moveIndex] = bp.ftFoldouts[moveIndex + 1]; bp.ftFoldouts[moveIndex + 1] = temp2; var temp3 = bp.ftaFoldouts[moveIndex]; bp.ftaFoldouts[moveIndex] = bp.ftaFoldouts[moveIndex + 1]; bp.ftaFoldouts[moveIndex + 1] = temp3; } // hmm what could remove do if (removeIndex >= 0) { fireTags.RemoveAt(removeIndex); bp.ftFoldouts.RemoveAt(removeIndex); bp.ftaFoldouts.RemoveAt(removeIndex); } //add a space to the GUI, adding a number in those paranthesis(brackets to you brits) will increase the space size EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.Label(""); if (GUILayout.Button("Add Fire Tag", GUILayout.Width(100))) { var ft = new FireTag(); ft.actions = new FireAction[1]; fireTags.Add(ft); bp.ftFoldouts.Add(true); bp.ftaFoldouts.Add(new ActionFoldouts()); } GUILayout.EndHorizontal(); bp.fireTags = fireTags.ToArray(); EditorGUI.indentLevel--; } EditorGUILayout.Space(); }
void FireTagsGUI() { if (bp.fireTags == null) bp.fireTags = new FireTag[0]; List<FireTag> fireTags = new List<FireTag>(bp.fireTags); if (fireTags.Count != bp.ftFoldouts.Count) bp.ftFoldouts = new List<bool>(new bool[fireTags.Count]); if (fireTags.Count != bp.ftaFoldouts.Count) { bp.ftaFoldouts = new List<ActionFoldouts>(new ActionFoldouts[fireTags.Count]); if (bp.ftaFoldouts.Count > 0) { for (var zz = 0; zz < bp.ftaFoldouts.Count; zz++) { bp.ftaFoldouts[zz] = new ActionFoldouts(); } } } GUILayout.BeginHorizontal(); bp.ftFoldout = EditorGUILayout.Foldout(bp.ftFoldout, "FireTags"); if (GUILayout.Button("Collapse All", GUILayout.Width(150))) { bp.ftFoldout = !bp.ftFoldout; for (int zz = 0; zz < bp.ftFoldouts.Count; zz++) bp.ftFoldouts[zz] = bp.ftFoldout; } GUILayout.EndHorizontal(); if (bp.ftFoldout) { EditorGUI.indentLevel++; var removeIndex = -1; var moveIndex = -1; for (var l = 0; l < fireTags.Count; l++) { EditorGUIUtility.labelWidth = 160; EditorGUIUtility.fieldWidth = 120; GUILayout.BeginHorizontal(); var str = "FireTag " + (l + 1); bp.ftFoldouts[l] = EditorGUILayout.Foldout(bp.ftFoldouts[l], str); if (GUILayout.Button("Down", GUILayout.Width(50))) moveIndex = l; if (GUILayout.Button("Remove", GUILayout.Width(80))) removeIndex = l; GUILayout.EndHorizontal(); EditorGUILayout.Space(); if (bp.ftFoldouts[l]) { GUI.changed = false; EditorGUI.indentLevel++; if (GUI.changed) SceneView.RepaintAll(); FireTagActionsGUI(l); EditorGUI.indentLevel--; EditorGUILayout.Space(); } } // if the "down" button was pressed then we move that array index down one time, MAGIC if (moveIndex >= 0 && moveIndex != fireTags.Count - 1) { var temp = fireTags[moveIndex]; fireTags[moveIndex] = fireTags[moveIndex + 1]; fireTags[moveIndex + 1] = temp; var temp2 = bp.ftFoldouts[moveIndex]; bp.ftFoldouts[moveIndex] = bp.ftFoldouts[moveIndex + 1]; bp.ftFoldouts[moveIndex + 1] = temp2; var temp3 = bp.ftaFoldouts[moveIndex]; bp.ftaFoldouts[moveIndex] = bp.ftaFoldouts[moveIndex + 1]; bp.ftaFoldouts[moveIndex + 1] = temp3; } // hmm what could remove do if (removeIndex >= 0) { fireTags.RemoveAt(removeIndex); bp.ftFoldouts.RemoveAt(removeIndex); bp.ftaFoldouts.RemoveAt(removeIndex); } //add a space to the GUI, adding a number in those paranthesis(brackets to you brits) will increase the space size EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.Label(""); if (GUILayout.Button("Add Fire Tag", GUILayout.Width(100))) { var ft = new FireTag(); ft.actions = new FireAction[1]; fireTags.Add(ft); bp.ftFoldouts.Add(true); bp.ftaFoldouts.Add(new ActionFoldouts()); } GUILayout.EndHorizontal(); bp.fireTags = fireTags.ToArray(); EditorGUI.indentLevel--; } EditorGUILayout.Space(); }
public bool OnIgnite(FireTag t, Collider c, bool pyroMode) { heating += 10f * Time.deltaTime; return(true); }
public override void OnSimulateStart_EnhancementEnabled() { rocketInBuildSent = removedFromGroup = false; // Read the charge from rocket explosiveCharge = bombExplosiveCharge = rocket.ChargeSlider.Value; // Make sure the high explo mode is not too imba if (HighExploToggle.IsActive && !EnhanceMore) { bombExplosiveCharge = Mathf.Clamp(explosiveCharge, 0f, 1.5f); } if (GuidedRocketToggle.IsActive) { // Initialisation for simulation launchTimeRecorded = bombHasExploded = rocketExploMsgSent = false; float searchAngle = Mathf.Clamp(ActiveGuideRocketSearchAngleSlider.Value, 0, EnhanceMore ? maxSearchAngleNo8 : maxSearchAngleNormal); float searchRange = EnhanceMore ? 5000f : 2000f; //Add radar //Collider[] selfColliders = rocket.gameObject.GetComponentsInChildren<Collider>(); radarObject = new GameObject("RocketRadar"); radarObject.transform.SetParent(rocket.transform); radarObject.transform.position = transform.position; radarObject.transform.rotation = transform.rotation; radarObject.transform.localPosition = Vector3.forward * 0.5f; radarObject.transform.localScale = restoreScale(rocket.transform.localScale); radar = radarObject.GetComponent <RadarScript>() ?? radarObject.AddComponent <RadarScript>(); radar.Setup(BB, rocketRigidbody, searchRange, searchAngle, RadarTypeMenu.Value, ShowRadarToggle.IsActive); radar.Setup(ShowPredictionToggle.IsActive, ProjectileSpeedSlider.Value, DragSlider.Value); //Workaround when radar can be ignited hence explode the rocket FireTag fireTag = radarObject.AddComponent <FireTag>(); fireTag.enabled = true; Rigidbody rigidbody = radarObject.AddComponent <Rigidbody>(); rigidbody.isKinematic = true; rigidbody.mass = 0.0001f; rigidbody.drag = 0f; //Stop colliding with its own colliders //if (selfColliders.Length > 0) //{ // foreach (var collider in selfColliders) // { // Physics.IgnoreCollision(collider, radar.meshCollider, true); // } //} //Set up Guide controller guideObject = new GameObject("GuideController"); guideObject.transform.SetParent(rocket.transform); guideObject.transform.position = transform.position; guideObject.transform.rotation = transform.rotation; guideObject.transform.localScale = Vector3.one; guideController = guideObject.GetComponent <GuideController>() ?? guideObject.AddComponent <GuideController>(); guideController.Setup(rocket, rocketRigidbody, radar, rocket.PowerSlider.Value, searchAngle, Mathf.Clamp(TorqueSlider.Value, 0, 100), false); StopAllCoroutines(); } smokeTrail = null; if (NoSmokeToggle.IsActive) { foreach (var value in rocket.trail) { var emission = value.emission; emission.enabled = false; } } else { foreach (var value in rocket.trail) { if (value.name.ToLower() == "smoketrail") { smokeTrail = value; var colt = smokeTrail.colorOverLifetime; //Debug.Log(colt.color.colorMin + "||" + colt.color.colorMax); //Debug.Log(colt.color.mode); //Debug.Log(colt.color.gradient.alphaKeys.Length); //colt.color.gradient.alphaKeys.ToList().ForEach(key => Debug.Log(key.alpha + "-" + key.time)); //Debug.Log(colt.color.gradient.colorKeys.Length); //colt.color.gradient.colorKeys.ToList().ForEach(key => Debug.Log(key.color + "-" + key.time)); //Debug.Log("??" + trailSmokePropertise.ToString()); colt.color = new ParticleSystem.MinMaxGradient(new Gradient() { alphaKeys = new GradientAlphaKey[] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(0.5f, 0.01f), new GradientAlphaKey(trailSmokePropertise.StartAlpha, trailSmokePropertise.StartAlphaTime), new GradientAlphaKey(trailSmokePropertise.EndAlpha, trailSmokePropertise.EndAlphaTime), new GradientAlphaKey(0f, 0.8f) }, colorKeys = new GradientColorKey[] { new GradientColorKey(new Color(1f, 1f, 0f, 1f), 0f), new GradientColorKey(new Color(0.882f, 0.365f, 0.176f, 1f), 0.019f), new GradientColorKey(trailSmokePropertise.StartColor, trailSmokePropertise.StartColorTime), new GradientColorKey(trailSmokePropertise.EndColor, trailSmokePropertise.EndColorTime) } });; break; } } } Vector3 restoreScale(Vector3 rocketScale) { var single = 1f / rocketScale.x; var single1 = 1f / rocketScale.y; var single2 = 1f / rocketScale.z; return(new Vector3(single, single1, single2)); } //Initialise Dict in RocketsController if (GroupFireKey.GetKey(0) != KeyCode.None && !GroupFireKey.Ignored) { if (!RocketsController.Instance.playerGroupedRockets.ContainsKey(rocket.ParentMachine.PlayerID)) { RocketsController.Instance.playerGroupedRockets.Add(rocket.ParentMachine.PlayerID, new Dictionary <KeyCode, HashSet <TimedRocket> >()); } if (!RocketsController.Instance.playerGroupedRockets[rocket.ParentMachine.PlayerID].ContainsKey(GroupFireKey.GetKey(0))) { RocketsController.Instance.playerGroupedRockets[rocket.ParentMachine.PlayerID].Add(GroupFireKey.GetKey(0), new HashSet <TimedRocket>()); } if (!RocketsController.Instance.playerGroupedRockets[rocket.ParentMachine.PlayerID][GroupFireKey.GetKey(0)].Contains(rocket)) { RocketsController.Instance.playerGroupedRockets[rocket.ParentMachine.PlayerID][GroupFireKey.GetKey(0)].Add(rocket); } } }