public static effect DisplayEffect(string effectPath, float x, float y, float duration) { effect ef = AddSpecialEffect(effectPath, x, y); DelayedInvoke(duration, () => { DestroyEffect(ef); }); return(ef); }
public static effect DisplayEffectTarget(string effectPath, string attachmentPoint, widget wi, float duration) { effect ef = AddSpecialEffectTarget(effectPath, wi, attachmentPoint); DelayedInvoke(duration, () => { DestroyEffect(ef); }); return(ef); }
public void auto_set_avalible(int enable_item_idx, effect f) { data.Clear(); if (f == effect.just_open_close) { my_cus = myavalible; } if (f == effect.fadeout) { my_cus = myfadeout; } int k = _list.Count; string a = Convert.ToString(enable_item_idx, 2); string full = string.Format("{0:D" + k + "}", Int32.Parse(a)); char[] ns = full.ToCharArray(); Array.Reverse(ns); for (int i = 0; i < ns.Length; i++) { data.Add(ns[i].ToString()); } viewUpdate = true; }
void PlayBossMusic() { string enemyJson = File.ReadAllText(Application.dataPath + "/enemyToBattle.json"); enemyToBattle enemy = JsonUtility.FromJson <enemyToBattle>(enemyJson); string json1 = File.ReadAllText(Application.dataPath + "/Effects.json"); effect ef = JsonUtility.FromJson <effect>(json1); if (enemy.currentEnemyNr != "Enemy9") { SoundManager.instance.PlaySound("BossMusic" + enemy.currentEnemyNr[5]); } else { if (ef.turn == 0) { SoundManager.instance.PlaySound("BossMusic9intro"); } if (!SoundManager.instance.SoundIsPlaying("BossMusic9intro")) { SoundManager.instance.PlaySound("BossMusic9"); } } }
public static void Animatte(Control ctl, effect effect, int msec, int angle) { int flags = effmap[(int)effect]; if (ctl.Visible) { flags |= 0x30000; angle += 180; } else { if (ctl.TopLevelControl == ctl) { flags |= 0x20000; } else if (effect == effect.Blend) { throw new ArgumentException(); } } flags |= dirmap[angle % 360 / 45]; bool ok = AnimateWindow(ctl.Handle, msec, flags); if (!ok) { throw new Exception("Falha na animação"); } ctl.Visible = !ctl.Visible; }
/// <summary> /// 修改|添加功能信息 /// </summary> /// <param name="effect"></param> /// <returns></returns> public BaseResult UpdateEffect(effect effect) { BaseResult result = BaseResult.Fail(); result.code = 0; if (effect.id == 0) { if (dalUsers.RepeatEffectsNameCount(effect.name) != 0) { result.code = -2; result.msg = "名称重名"; return(result); } if (dalUsers.AddEffects(effect) == 0) { result.code = -2; result.msg = "添加失败"; return(result); } return(result); } if (dalUsers.UpdateEffects(effect) == 0) { result.code = -2; result.msg = "修改失败"; return(result); } return(result); }
/// <summary> /// 新增 /// </summary> /// <param name="effect"></param> /// <returns></returns> public int Add(effect effect) { return((int)dbContext.Insert <effect>(() => new effect() { name = effect.name, controller = effect.controller })); }
/// <summary> /// 更新 /// </summary> /// <param name="effect"></param> /// <returns></returns> public int Update(effect effect) { return(dbContext.Update <effect>(p => p.id == effect.id, p => new effect() { name = effect.name, controller = effect.controller })); }
public UpgradeChoice(string name, effect upgradeEffect, int baseCost, int costIncrement, int maxUpgrades) { this.name = name; this.upgradeEffect = upgradeEffect; this.baseCost = baseCost; this.costIncrement = costIncrement; this.numUpgrades = 0; this.maxUpgrades = maxUpgrades; }
public void init(string _name, string _description, effect _efc, dropStatus _dropStatus, int _modifier, quizType _quizType) { eventName = _name; description = _description; effectEvent = _efc; dropDirectStatus = _dropStatus; modifier = _modifier; _quiz = _quizType; }
public void init(string _name, string _description, effect _efc, int _modTime, dropStatus _dropStatusModifier, int _modifier, quizType _quizType) { eventName = _name; description = _description; effectEvent = _efc; dropStatusModifier = _dropStatusModifier; modifier = _modifier; timeDuration = _modTime; _quiz = _quizType; }
private static effect MakeEffect(ulong id_num) { effect eff = new effect(); eff.id = "effect_" + id_num; eff.Items = new effectFx_profile_abstractProfile_COMMON[] { MakeProfileCOMMON(id_num) }; return(eff); }
/// <summary> /// 修改功能 /// </summary> /// <param name="effect"></param> public int UpdateEffects(effect effect) { using (IDbContext dbContext = DbContextFactory.CreateDbContext()) { return(dbContext.Update <effect>(p => p.id == effect.id, p => new effect() { name = effect.name, controllers = effect.controllers, action = effect.action })); } }
/// <summary> /// 新增功能 /// </summary> /// <param name="effect"></param> public int AddEffects(effect effect) { using (IDbContext dbContext = DbContextFactory.CreateDbContext()) { return((int)dbContext.Insert <effect>(() => new effect() { name = effect.name, controllers = effect.controllers, action = effect.action })); } }
private static void FindEffect(effect whatEffect, Character character) { switch (whatEffect) { case effect.Slow: Slow(character); break; case effect.Stun: Stun(character); break; } }
void Start() { part = transform.GetComponentInChildren<ParticleSystem>(); onhit = transform.GetComponent<AudioSource>(); effectfalses = transform.GetComponents<EffectUnity>(); if (effectfalses.Length != 0) { effects = new effect[effectfalses.Length]; for (int k = 0; k < effectfalses.Length; k++) { effects[k] = new effect(effectfalses[k]); } } }
private static library_effects MakeEffectsLibrary(ref Model3D mdl, string modelName) { library_effects lib_eff = new library_effects(); int len = mdl.builder.TextureImages.Count; effect[] effects = new effect[len]; for (ulong i = 0; i < (ulong)effects.LongLength; i++) { effects[i] = MakeEffect(i); } lib_eff.effect = effects; return(lib_eff); }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody>(); _effect = hitEffect.GetComponent <effect>(); _effectpos = hitEffectpos.GetComponent <effectpos>(); rotaspeed = 0; speed = 4; gravity = 3; dieflag = false; bound = new Vector3(); state = State.normal; scene = new SceneChange(); Sound.LoadSE("Hit", "kick-low1"); }
public void playEffect(effect eff) { effectSource.clip = effectClips[(int)eff]; if (eff == effect.jump) { effectSource.volume = Random.Range(0.5f, 0.75f); effectSource.pitch = Random.Range(0.9f, 1.1f); } else { effectSource.volume = Random.Range(0.9f, 1f); effectSource.pitch = Random.Range(0.95f, 1.05f); } effectSource.Play(); }
private void makeArrow(GamePadState state, float degree, effect e = effect.Null) { GameObject arrow = GameObject.Find("ArrowPool").GetComponent <pool>().FetchObject(); arrow.transform.position = obj.transform.position; arrow.SetActive(true); arrow.GetComponent <dmg> ().eff = new Effect(e, 60); if (e == effect.Root) { arrow.GetComponent <SpriteRenderer> ().color = new Color(0, 1, 1, 1); } if (right) { arrow.GetComponent <Rigidbody2D> ().AddForce(new Vector2(800, degree * 200)); } else if (left) { arrow.GetComponent <Rigidbody2D> ().AddForce(new Vector2(-800, degree * 200)); arrow.transform.position = obj.transform.position - new Vector3(.5f, 0, 0); } }
/// <summary> /// Permanent status. /// </summary> /// <param name="id"></param> /// <param name="type"></param> /// <param name="source"></param> /// <param name="target"></param> /// <param name="level"></param> /// <param name="duration"></param> /// <param name="stacking"></param> /// <param name="periodic"></param> private Status(int id, TimedType type, NoxUnit source, NoxUnit target, int level, int initialStacks, int stacksLim, float duration, float periodicTimeout, bool stacking, bool periodic, bool permanent = false) { //if(type.DataType != null) //Data = Activator.CreateInstance(type.DataType); Id = id; Type = type; Source = source; Target = target; Level = level; Stacking = stacking; Periodic = periodic; //Permanent = permanent; PeriodicTimeout = periodicTimeout; StacksLim = stacksLim; Duration = duration; t = CreateTimer(); if (periodic) { PeriodicTicks = 0; TimeRemain = duration; TimerStart(t, PeriodicTimeout, false, PeriodicTimerRestart); } else { TimerStart(t, duration, false, Remove); } if (stacking) { Stacks = initialStacks; } if (Type.Apply != null) { Type.Apply.Invoke(this); } if (Type.Effectpath != null && Type.Attachment != null) { SpecialEffect = AddSpecialEffectTarget(Type.Effectpath, target._Self, Type.Attachment); } }
/// <summary> /// Kill status completely and cleanup /// </summary> public void Remove() { PauseTimer(t); TimeElapsed += TimerGetElapsed(t); DestroyTimer(t); if (Type.Reset != null) { Type.Reset.Invoke(this); } if (Type.OnRemove != null) { Type.OnRemove.Invoke(this); } Target.RemoveStatus(Id); DestroyEffect(SpecialEffect); t = null; Data = null; SpecialEffect = null; Type = null; Source = null; Target = null; }
void mapToArcade() { SoundManager.instance.StopSound(); /*INITIALIZE EFFECTS*/ effect ef = new effect(); ef.turn = 0; ef.bombermanDamageTurn1 = ef.bombermanDamageTurn2 = -1; ef.noInvincibleTurn1 = ef.noInvincibleTurn2 = -1; ef.whoReflectDamage = 0; ef.turnToReflect1 = ef.turnToReflect2 = -1; ef.turnToStopPoison1 = ef.turnToStopPoison2 = -1; string json = JsonUtility.ToJson(ef); File.WriteAllText(Application.dataPath + "/Effects.json", json); /*THE ARCADE SCENE WILL RESTART */ gameInProgress GIP = new gameInProgress(); GIP.IsPlaying = false; string playing = JsonUtility.ToJson(GIP); File.WriteAllText(Application.dataPath + "/GameInProgress.json", playing); data Data = new data(); Data.position = player.position; Data.position.y -= 2; string json1 = JsonUtility.ToJson(Data); File.WriteAllText(Application.dataPath + "/savefile.json", json1); StartCoroutine(mapToArcadeCor()); }
public void GetEffect(int number) { switch (number) { //0 = Null; case 1: EmojiEffect = effect.Slowdown; break; case 2: EmojiEffect = effect.Acceleration; break; case 3: EmojiEffect = effect.Curse; break; case 4: EmojiEffect = effect.Mark; break; case 5: EmojiEffect = effect.Silence; break; case 6: EmojiEffect = effect.Lock; break; case 7: EmojiEffect = effect.Cramp; break; default: break; } }
/// <summary> /// 更新 /// </summary> /// <param name="effect"></param> /// <returns></returns> public BaseResult Update(effect effect) { result.code = 0; if (dalEffect.Single(effect.name) == null) { if (effect.id != 0) { if (dalEffect.Update(effect) == 0) { result.code = -1; result.msg = "修改失败"; } else { } } else { if (dalEffect.Add(effect) == 0) { result.code = -1; result.msg = "添加失败"; } else { } } } else { result.code = -2; result.msg = "功能名称重复"; } return(result); }
public static DialogueResponse getResponses(int day, List<int> ChoiceChildren, Character.Player player) { string childrenString = ""; int childCounter = 0; int id = 0; List<int> children = new List<int>(); int responseDay = 0; List<Condition> conditions = new List<Condition>(); List<effect> effects = new List<effect>(); string text = ""; int ResponseCounter = 0; List<DialogueResponse> UnparsedResponses = new List<DialogueResponse>(); foreach (int child in ChoiceChildren) { childCounter += 1; if (childCounter < ChoiceChildren.Count) { childrenString = childrenString + "id = " + child + " or "; } else { childrenString = childrenString + "id = " + child; } } string strExpression = "/dialogue/dialogueResponse[(" + childrenString + ") and @day='" + day.ToString() + "']/*"; XPathDocument dialogueFile = new XPathDocument(DialogueFileLocation); XPathNavigator nav = dialogueFile.CreateNavigator(); XPathNodeIterator nodeIter = nav.Select(strExpression); //we've selected all the child dialogue choices. Now we need to read them into dialogueChoice objects. while (nodeIter.MoveNext()) { switch (nodeIter.Current.Name) { case "children": //read and parse this comma delimited string, turn it into a List<int> object String ChildrenString = nodeIter.Current.Value; string[] childrenArray = ChildrenString.Split(','); foreach (string s in childrenArray) { children.Add(Convert.ToInt32(s)); } break; case "condition": //create condition and add it to condition list. Condition condition = new Condition(); //go through condition attribute values and populate the condition object with them. String subject = nodeIter.Current.GetAttribute("subject", ""); condition.Subject = subject; String attribute = nodeIter.Current.GetAttribute("attribute", ""); condition.Attribute = attribute; String upperLimit = nodeIter.Current.GetAttribute("upperLimit", ""); if (upperLimit != "") condition.UpperLimit = Convert.ToInt32(upperLimit); String lowerLimit = nodeIter.Current.GetAttribute("lowerLimit", ""); if (lowerLimit != "") condition.LowerLimit = Convert.ToInt32(lowerLimit); String value = nodeIter.Current.Value; if (value != "") condition.Value = Convert.ToInt32(value); String type = nodeIter.Current.GetAttribute("type", ""); condition.Type = type; String decisionID = nodeIter.Current.GetAttribute("id", ""); if (decisionID != "") condition.DecisionID = Convert.ToInt32(decisionID); conditions.Add(condition); break; case "effect": effect effect = new effect(); String effectType = nodeIter.Current.GetAttribute("type", ""); effect.type = effectType; String effectSubject = nodeIter.Current.GetAttribute("subject", ""); effect.Subject = effectSubject; String effectAttribute = nodeIter.Current.GetAttribute("attribute", ""); effect.Attribute = effectAttribute; String effectChange = nodeIter.Current.GetAttribute("change", ""); if (effectChange != "") effect.change = Convert.ToInt32(effectChange); String effectDecisionId = nodeIter.Current.GetAttribute("id", ""); if (effectDecisionId != "") effect.DecisionID = Convert.ToInt32(effectDecisionId); String decisionValue = nodeIter.Current.Value; int n; if (Int32.TryParse(decisionValue, out n)) effect.DecisionValue = Convert.ToInt32(decisionValue); String effectDescription = nodeIter.Current.GetAttribute("desc", ""); effect.Description = effectDescription; effects.Add(effect); break; case "text": text = nodeIter.Current.Value; break; case "id": //add one to the response counter - we got a new response! ResponseCounter += 1; id = Convert.ToInt32(nodeIter.Current.Value); //Now we can create a new response object and fill it. DialogueResponse Response = new DialogueResponse(); Response.Day = day; Response.ID = id; Response.Text = text; Response.children = children; Response.Conditions = conditions; Response.Effects = effects; //Add new response to response list UnparsedResponses.Add(Response); //reset values to default for the next dialogue id = 0; text = ""; children = new List<int>(); conditions = new List<Condition>(); break; } } DialogueResponse parsedResponses = ParseResponses(UnparsedResponses, player); return parsedResponses; }
static void spellActions() { // Range around the caster that targets can be hit from const float kSpellRange = 750; // The amount of damage each strike deals const float kDamage = 250; // Max number of targets the spell can hit const int kMaxTargets = 6; // variable to decrement when each target is hit int count = kMaxTargets; // Gets the unit that cast the spell associated with // this trigger and saves it into a variable unit caster = GetSpellAbilityUnit(); // Gets the location of the caster float startX = GetUnitX(caster); float startY = GetUnitY(caster); // Create a group variable to hold the units the spell will hit group targets = CreateGroup(); // Only the first kMaxTargets units that cause filterCondition // to return true will be added to the group. GroupEnumUnitsInRange(targets, startX, startY, kSpellRange, Condition(filterCondition)); // Time to play attack animation const float kAttackTime = 0.65f; // Will hit Group size units or max targets, whichever is smaller int numTargets = System.Math.Min(kMaxTargets, BlzGroupGetSize(targets)); // Total time the spell should take float followThroughTime = kAttackTime * numTargets; // Sets the spell follow through time to the calculated value BlzSetAbilityRealLevelField(GetSpellAbility(), ABILITY_RLF_FOLLOW_THROUGH_TIME, 0, followThroughTime); // Effect model names const string blinkName = @"Abilities\Spells\NightElf\Blink\BlinkCaster.mdl"; const string shockName = @"Abilities\Spells\Items\AIlb\AIlbSpecialArt.mdl"; // This variable will store the target we're currently hitting // Start with the first unit in the group unit currentTarget = FirstOfGroup(targets); // While there's still a target to hit and we have't yet hit max targets while (currentTarget != null && count > 0) { // Get start location for blink effect float oldCasterX = GetUnitX(caster); float oldCasterY = GetUnitY(caster); // Create blink effect, save it to clean up later effect preBlinkEffect = AddSpecialEffect(blinkName, oldCasterX, oldCasterY); // // Teleport to, face, and attack enemy // const float twoPi = 2.0f * War3Api.Blizzard.bj_PI; // Get the position of the enemy we're targeting float targetX = GetUnitX(currentTarget); float targetY = GetUnitY(currentTarget); // Cant occupy same spot as target. If try to, will get pushed // out in the same direction every time and it looks bad // pick a random angle and calculate an offset in that direction float randomOffsetAngle = GetRandomReal(0.0f, twoPi); const float kOffsetRadius = 50.0f; float offsetX = kOffsetRadius * Cos(randomOffsetAngle); float offsetY = kOffsetRadius * Sin(randomOffsetAngle); // teleport a slight offset away from target SetUnitPosition(caster, targetX + offsetX, targetY + offsetY); // Might not be in the exact expected position // get position after teleport float newCasterX = GetUnitX(caster); float newCasterY = GetUnitY(caster); // Spawn another blink at caster's new position effect postBlinkEffect = AddSpecialEffect(blinkName, newCasterX, newCasterY); // Get the diference between the caster and the target float deltaX = targetX - newCasterX; float deltaY = targetY - newCasterY; // Take the inverse tangent of that difference vector float angleInRadians = Atan2(deltaY, deltaX); // and convert it from radians to degrees float angleInDegrees = War3Api.Blizzard.bj_RADTODEG * angleInRadians; // Make the caster face the calculated angle SetUnitFacing(caster, angleInDegrees); // Have the caster play its attack animation SetUnitAnimation(caster, "attack"); // Sleep to let the caster play its animation TriggerSleepAction(kAttackTime); // Have the caster deal damage to the enemy UnitDamageTarget(caster, currentTarget, kDamage, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null); // Create shock effect on damage attached to the target's chest effect shockEffect = AddSpecialEffectTarget(shockName, currentTarget, "chest"); // Scale up shock effect BlzSetSpecialEffectScale(shockEffect, 1.5f); // Remove the unit we just considered from the group GroupRemoveUnit(targets, currentTarget); // Get the next unit in the group to consider. If the group is // empty, this will return null and break out of the while loop currentTarget = FirstOfGroup(targets); //decrement count count -= 1; // Clean up effects DestroyEffect(preBlinkEffect); DestroyEffect(postBlinkEffect); DestroyEffect(shockEffect); } // Certain Warcraft 3 types, like groups, need to be cleaned up DestroyGroup(targets); }
// STAThread is ESSENTIAL to make this work [STAThread] public static void Main(string[] args) { // no messing, this is high priority stuff Thread.CurrentThread.Priority = ThreadPriority.Highest; Process myP = Process.GetCurrentProcess(); myP.ProcessorAffinity = (IntPtr)1; // make sure we have at least one ASIO driver installed if (AsioDriver.InstalledDrivers.Length == 0) { Console.WriteLine("There appears to be no ASIO drivers installed on your system."); Console.WriteLine("If your soundcard supports ASIO natively, install the driver"); Console.WriteLine("from the support disc. If your soundcard has no native ASIO support"); Console.WriteLine("you can probably use the generic ASIO4ALL driver."); Console.WriteLine("You can download this from: http://www.asio4all.com/"); Console.WriteLine("It's very good!"); Console.WriteLine(); Console.WriteLine("Hit Enter to exit..."); Console.ReadLine(); return; } // bingo, we've got at least one Console.WriteLine("Your system has the following ASIO drivers installed:"); Console.WriteLine(); // so iterate through them for (int index = 0; index < AsioDriver.InstalledDrivers.Length; index++) { // and display them Console.WriteLine(string.Format(" {0}. {1}", index + 1, AsioDriver.InstalledDrivers[index])); } Console.WriteLine(); int driverNumber = 0; // get them to choose one while (driverNumber < 1 || driverNumber > AsioDriver.InstalledDrivers.Length) { // we'll keep telling them this until they make a valid selection Console.Write("Select which driver you wish to use (x for exit): "); ConsoleKeyInfo key = Console.ReadKey(); Console.WriteLine(); // deal with exit condition if (key.KeyChar == 'x') return; // convert from ASCII to int driverNumber = key.KeyChar - 48; } Console.WriteLine(); Console.WriteLine("Using: " + AsioDriver.InstalledDrivers[driverNumber - 1]); Console.WriteLine(); // load and activate the desited driver AsioDriver driver = AsioDriver.SelectDriver(AsioDriver.InstalledDrivers[driverNumber - 1]); // popup the driver's control panel for configuration driver.ShowControlPanel(); // now dump some details Console.WriteLine(" Driver name = " + driver.DriverName); Console.WriteLine(" Driver version = " + driver.Version); Console.WriteLine(" Input channels = " + driver.NumberInputChannels); Console.WriteLine(" Output channels = " + driver.NumberOutputChannels); Console.WriteLine(" Min buffer size = " + driver.BufferSizex.MinSize); Console.WriteLine(" Max buffer size = " + driver.BufferSizex.MaxSize); Console.WriteLine(" Preferred buffer size = " + driver.BufferSizex.PreferredSize); Console.WriteLine(" Granularity = " + driver.BufferSizex.Granularity); Console.WriteLine(" Sample rate = " + driver.SampleRate); // get our driver wrapper to create its buffers driver.CreateBuffers(false); // write out the input channels Console.WriteLine(" Input channels found = " + driver.InputChannels.Length); Console.WriteLine(" ----"); foreach (Channel channel in driver.InputChannels) { Console.WriteLine(channel.Name); } // and the output channels Console.WriteLine(" Output channels found = " + driver.OutputChannels.Length); Console.WriteLine("----"); foreach (Channel channel in driver.OutputChannels) { Console.WriteLine(channel.Name); } Console.Write("Select which effect you wish to use (1 = delay, 2 = flanger, 3 = phaser, 4 = reverb): "); ConsoleKeyInfo useEffect = Console.ReadKey(); if (useEffect.KeyChar == '1') effectType = effect.delay; else if (useEffect.KeyChar == '2') effectType = effect.flanger; else if (useEffect.KeyChar == '3') effectType = effect.phaser; else if (useEffect.KeyChar == '4') effectType = effect.reverb; else effectType = effect.none; // create standard sized buffers with a size of PreferredSize x MaxBuffers _delayBuffer = new float[driver.BufferSizex.PreferredSize, MaxBuffers]; // create a feedback buffer for the delay effect _delayFBbuffer = new float[driver.BufferSizex.PreferredSize, MaxBuffers]; // create a input buffer for reverb effect _delayINbuffer = new float[driver.BufferSizex.PreferredSize, MaxBuffers]; // create a output buffer for reverb effect _delayOUTbuffer = new float[driver.BufferSizex.PreferredSize, MaxBuffers]; // this is our buffer fill event we need to respond to driver.BufferUpdate += new EventHandler(AsioDriver_BufferUpdate); // and off we go driver.Start(); // create a wav file for recording wav.Create("test.wav", true, 44100, 16); // wait for enter key Console.WriteLine(); Console.WriteLine("Press Enter to end"); Console.ReadLine(); // and all done driver.Stop(); // close the wav file wav.Close(); }
/// <summary> /// Adds an effect for removal after the given duration. /// </summary> /// <param name="effect"></param> /// <param name="duration">In seconds.</param> public static void Add(effect effect, float duration = PeriodicEvents.SYSTEM_INTERVAL) { periodicTrigger.Add(new TimedEffect(effect, duration)); }
public void frostuse() { frostst = Time.time; NetworkerPhoton.RPCSnakePart(stats.photonid, "snakeaoe"); playaudio("froststorm", 2); aoe anaoe = stats.theactualpos.gameObject.AddComponent<aoe>(); anaoe.stats = stats; anaoe.damage = 30; anaoe.range = frostrange; anaoe.length = 6; anaoe.owner = true; effect[] arreffect = new effect[] { new effect(0.02f) }; arreffect[0].spellvamp = 0f; arreffect[0].speedmult = 0.75f; anaoe.effects = arreffect; }
public void AddEffectsLocal(effect[] eff, int senderid) { for (int k = 0; k < eff.Length; k++) { eff[k].stamp = Time.time; effects.Add(eff[k]); } calceffects(); }
public void AddEffectsExt(effect[] eff, int senderid) { if (eff.Length == 0) { } else { string astring = fserial.saveasstring(eff); NetworkerPhoton.thenetw.RPC("EffectRPC", PhotonTargets.All, photonid, astring, senderid); } }
public static List<DialogueResponse> getDialogueRoot(int day, Character.Player player) { int id = 0; List<int> children = new List<int>(); int Rday = 0; List<Condition> conditions = new List<Condition>(); List<effect> effects = new List<effect>(); string text = ""; int ResponseCounter = 0; List<DialogueResponse> RootResponses = new List<DialogueResponse>(); //select all dialogueResponse elements with attribute root=1, on a day which matches the current day, and the players current location. string strExpression = "/dialogue/dialogueResponse[@root='1' and @day='" + day.ToString() + "' and @location='" + player.Location.ToString() + "']/*"; XPathDocument dialogueFile = new XPathDocument(DialogueFileLocation); XPathNavigator nav = dialogueFile.CreateNavigator(); XPathNodeIterator nodeIter = nav.Select(strExpression); while (nodeIter.MoveNext()) { //we've located the dialogueResponses we're interested in. Now we need to read and assign their child elements. switch (nodeIter.Current.Name) { case "children": //read and parse this comma delimited string, turn it into a List<int> object String ChildrenString = nodeIter.Current.Value; string[] childrenArray = ChildrenString.Split(','); foreach (string s in childrenArray) { children.Add(Convert.ToInt32(s)); } break; case "condition": //create condition and add it to condition list. Condition condition = new Condition(); //go through condition attribute values and populate the condition object with them. String subject = nodeIter.Current.GetAttribute("subject",""); condition.Subject = subject; String attribute = nodeIter.Current.GetAttribute("attribute", ""); condition.Attribute = attribute; String upperLimit = nodeIter.Current.GetAttribute("upperLimit", ""); if (upperLimit != "") condition.UpperLimit = Convert.ToInt32(upperLimit); String lowerLimit = nodeIter.Current.GetAttribute("lowerLimit", ""); if (lowerLimit != "") condition.LowerLimit = Convert.ToInt32(lowerLimit); String value = nodeIter.Current.Value; if (value !="") condition.Value = Convert.ToInt32(value); String type = nodeIter.Current.GetAttribute("type", ""); condition.Type = type; String decisionID = nodeIter.Current.GetAttribute("id", ""); if (decisionID != "") condition.DecisionID = Convert.ToInt32(decisionID); conditions.Add(condition); break; case "effect": effect effect = new effect(); String effectType = nodeIter.Current.GetAttribute("type",""); effect.type = effectType; String effectSubject = nodeIter.Current.GetAttribute("subject", ""); effect.Subject = effectSubject; String effectAttribute = nodeIter.Current.GetAttribute("attribute", ""); effect.Attribute = effectAttribute; String effectChange = nodeIter.Current.GetAttribute("change", ""); if(effectChange != "") effect.change = Convert.ToInt32(effectChange); String effectDecisionId = nodeIter.Current.GetAttribute("id", ""); if (effectDecisionId != "") effect.DecisionID = Convert.ToInt32(effectDecisionId); String decisionValue = nodeIter.Current.Value; int n; if (Int32.TryParse(decisionValue, out n)) effect.DecisionValue = Convert.ToInt32(decisionValue); String effectDescription = nodeIter.Current.GetAttribute("desc", ""); effect.Description = effectDescription; effects.Add(effect); break; case "text": text = nodeIter.Current.Value; break; case "id": //add one to the response counter - we got a new response! ResponseCounter += 1; id = Convert.ToInt32(nodeIter.Current.Value); //Now we can create a new response object and fill it. DialogueResponse Response = new DialogueResponse(); Response.ID = id; Response.Text = text; Response.children = children; Response.Conditions = conditions; Response.Effects = effects; //Add new response to response list RootResponses.Add(Response); //reset values to default for the next dialogue id = 0; text = ""; children = new List<int>(); conditions = new List<Condition>(); break; } //throw new System.InvalidOperationException("No Root Dialogue was found!"); } ParseResponses(RootResponses, player); return RootResponses; }
public void LoadScenery() { try { GameObject hider = new GameObject(); char dsc = System.IO.Path.DirectorySeparatorChar; using (WWW www = new WWW("file://" + Path + dsc + "assetbundle" + dsc + "mod")) { if (www.error != null) { throw new Exception("Loading had an error:" + www.error); } AssetBundle bundle = www.assetBundle; try { XmlDocument doc = new XmlDocument(); string[] files = System.IO.Directory.GetFiles(Path, "*.xml"); doc.Load(files[0]); XmlElement xelRoot = doc.DocumentElement; XmlNodeList ModNodes = xelRoot.SelectNodes("/Mod"); foreach (XmlNode Mod in ModNodes) { modName = Mod["ModName"].InnerText; modDiscription = Mod["ModDiscription"].InnerText; } XmlNodeList ObjectNodes = xelRoot.SelectNodes("/Mod/Objects/Object"); foreach (XmlNode ParkOBJ in ObjectNodes) { try { ModdedObject MO = null; GameObject asset = Instantiate(bundle.LoadAsset(ParkOBJ["OBJName"].InnerText)) as GameObject; asset.name = Identifier + "@" + ParkOBJ["OBJName"].InnerText; switch (ParkOBJ["Type"].InnerText) { case "deco": DecoMod DM = new DecoMod(); DM.HeightDelta = float.Parse(ParkOBJ["heightDelta"].InnerText); DM.GridSubdivision = 1f; DM.SnapCenter = Convert.ToBoolean(ParkOBJ["snapCenter"].InnerText); DM.category = ParkOBJ["category"].InnerText; DM.BuildOnGrid = Convert.ToBoolean(ParkOBJ["grid"].InnerText); DM.gridSubdivision = float.Parse(ParkOBJ["gridSubdivision"].InnerText); MO = DM; break; case "trashbin": MO = new TrashBinMod(); break; case "seating": SeatingMod SM = new SeatingMod(); SM.hasBackRest = false; MO = SM; break; case "seatingAuto": SeatingAutoMod SMA = new SeatingAutoMod(); SMA.hasBackRest = false; SMA.seatCount = 2; MO = SMA; break; case "lamp": MO = new LampMod(); break; case "fence": FenceMod FM = new FenceMod(); FM.FenceFlat = null; FM.FencePost = null; MO = FM; break; case "FlatRide": FlatRideMod FR = new FlatRideMod(); FR.XSize = (int)float.Parse(ParkOBJ["X"].InnerText); FR.ZSize = (int)float.Parse(ParkOBJ["Z"].InnerText); FR.Excitement = float.Parse(ParkOBJ["Excitement"].InnerText); FR.Intensity = float.Parse(ParkOBJ["Intensity"].InnerText); FR.Nausea = float.Parse(ParkOBJ["Nausea"].InnerText); FR.closedAngleRetraints = getVector3(ParkOBJ["RestraintAngle"].InnerText); RideAnimationMod RA = new RideAnimationMod(); RA.motors = FlatRideLoader.LoadMotors(ParkOBJ, asset); RA.phases = FlatRideLoader.LoadPhases(ParkOBJ, asset); FR.Animation = RA; XmlNodeList WaypointsNodes = ParkOBJ.SelectNodes("Waypoints/Waypoint"); foreach (XmlNode xndNode in WaypointsNodes) { Waypoint w = new Waypoint(); w.isOuter = Convert.ToBoolean(xndNode["isOuter"].InnerText); w.isRabbitHoleGoal = Convert.ToBoolean(xndNode["isRabbitHoleGoal"].InnerText); if (xndNode["connectedTo"].InnerText != "") { w.connectedTo = xndNode["connectedTo"].InnerText.Split(',').ToList().ConvertAll(s => Int32.Parse(s)); } w.localPosition = getVector3(xndNode["localPosition"].InnerText); FR.waypoints.Add(w); } MO = FR; break; case "Shop": ShopMod S = new ShopMod(); asset.SetActive(false); XmlNodeList ProductNodes = ParkOBJ.SelectNodes("Shop/Product"); foreach (XmlNode ProductNode in ProductNodes) { ProductMod PM = new ProductMod(); switch (ProductNode["Type"].InnerText) { case "consumable": consumable C = new consumable(); C.ConsumeAnimation = (consumable.consumeanimation)Enum.Parse(typeof(consumable.consumeanimation), ProductNode["ConsumeAnimation"].InnerText); C.Temprature = (consumable.temprature)Enum.Parse(typeof(consumable.temprature), ProductNode["Temprature"].InnerText); C.portions = Int32.Parse(ProductNode["Portions"].InnerText); PM = C; break; case "wearable": wearable W = new wearable(); W.BodyLocation = (wearable.bodylocation)Enum.Parse(typeof(wearable.bodylocation), ProductNode["BodyLocation"].InnerText); PM = W; break; case "ongoing": ongoing O = new ongoing(); O.duration = Int32.Parse(ProductNode["Duration"].InnerText); PM = O; break; default: break; } PM.Name = ProductNode["Name"].InnerText; PM.GO = Instantiate(bundle.LoadAsset(ProductNode["Model"].InnerText)) as GameObject; PM.GO.SetActive(false); PM.Hand = (ProductMod.hand)Enum.Parse(typeof(ProductMod.hand), ProductNode["Hand"].InnerText); PM.price = float.Parse(ProductNode["Price"].InnerText); XmlNodeList IngredientNodes = ProductNode.SelectNodes("Ingredients/Ingredient"); foreach (XmlNode IngredientNode in IngredientNodes) { ingredient I = new ingredient(); I.Name = IngredientNode["Name"].InnerText; I.price = float.Parse(IngredientNode["Price"].InnerText); I.amount = float.Parse(IngredientNode["Amount"].InnerText); I.tweakable = Boolean.Parse(IngredientNode["tweakable"].InnerText); XmlNodeList EffectNodes = IngredientNode.SelectNodes("Effects/effect"); foreach (XmlNode EffectNode in EffectNodes) { effect E = new effect(); E.Type = (effect.Types)Enum.Parse(typeof(effect.Types), EffectNode["Type"].InnerText); E.amount = float.Parse(EffectNode["Amount"].InnerText); I.effects.Add(E); } PM.ingredients.Add(I); } S.products.Add(PM); } MO = S; break; case "PathStyle": Registar.RegisterPath(asset.GetComponent <Renderer>().material.mainTexture, ParkOBJ["inGameName"].InnerText, (Registar.PathType)Enum.Parse(typeof(Registar.PathType), ParkOBJ["PathStyle"].InnerText)); break; case "CoasterCar": Debug.Log("Test CoasterCar"); CoasterCarMod CC = new CoasterCarMod(); CC.CoasterName = ParkOBJ["CoasterName"].InnerText; CC.Name = ParkOBJ["inGameName"].InnerText; try { CC.closedAngleRetraints = getVector3(ParkOBJ["RestraintAngle"].InnerText); CC.FrontCarGO = Instantiate(bundle.LoadAsset(ParkOBJ["FrontCarGO"].InnerText)) as GameObject; } catch { } MO = CC; MO.Name = ParkOBJ["inGameName"].InnerText; MO.Object = asset; break; default: break; } if (MO != null) { MO.Name = ParkOBJ["inGameName"].InnerText; MO.Object = asset; MO.Price = float.Parse(ParkOBJ["price"].InnerText); MO.Shader = ParkOBJ["shader"].InnerText; if (ParkOBJ["BoudingBoxes"] != null) { XmlNodeList BoudingBoxNodes = ParkOBJ.SelectNodes("BoudingBoxes/BoudingBox"); foreach (XmlNode Box in BoudingBoxNodes) { BoundingBox BB = MO.Object.AddComponent <BoundingBox>(); BB.isStatic = false; BB.bounds.min = getVector3(Box["min"].InnerText); BB.bounds.max = getVector3(Box["max"].InnerText); BB.layers = BoundingVolume.Layers.Buildvolume; BB.isStatic = true; } } MO.Recolorable = Convert.ToBoolean(ParkOBJ["recolorable"].InnerText); if (MO.Recolorable) { List <Color> colors = new List <Color>(); if (HexToColor(ParkOBJ["Color1"].InnerText) != new Color(0.95f, 0, 0)) { colors.Add(HexToColor(ParkOBJ["Color1"].InnerText)); } if (HexToColor(ParkOBJ["Color2"].InnerText) != new Color(0.32f, 1, 0)) { colors.Add(HexToColor(ParkOBJ["Color2"].InnerText)); } Debug.Log("Color 3" + HexToColor(ParkOBJ["Color3"].InnerText)); if (ParkOBJ["Color3"].InnerText != "1C0FFF") { colors.Add(HexToColor(ParkOBJ["Color3"].InnerText)); } if (HexToColor(ParkOBJ["Color4"].InnerText) != new Color(1, 0, 1)) { colors.Add(HexToColor(ParkOBJ["Color4"].InnerText)); } MO.Colors = colors.ToArray(); } Registar.Register(MO).GetComponent <BuildableObject>(); } } catch (Exception e) { LogException(e); } } } catch (Exception e) { LogException(e); } bundle.Unload(false); Debug.Log("Bundle Unloaded"); } } catch (Exception e) { LogException(e); } }
void Start() { string json1 = File.ReadAllText(Application.dataPath + "/Effects.json"); effect ef = JsonUtility.FromJson <effect>(json1); string enemyJson = File.ReadAllText(Application.dataPath + "/enemyToBattle.json"); enemyToBattle enemy = JsonUtility.FromJson <enemyToBattle>(enemyJson); switch (enemy.currentEnemyNr) { case "Enemy0": { gameObject.GetComponent <SpriteRenderer>().sprite = Enemy0; animator.SetInteger("EnemyNr", 0); ef.bonus0 = 10; ef.bonus1 = 0; ef.bonus2 = 0; ef.bonus3 = 0; ef.bonus4 = 0; ef.bonus5 = 0; string json2 = JsonUtility.ToJson(ef); File.WriteAllText(Application.dataPath + "/Effects.json", json2); } break; case "Enemy1": { gameObject.GetComponent <SpriteRenderer>().sprite = Enemy1; animator.SetInteger("EnemyNr", 1); ef.bonus0 = 0; ef.bonus1 = 10; ef.bonus2 = 0; ef.bonus3 = 0; ef.bonus4 = 0; ef.bonus5 = 0; } break; case "Enemy2": //boss1 { gameObject.GetComponent <SpriteRenderer>().sprite = Enemy2; animator.SetInteger("EnemyNr", 2); ef.bonus0 = 10; ef.bonus1 = 10; ef.bonus2 = 0; ef.bonus3 = 0; ef.bonus4 = 0; ef.bonus5 = 0; } break; case "Enemy3": { gameObject.GetComponent <SpriteRenderer>().sprite = Enemy3; animator.SetInteger("EnemyNr", 3); ef.bonus0 = 0; ef.bonus1 = 0; ef.bonus2 = 10; ef.bonus3 = 0; ef.bonus4 = 0; ef.bonus5 = 0; } break; case "Enemy4": { gameObject.GetComponent <SpriteRenderer>().sprite = Enemy4; animator.SetInteger("EnemyNr", 4); ef.bonus0 = 0; ef.bonus1 = 0; ef.bonus2 = 0; ef.bonus3 = 5; ef.bonus4 = 0; ef.bonus5 = 0; } break; case "Enemy5": //boss2 { gameObject.GetComponent <SpriteRenderer>().sprite = Enemy5; animator.SetInteger("EnemyNr", 5); ef.bonus0 = 0; ef.bonus1 = 0; ef.bonus2 = 10; ef.bonus3 = 5; ef.bonus4 = 0; ef.bonus5 = 0; } break; case "Enemy6": { gameObject.GetComponent <SpriteRenderer>().sprite = Enemy6; animator.SetInteger("EnemyNr", 6); ef.bonus0 = 0; ef.bonus1 = 0; ef.bonus2 = 0; ef.bonus3 = 0; ef.bonus4 = 1; ef.bonus5 = 0; } break; case "Enemy7": { gameObject.GetComponent <SpriteRenderer>().sprite = Enemy7; animator.SetInteger("EnemyNr", 7); ef.bonus0 = 0; ef.bonus1 = 0; ef.bonus2 = 0; ef.bonus3 = 0; ef.bonus4 = 0; ef.bonus5 = 10; } break; case "Enemy8": //boss3 { gameObject.GetComponent <SpriteRenderer>().sprite = Enemy8; animator.SetInteger("EnemyNr", 8); ef.bonus0 = 0; ef.bonus1 = 0; ef.bonus2 = 0; ef.bonus3 = 0; ef.bonus4 = 1; ef.bonus5 = 10; } break; case "Enemy9": //lastboss { gameObject.GetComponent <SpriteRenderer>().sprite = Enemy9; animator.SetInteger("EnemyNr", 9); ef.bonus0 = 0; ef.bonus1 = 10; ef.bonus2 = 0; ef.bonus3 = 5; ef.bonus4 = 1; ef.bonus5 = 0; } break; } string efbonus = JsonUtility.ToJson(ef); File.WriteAllText(Application.dataPath + "/Effects.json", efbonus); T = 0; moveToConsole = false; cam = Camera.main; moveTimer = 1.5f; moveNext = false; Cardridge1.SetActive(false); Cardridge2.SetActive(false); Cardridge3.SetActive(false); if (enemy.nextEnemyNr == 10) { endScript.EndScreen(); } }
protected void CreateMaterial(Color color, string textureName, string textureCoord, string material, out effect effectColor, out material materialColor) { string effect_ID = string.Format("effect_{0}_ID", material); string effectName = string.Format("effect_{0}", material); common_color_or_texture_type diffuseColorOrTexture = new common_color_or_texture_type(); if (string.IsNullOrEmpty(textureName)) { diffuseColorOrTexture.Item = new common_color_or_texture_typeColor() { Values = new double[] { (double)color.R / 255.0, (double)color.G / 255.0, (double)color.B / 255.0, 1.000000 } } } ; else { diffuseColorOrTexture.Item = new common_color_or_texture_typeTexture() { texture = "sampler_" + textureName, texcoord = textureCoord } }; effectFx_profile_abstractProfile_COMMON effectFx_prof = new effectFx_profile_abstractProfile_COMMON() { technique = new effectFx_profile_abstractProfile_COMMONTechnique() { Item = new effectFx_profile_abstractProfile_COMMONTechniquePhong() { ambient = new common_color_or_texture_type() { Item = new common_color_or_texture_typeColor() { Values = new double[] { 0.300000, 0.300000, 0.300000, 1.000000 } } }, emission = new common_color_or_texture_type() { Item = new common_color_or_texture_typeColor() { Values = new double[] { 0.050000, 0.050000, 0.050000, 1.000000 } } }, diffuse = diffuseColorOrTexture, specular = new common_color_or_texture_type() { Item = new common_color_or_texture_typeColor() { Values = new double[] { 0.500000, 0.500000, 0.500000, 1.000000 } } }, transparent = new common_transparent_type() { Item = new common_color_or_texture_typeColor() { Values = new double[] { 1.000000, 1.000000, 1.000000, 1.000000 } } }, reflectivity = new common_float_or_param_type() { Item = new common_float_or_param_typeFloat() { Value = 0.000000 } }, shininess = new common_float_or_param_type() { Item = new common_float_or_param_typeFloat() { Value = 25.00000 } }, transparency = new common_float_or_param_type() { Item = new common_float_or_param_typeFloat() { Value = 0.000000 } } } } }; if (!string.IsNullOrEmpty(textureName)) { effectFx_prof.Items = new object[] { new common_newparam_type() { sid = "surf_" + textureName, Item = new fx_surface_common() { type = fx_surface_type_enum.Item2D, init_from = new fx_surface_init_from_common[] { new fx_surface_init_from_common() { Value = textureName + ".jpg" } }, mipmap_generate = false, mipmap_generateSpecified = true }, ItemElementName = ItemChoiceType.surface }, new common_newparam_type() { sid = "sampler_" + textureName, Item = new fx_sampler2D_common() { source = "surf_" + textureName }, ItemElementName = ItemChoiceType.sampler2D } }; } // effect color effectColor = new effect() { id = string.Format("effect_{0}_ID", material), name = string.Format("effect_{0}", material), Items = new effectFx_profile_abstractProfile_COMMON[] { effectFx_prof } }; // materials materialColor = new material() { id = string.Format("material_{0}_ID", material), name = string.Format("material_{0}", material), instance_effect = new instance_effect() { url = string.Format("#{0}", effectColor.id) } }; }
public void desperatepower() { Vector3 pos = worldgen.maininfo.tinstance.transform.FindChild("camhook").FindChild("handskel").FindChild("root").FindChild("palm").transform.position; effect[] arreffect = new effect[]{new effect(6)}; arreffect[0].spellvamp = 0.25f; arreffect[0].speedmult = 1.5f; worldgen.maininfo.stats.AddEffectsLocal(arreffect, worldgen.maininfo.stats.photonid); GameObject game = (GameObject)Instantiate((GameObject)Resources.Load("parts/ryzeult"), pos, Quaternion.identity); game.transform.parent = worldgen.maininfo.tinstance.transform.FindChild("camhook").FindChild("handskel"); }