protected override void Init() { /* Debug.Log("Randomize elements"); * Util.Shuffle<SimHashes>(Gases); * DebugHelper.LogForEach(Gases); * element_input = Gases.First(); * Debug.Log("Element chossen"); * Debug.Log(element_input); * List<SimHashes> complete_list = Gases.Where(x => x != element_input).ToList(); * //Except(element_input).ToList(); * DebugHelper.Separator(); * DebugHelper.LogForEach(complete_list); * DebugHelper.Separator(); * complete_list = complete_list.Concat(Liquids).Concat(Solids).ToList(); * DebugHelper.LogForEach(complete_list); * Util.Shuffle(complete_list); * DebugHelper.LogForEach(complete_list); * DebugHelper.Separator(); * element_output = (SimHashes)complete_list.First(); * var element1 = ElementLoader.FindElementByHash(element_input); * var element2 = ElementLoader.FindElementByHash(element_output); * Description_custom = "This critter skin absorbs small quantities of " + element1.name + " and drops " + element2.name;*/ UtilPB.CreateTrait(ID, Name, Description, on_add : delegate(GameObject go) { ChooseTarget(go); }, positiveTrait: true ); }
protected override void Init() { UtilPB.CreateTrait(ID, Name, Description, on_add : delegate(GameObject go) { ChooseTarget(go); }, positiveTrait: Positive ); }
protected override void Init() { UtilPB.CreateTrait(ID, Name, Description, on_add : delegate(GameObject go) { var random_element = SimHashes.Hydrogen.CreateTag(); BubbleSpawner bubbleSpawner = go.AddComponent <BubbleSpawner>(); bubbleSpawner.element = SimHashes.Hydrogen; bubbleSpawner.emitMass = 2f; bubbleSpawner.emitVariance = 0.5f; bubbleSpawner.initialVelocity = (Vector2) new Vector2f(0, 1); }, positiveTrait: true ); }
static Texture2D TintTexture(Texture sourceTexture, string name) { Texture2D newTexture = UtilPB.DuplicateTexture(sourceTexture as Texture2D); var pixels = newTexture.GetPixels32(); for (int i = 0; i < pixels.Length; ++i) { var gray = ((Color)pixels[i]).grayscale * 1.5f; pixels[i] = (Color)ElementColor * gray; } newTexture.SetPixels32(pixels); newTexture.Apply(); newTexture.name = name; return(newTexture); }
public void ApplyColor() { UtilPB.ApplyTint(this.gameObject, color); }