public void Start() { Shader glowshader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTiltedCutoutEmissive"); foreach (Transform transform in base.transform) { if (TransformList.Contains(transform.name)) { tk2dSprite sproot = transform.GetComponent <tk2dSprite>(); if (sproot != null) { sproot.usesOverrideMaterial = true; sproot.renderer.material.shader = glowshader; sproot.renderer.material.EnableKeyword("BRIGHTNESS_CLAMP_ON"); sproot.renderer.material.SetFloat("_EmissivePower", EmissivePower); sproot.renderer.material.SetFloat("_EmissiveColorPower", EmissiveColorPower); } } } this.beamcont = base.GetComponent <BasicBeamController>(); BasicBeamController beam = this.beamcont; beam.sprite.usesOverrideMaterial = true; BasicBeamController component = beam.gameObject.GetComponent <BasicBeamController>(); bool flag = component != null; bool flag2 = flag; if (flag2) { component.sprite.renderer.material.shader = glowshader; component.sprite.renderer.material.EnableKeyword("BRIGHTNESS_CLAMP_ON"); component.sprite.renderer.material.SetFloat("_EmissivePower", EmissivePower); component.sprite.renderer.material.SetFloat("_EmissiveColorPower", EmissiveColorPower); } }
/*AUTO SCRIPT*/ /*AUTO SCRIPT*/ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) /*AUTO SCRIPT*/ { /*AUTO SCRIPT*/ if (list == null) /*AUTO SCRIPT*/ { /*AUTO SCRIPT*/ list = EditorUtility.GetPropertyObject <TransformList>(property); /*AUTO SCRIPT*/ rList = new ReorderableList(list, typeof(Transform), true, false, true, true); /*AUTO SCRIPT*/ // rList.onAddCallback += data => { list.Add(defaultVal); }; /*AUTO SCRIPT*/ // rList.onChangedCallback += data=> { /*AUTO SCRIPT*/ // }; /*AUTO SCRIPT*/ } /*AUTO SCRIPT*/ /*AUTO SCRIPT*/ numLines = 3 + list.Count; /*AUTO SCRIPT*/ var title = new GUIContent($" {label.text}"); /*AUTO SCRIPT*/ var height = base.GetPropertyHeight(property, label); /*AUTO SCRIPT*/ var rect = new Rect(position.x, position.y, position.width, height); /*AUTO SCRIPT*/ EditorGUI.BeginChangeCheck(); /*AUTO SCRIPT*/ rList.DoList(rect); /*AUTO SCRIPT*/ EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), title); /*AUTO SCRIPT*/ /*AUTO SCRIPT*/ if (EditorGUI.EndChangeCheck()) { /*AUTO SCRIPT*/ property.serializedObject.ApplyModifiedProperties(); } /*AUTO SCRIPT*/ /*AUTO SCRIPT*/ }
public AttackController(Transform owner, AttackBehaviour attackBehaviour, TransformList enemiesList) { this.owner = owner; this.attackBehaviour = attackBehaviour; this.enemiesList = enemiesList; targets = new Transform[attackBehaviour.TargetLimit]; }
public bool StartTLS(string strServer) { /// Negotiate TLS, don't return until it's done /// (We would use SslStream in normal .NET, but that's not available here) /// TLS is implement as a message filter TLStrans = new xmedianet.socketserver.TLS.TLSClientTransform(this); TransformList.Add(TLStrans); TLStrans.Activate(); return(false); }
public void Initialize(int bounces, float damageReductionPerBounce, float jumpRadius, TransformList enemiesAlive) { totalBounces = bounces; currentBounce = 1; this.damageReductionPerBounce = damageReductionPerBounce; this.jumpRadius = jumpRadius; this.enemiesAlive = enemiesAlive; projectile = GetComponent <Projectile>(); projectile.SetDeathBehaviour(this); currentTarget = projectile.Target; initialized = true; }
public void Initialize(int shatterAmount, float jumpRadius, float damageReductionOnShatter, AttackBehaviour shatterAttackBehaviour, TransformList enemiesAlive) { this.shatterAmount = shatterAmount; this.damageReductionOnShatter = damageReductionOnShatter; this.jumpRadius = jumpRadius; this.shatterAttackBehaviour = shatterAttackBehaviour; this.enemiesAlive = enemiesAlive; projectile = GetComponent <Projectile>(); projectile.SetDeathBehaviour(this); currentTarget = projectile.Target; initialized = true; }
public override void OnInspectorGUI() { GUILayoutOption width70 = GUILayout.Width(70); GUILayoutOption width40 = GUILayout.Width(40); // basic setup block GUILayout.Label("Destination", EditorStyles.boldLabel); if (transformList == null) { transformList = (TransformList)target; } GUILayout.BeginHorizontal(); transformList.usePosition = GUILayout.Toggle(transformList.usePosition, "Position", width70); transformList.useRotation = GUILayout.Toggle(transformList.useRotation, "Rotation", width70); transformList.useScale = GUILayout.Toggle(transformList.useScale, "Scale", GUILayout.Width(50)); transformList.targetTransform = (Transform)(EditorGUILayout.ObjectField(transformList.targetTransform, typeof(Transform), true)); GUILayout.EndHorizontal(); // config block GUILayout.BeginHorizontal(); transformList.autoSave = GUILayout.Toggle(transformList.autoSave, "Auto Save", GUILayout.Width(80)); transformList.isExpanded = GUILayout.Toggle(transformList.isExpanded, "Expand ", GUILayout.Width(60)); GUILayout.Label("ID", GUILayout.Width(20)); transformList.id = GUILayout.TextField(transformList.id); GUILayout.EndHorizontal(); // save load block GUILayout.BeginHorizontal(); if (GUILayout.Button("Save")) { transformList.saveSet(); } if (GUILayout.Button("Load")) { transformList.loadSet(); } GUILayout.EndHorizontal(); GUILayout.Space(10); // info block GUILayout.Label(" At step " + (transformList.currentStep + 1) + " of " + transformList.transforms.count + " (" + transformList.transforms.labels[transformList.currentStep] + ")"); GUILayout.Space(10); // store remove update block GUILayout.BeginHorizontal(); if (GUILayout.Button("Update Current")) { transformList.updateCurrent(); } if (transformList.transforms.count < 100 && GUILayout.Button("Add Current")) { transformList.storeCurrent(); } if (GUILayout.Button("Remove Current")) { transformList.remove(transformList.currentStep); } GUILayout.EndHorizontal(); // playstatus transformList.jumpOrAnimate = GUILayout.Toolbar(transformList.jumpOrAnimate, new string[] { "Animate", "Jump", "Pause" }); // forward backward block GUILayout.BeginHorizontal(); if (GUILayout.Button("<<")) { gotoPrev(); } if (GUILayout.Button(">>")) { gotoNext(); } if (GUILayout.Button("Random")) { transformList.gotoRandom(); } GUILayout.EndHorizontal(); // speedslider block GUILayout.Label("Smoothness " + transformList.speed.ToString("F")); transformList.speed = GUILayout.HorizontalSlider(transformList.speed, 0, 1.5f); GUILayout.BeginHorizontal(); GUILayout.Label("Interval (" + (transformList.interval * (1 - transformList.randomFactor)).ToString("F") + "s to " + (transformList.interval * (1 + transformList.randomFactor)).ToString("F") + "s)", GUILayout.Width(200)); transformList.randomFactor = GUILayout.HorizontalSlider(transformList.randomFactor, 0, 1); GUILayout.EndHorizontal(); transformList.interval = GUILayout.HorizontalSlider(transformList.interval, 0.1f, 10f); // Details block if (transformList.isExpanded) { GUILayout.Space(40); for (int i = 0; i < transformList.transforms.count; i++) { GUILayout.BeginHorizontal(); if (i > 0) { if (GUILayout.Button("Up", EditorStyles.miniButton, width40)) { transformList.swap(i, i - 1); } } else { GUILayout.Button(" ", EditorStyles.centeredGreyMiniLabel, width40); } if (i + 1 < transformList.transforms.count) { if (GUILayout.Button("Dn", EditorStyles.miniButton, width40)) { transformList.swap(i, i + 1); } } else { GUILayout.Button(" ", EditorStyles.centeredGreyMiniLabel, width40); } if (GUILayout.Button("X", EditorStyles.miniButton, width40)) { transformList.remove(i); } if (transformList.currentStep != i) { if (GUILayout.Button("", EditorStyles.foldout, width40)) { transformList.GoToStep(i); } } else { GUILayout.Label("ACT", width40); } transformList.transforms.labels[i] = GUILayout.TextField(transformList.transforms.labels[i]); GUILayout.EndHorizontal(); } } // GUILayout.Space(100); // DrawDefaultInspector(); }
public void Statistcs_ListGeneralizeMeanBlockAlgorithmTest() { var target = new ListGeneralizedMeanAlgorithm <int, double>( i => i, d => d, (d, i) => d / i, new DoubleField()); var blockNumber = 2500; var integerSequence = new List <int>(); for (var i = 1; i < 5500; ++i) { integerSequence.Add(i); var expected = (i + 1) / 2.0; var actual = target.Run <double>( integerSequence, blockNumber, (j, k) => j / (double)k, (d1, d2) => d1 * d2); Assert.IsTrue(Math.Abs(expected - actual) < 0.001); } var n = 1000500; for (var i = 5500; i <= n; ++i) { integerSequence.Add(i); } var outerExpected = (n + 1) / 2.0; var outerActual = target.Run <double>( integerSequence, blockNumber, (j, k) => j / (double)k, (d1, d2) => d1 * d2); Assert.AreEqual(outerExpected, outerActual); var integerDomain = new BigIntegerDomain(); var fractionField = new FractionField <BigInteger>(integerDomain); var fracTarget = new ListGeneralizedMeanAlgorithm <int, Fraction <BigInteger> >( i => new Fraction <BigInteger>(i, 1, integerDomain), d => d, (d, i) => d.Divide(i, integerDomain), fractionField); var fractionExpected = new Fraction <BigInteger>(n + 1, 2, integerDomain); var fractionActual = fracTarget.Run <Fraction <BigInteger> >( integerSequence, blockNumber, (j, k) => new Fraction <BigInteger>(j, k, integerDomain), (d1, d2) => d1.Multiply(d2, integerDomain)); Assert.AreEqual(fractionExpected, fractionActual); // Teste com alteração da função directa fracTarget.DirectFunction = i => new Fraction <BigInteger>(new BigInteger(i) * i, 1, integerDomain); fractionExpected = new Fraction <BigInteger>( (new BigInteger(n) + BigInteger.One) * (2 * new BigInteger(n) + 1), 6, integerDomain); fractionActual = fracTarget.Run <Fraction <BigInteger> >( integerSequence, blockNumber, (j, k) => new Fraction <BigInteger>(j, k, integerDomain), (d1, d2) => d1.Multiply(d2, integerDomain)); // Teste com transformação var transformedTarget = new ListGeneralizedMeanAlgorithm <BigInteger, Fraction <BigInteger> >( i => new Fraction <BigInteger>(i, 1, integerDomain), d => d, (d, i) => d.Divide(i, integerDomain), fractionField); var transformedSeq = new TransformList <int, BigInteger>( integerSequence, i => new BigInteger(i) * i); var transformedExpected = new Fraction <BigInteger>( (new BigInteger(n) + BigInteger.One) * (2 * new BigInteger(n) + 1), 6, integerDomain); var transformedActual = transformedTarget.Run <Fraction <BigInteger> >( transformedSeq, blockNumber, (j, k) => new Fraction <BigInteger>(j, k, integerDomain), (d1, d2) => d1.Multiply(d2, integerDomain)); Assert.AreEqual(transformedExpected, transformedActual); }
public void Statistcs_ListGeneralizeMeanAlgorithmTest() { var target = new ListGeneralizedMeanAlgorithm <int, double>( i => i, d => d, (d, i) => d / i, new DoubleField()); var integerSequence = new List <int>(); for (var i = 1; i < 5000; ++i) { integerSequence.Add(i); var expected = (i + 1) / 2.0; var actual = target.Run(integerSequence); Assert.AreEqual(expected, actual); } var n = 1000000; for (var i = 5000; i <= n; ++i) { integerSequence.Add(i); } var outerExpected = (n + 1) / 2.0; var outerActual = target.Run(integerSequence); Assert.AreEqual(outerExpected, outerActual); var bigIntegerDomain = new BigIntegerDomain(); var fractionField = new FractionField <BigInteger>(bigIntegerDomain); var fractionTarget = new ListGeneralizedMeanAlgorithm <int, Fraction <BigInteger> >( i => new Fraction <BigInteger>(i, 1, bigIntegerDomain), d => d, (d, i) => d.Divide(i, bigIntegerDomain), fractionField); var fractionExpected = new Fraction <BigInteger>(n + 1, 2, bigIntegerDomain); var fractionActual = fractionTarget.Run(integerSequence); Assert.AreEqual(fractionExpected, fractionActual); // Teste com alteração da função directa fractionTarget.DirectFunction = i => new Fraction <BigInteger>(new BigInteger(i) * i, 1, bigIntegerDomain); fractionExpected = new Fraction <BigInteger>( (new BigInteger(n) + BigInteger.One) * (2 * new BigInteger(n) + 1), 6, bigIntegerDomain); fractionActual = fractionTarget.Run(integerSequence); Assert.AreEqual(fractionExpected, fractionActual); // Teste com transformação var transformedTarget = new ListGeneralizedMeanAlgorithm <BigInteger, Fraction <BigInteger> >( i => new Fraction <BigInteger>(i, 1, bigIntegerDomain), d => d, (d, i) => d.Divide(i, bigIntegerDomain), fractionField); var transformedSeq = new TransformList <int, BigInteger>( integerSequence, i => new BigInteger(i) * i); var transformedExpected = new Fraction <BigInteger>( (new BigInteger(n) + BigInteger.One) * (2 * new BigInteger(n) + 1), 6, bigIntegerDomain); var transformedActual = transformedTarget.Run(transformedSeq); Assert.AreEqual(transformedExpected, transformedActual); }