// Use this for initialization void Start() { isClose = false; mytext = GameObject.Find("message").GetComponent <Text>(); playerAtt = GameObject.Find("player").GetComponent <createAttri>().xia; button = GameObject.Find("back"); }
public void randomEquipment(int lvCap, gameChar ownedChar) //random setter with known lv and owner { eqName = "random equipment"; description = "random equipment"; eqtype = (eqType)(Random.Range(0, gameChar.wearingNum)); owner = ownedChar; lv = lvCap; int randNum = Random.Range(0, 100); // rand a number and distribute percentage if (randNum < 20) { rank = 1; } else if (randNum < 60) { rank = 2; } else if (randNum < 90) { rank = 3; } else { rank = 4; } for (int i = 0; i < rank; i++) { attribute attr = (attribute)(Random.Range(0, 5f)); float attrVal = (Random.Range(1, 10) * lv); attributePair[i] = new Pair <attribute, float>(attr, attrVal); } }
void Start() { //预设 bullet = (GameObject)Resources.Load("bull"); ray = (GameObject)Resources.Load("ray"); fire = (GameObject)Resources.Load("fire"); arrow = (GameObject)Resources.Load("arrow"); imaOne = GameObject.Find("skillOne").GetComponent <Image>(); imaTwo = GameObject.Find("skillTwo").GetComponent <Image>(); boxCollider = GetComponent <BoxCollider2D>(); circleCollider = GetComponent <CircleCollider2D>(); rig = GetComponent <Rigidbody2D>(); //获取主角刚体组件 ani = GetComponent <Animator>(); myAttri = GetComponent <createAttri>().xia; //引用对象 //设置角色数据 jumpSpeed = myAttri.JumpSpd; moveSpeed = myAttri.MoveSpd; fireSpd = myAttri.AtkSpd; fireCD = 1 / fireSpd; //设置技能限制 jumpCount = 1;//初始化跳跃次数 skillOneCD = 3f; skillTwoCD = 5f; }
void Start() { LV1Att = atControl.construct(atBuild); fsmSystem = new FSMSystem(this.gameObject); FSMBaseState bornState = new LV1BornState(fsmSystem); bornState.AddTransition(FSMTransition.LeavePlayer, FSMStateID.stayState); //巡逻状态,在构造参数传一个系统参数,确定该状态是在哪个状态系统中管理的,状态转换的时候调用 FSMBaseState stayState = new LV1StayState(fsmSystem); stayState.AddTransition(FSMTransition.SeePlayer, FSMStateID.attackState); stayState.AddTransition(FSMTransition.zeroHp, FSMStateID.death); //追逐状态 FSMBaseState attackState = new LV1AttackState(fsmSystem); attackState.AddTransition(FSMTransition.LeavePlayer, FSMStateID.stayState); attackState.AddTransition(FSMTransition.zeroHp, FSMStateID.death); FSMBaseState dieState = new LV1DieState(fsmSystem); fsmSystem.AddFSMState(bornState); fsmSystem.AddFSMState(stayState); fsmSystem.AddFSMState(attackState); fsmSystem.AddFSMState(dieState); }
public override void StateStart(GameObject gameObject) { monsterObj = gameObject; myAtt = monsterObj.GetComponent <bossThree>().bossThreeAt; myhp = myAtt.Hp; ani = gameObject.GetComponent <Animator>(); switch (monsterObj.name) { case "spider": name = ""; break; case "notebook": name = ""; break; case "dinosaur": name = "fireBall"; break; } barrage = (GameObject)Resources.Load(name); ani.Play("attack"); index = 0; a = 0; }
public async Task <ActionResult <attribute> > Postattribute(attribute attribute) { _context.attribute.Add(attribute); await _context.SaveChangesAsync(); return(CreatedAtAction("Getattribute", new { id = attribute.attribute_code }, attribute)); }
public void CreateSchemaTest() { var schema = new schema(); var globalAttr = new attribute(new topLevelAttribute() { name = "name" }); var globalEl = new element(new topLevelElement() { name = "anElement", complexType = new localComplexType() { attribute = { new attributeType() { @ref = new XmlQualifiedName("name") } } } }); schema.attribute.Add(globalAttr); schema.element.Add(globalEl); Assert.IsNotEmpty(schema.attribute); Assert.IsNotEmpty(schema.element); }
// initialiizes the type of card and attribute of the card void typeAtrributeInitialize() { int typeOfCardRandomizer = Random.Range(0, 2); int AttributeCardRandomizer = Random.Range(0, 2); switch (typeOfCardRandomizer) { case 0: typeOfThisCard = typeOfCard.Offense; damage = manacost * 5; break; case 1: typeOfThisCard = typeOfCard.Support; CCduration = manacost * 5; break; case 2: typeOfThisCard = typeOfCard.Defense; DefensivePower = manacost * 5; break; } switch (AttributeCardRandomizer) { case 0: AttributeOfThisCard = attribute.Demonic; break; case 1: AttributeOfThisCard = attribute.Holy; break; case 2: AttributeOfThisCard = attribute.Natural; break; } }
public async Task <IActionResult> Putattribute(string id, attribute attribute) { if (id != attribute.attribute_code) { return(BadRequest()); } _context.Entry(attribute).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!attributeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public override void StateStart(GameObject gameObject) { monsterObj = gameObject; ani = monsterObj.GetComponent <Animator>(); ani.Play("skillThree"); myAtt = monsterObj.GetComponent <bossThree>().bossThreeAt; }
public IEnumerator attribute_Test_dropGoods_WithEnumeratorPasses() { UnityEngine.SceneManagement.SceneManager.LoadScene("Untitled"); SetCharacter.istest = true; yield return(null); /// init GameObject GameObject enemy = SetCharacter.enemy; Assert.AreNotEqual(enemy, null); enemy.transform.position = new Vector3(12, 0, 15); enemy.transform.rotation = Quaternion.identity; /// init script test yield return(null); attribute testcs = enemy.GetComponent <attribute> (); Assert.IsTrue(testcs.ifAlive); /// test dropGood - coin testcs.DropGold = 100f; GameObject coin = testcs.dropGoods("coin"); Assert.NotNull(coin); Assert.NotNull(coin.GetComponent <pickGoods> ()); Assert.GreaterOrEqual(1e-5, Math.Abs(coin.GetComponent <pickGoods> ().value - testcs.DropGold)); SetCharacter.istest = false; }
virtual public void attribute(attribute ast, int indent) { visit(ast.name); if (ast.arguments != null) { Write("("); EmitargumentList(ast.arguments.args); if (ast.arguments.namedargs.Count > 0) { if (ast.arguments.args.Count > 0) { Write(", "); } for (int i = 0; i < ast.arguments.namedargs.Count; i++) { if (i > 0) { Write(", "); } Write("{0}=", ast.arguments.namedargs[i].id.str); visit(ast.arguments.namedargs[i].expr); } } Write(")"); } }
public IEnumerator attribute_Test_update_gold_WithEnumeratorPasses() { UnityEngine.SceneManagement.SceneManager.LoadScene("Untitled"); SetCharacter.istest = true; yield return(null); /// init GameObject GameObject enemy = SetCharacter.enemy; Assert.AreNotEqual(enemy, null); enemy.transform.position = new Vector3(12, 0, 15); enemy.transform.rotation = Quaternion.identity; /// init script test yield return(null); attribute testcs = enemy.GetComponent <attribute> (); Assert.IsTrue(testcs.ifAlive); /// test update_gold testcs.gold = 100f; testcs.update_gold(100f); Assert.GreaterOrEqual(1e-5, Math.Abs(testcs.gold - 200f)); testcs.update_gold(-3f); Assert.GreaterOrEqual(1e-5, Math.Abs(testcs.gold - 197f)); testcs.update_gold(-300f); Assert.GreaterOrEqual(1e-5, Math.Abs(testcs.gold)); SetCharacter.istest = false; }
private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.tag == "Player") { dialog = GameObject.Find("tipBack"); text = dialog.GetComponentInChildren <Text>(); if (this.gameObject.name == "point1") { } else if (this.gameObject.name == "point0") { attribute playAttri = collision.gameObject.GetComponent <createAttri>().xia; saveData.saveGame(new myData(playAttri, SceneManager.GetActiveScene().buildIndex + 1, "point1", 0f, SceneManager.GetActiveScene().buildIndex + 1), myData.user); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); } else { Vector2 ve = new Vector2(transform.position.x, transform.position.y + 1.1f); dialog.GetComponent <RectTransform>().position = Camera.main.WorldToScreenPoint(ve); text.text = "按E保存"; if (Input.GetKeyDown(KeyCode.E)) { attribute playAttri = collision.gameObject.GetComponent <createAttri>().xia; float t = GameObject.Find("timeText").GetComponent <timeCount>().t; myData mydata = new myData(playAttri, SceneManager.GetActiveScene().buildIndex + 1, this.gameObject.name, t, SceneManager.GetActiveScene().buildIndex + 1); saveData.saveGame(mydata, myData.user); } } } }
// init : if enter a new level public void InitFunction() { // dynamic binding enterWindow = transform.Find("EnterWindow").gameObject; message = enterWindow.transform.Find("Message").GetComponent <Text> (); axe_econ = transform.Find("/axe_econ").gameObject; Button_next_text = enterWindow.transform.Find("Button_next").transform.Find("Text").GetComponent <Text> (); Button_quit_text = enterWindow.transform.Find("Button_quit").transform.Find("Text").GetComponent <Text> (); enterWindow.SetActive(true); curIdx = 2; message.supportRichText = true; hero_value = axe_econ.GetComponent <attribute> (); // stop Time.timeScale = 0; // init main message message_1 = "\n<b><size=15> 2017年秋季学期 <color=yellow>软件工程</color> <color=red>喜迎十九大</color> 小组大作业:</size></b>" + "\n\n\n<b><size=25> 没有名字的多风格混合游戏 </size></b>" + "\n\n<b><size=15> 团队成员:付宏、叶豪、牟宏杰、武智源、慕思成</size></b>" + "\n<b><size=15> 源码地址:<color=blue>https://github.com/thufuhong/-</color></size></b>"; message_2 = "\n<b><size=15> <color=red>关卡:" + SceneManager.GetActiveScene().name + "</color> </size></b>" + "\n\n<b><size=15> " + hero_value.NiCheng + ",欢迎您进入了青青草原</size></b>" + "\n<b><size=15> 击败 <color=blue>boss(蓝色水晶)</color>是过关的充要条件</size></b>" + "\n<b><size=15> 击杀 <color=green>怪物(比你更好看的小人)</color>获得经验和金钱</size></b>" + "\n<b><size=15> <color=red>红色非安全区</color>里会受到持续伤害</size></b>"; message_3 = "<b><size=15> <color=red>操作说明</color> </size></b>" + "\n\n<b><size=15> <color=blue>↑ </color>键前进 </size></b>" + "\n<b><size=15> <color=blue> ←</color>,<color=blue>→ </color>键控制方向</size></b>" + "\n<b><size=15> <color=blue>Alt </color>键攻击</size></b>" + "\n<b><size=15> <color=blue>U </color>,<color=blue>I </color>,<color=blue>O </color>,<color=blue>P </color>释放技能</size></b>" + "\n<b><size=15> 技能和攻击有 CD</size></b>"; }
public ActionResult DeleteConfirmed(string id) { attribute attribute = db.attributes.Find(id); db.attributes.Remove(attribute); db.SaveChanges(); return(RedirectToAction("Index")); }
public myData(attribute playAttri, int sceneNum, string point, float playTime, int passNum) { this.playAttri = playAttri; this.sceneNum = sceneNum; this.point = point; this.playTime = playTime; this.passNum = passNum; }
private float item_cooldown = -1.0f; //ÄÚÖð´¼üÀäȴʱ¼ä0.5s£¬·ÀÖ¹Öظ´Åж¨ private void Start() { m_Animator = GetComponent <Animator>(); _attri = GetComponent <attribute>(); // get the third person character ( this should never be null due to require component ) m_Character = GetComponent <ThirdPersonCharacter>(); }
public void fireRight(GameObject player, float inputSpeed, float inputDamage, attribute inputAttribute) { projectileSpeed = inputSpeed; damage = inputDamage; myAttribute = inputAttribute; Vector2 launch = new Vector2(player.transform.position.x - this.transform.position.x, player.transform.position.y - this.transform.position.y).normalized * inputSpeed; myRigid.velocity = launch; }
public ArrayList read(string url) { ArrayList nodes = new ArrayList(); XmlTextReader reader = new XmlTextReader(url); xmlnode xm = new xmlnode(); xmlString = ""; while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: // Display beginning of element. xm.setName(reader.Name); xmlString = (xmlString + ("<" + reader.Name)); ArrayList attrs = new ArrayList(); if (reader.HasAttributes) { // If attributes exist while (reader.MoveToNextAttribute()) { attribute att = new attribute(); att.setName(reader.Name); xmlString = (xmlString + (" " + (reader.Name + ("=\'" + (reader.Value + "\'"))))); att.setValue(reader.Value); attrs.Add(att); } } xmlString += ">"; xm.setAttributes(attrs); break; case XmlNodeType.Text: xmlString = (xmlString + reader.Value); xm.setText(reader.Value); break; case XmlNodeType.CDATA: xmlString = (xmlString + ("<![CDATA[" + (reader.Value + "]]>"))); xm.setText(reader.Value); break; case XmlNodeType.EndElement: xmlString = (xmlString + ("</" + (reader.Name + ">"))); nodes.Add(xm); xm = new xmlnode(); break; } } return(nodes); }
// Use this for initialization void Start() { HPSlider = transform.Find("Slider").GetComponent <Slider> (); HPColor = HPSlider.fillRect.GetComponent <Image> (); parent = transform.parent.gameObject; HpValue = parent.GetComponent <attribute> (); // parent_height = (parent.GetComponent<MeshFilter>().mesh.bounds.size.y) * (parent.transform.lossyScale.y); parent_height = parent.GetComponent <CapsuleCollider>().bounds.size.y; HPColor.color = Color.green; }
public override void StateStart(GameObject myObject) { monsterObj = myObject; playerObj = GameObject.Find("player"); att = monsterObj.GetComponent <LV1>().LV1Att; ani = monsterObj.GetComponent <Animator>(); colli = playerObj.GetComponent <BoxCollider2D>(); //ani.Play("attck"); }
void Awake() { //构造 xia = at.construct(ab); myData mydata; mydata = loadData.loadPlayer(myData.user); xia = mydata.playAttri; point = GameObject.Find(mydata.point); }
public ActionResult EditAttributes([Bind(Include = "characterName,attributeName,attributeValue")] attribute attribute) { if (ModelState.IsValid) { //db.Entry(attribute).State = EntityState.Modified; //db.SaveChanges(); db.SaveEditAttribute(attribute); return(RedirectToAction("Index")); } return(View("EditAttribute", attribute)); }
public ActionResult Edit([Bind(Include = "characterName,attributeName,attributeValue")] attribute attribute) { if (ModelState.IsValid) { db.Entry(attribute).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.characterName = new SelectList(db.characters, "character_name", "campaign", attribute.characterName); return(View(attribute)); }
private attribute ExportAttribute(TemplateConstraint constraint) { IFormattedConstraint formattedConstraint = FormattedConstraintFactory.NewFormattedConstraint(this.tdb, this.igSettings, constraint, null, null, false, false, false, false); attribute constraintAttribute = new attribute(); constraintAttribute.name = constraint.Context.Substring(1); constraintAttribute.isOptional = constraint.Conformance != "SHALL"; constraintAttribute.Items = this.ExportConstraints(constraint, true); return(constraintAttribute); }
public Status AzercellVeify(long mobile, string pass, long payMobile) { Status status = new Status(); try { DbSelect select = new DbSelect(Configuration, _hostingEnvironment); if (select.getUserIdByMobile(mobile, pass) > 0 && payMobile.ToString().Length == 9) { DateTime now = DateTime.Now; string smsXML = @$ "<request point=" "3587" "> <advanced function=" "check" " service=" "418" "> <attribute name=" "id1" " value=" "{payMobile}" "/></advanced > </request>"; KeyManager.SetKeyPath($"{_hostingEnvironment.ContentRootPath}/wwwroot/private.pem"); string certificate = KeyManager.GenerateSignature(smsXML, Encoding.UTF8); var smsContent = new StringContent(smsXML, Encoding.UTF8, "text/xml"); //smsContent.Headers.ContentType = MediaTypeHeaderValue.Parse("text/xml"); string smsUrl = $"https://test.smartpay.az/external/extended"; HttpClient smsClient = new HttpClient(); smsClient.DefaultRequestHeaders.Add("paylogic-signature", certificate); var smsRslt = smsClient.PostAsync(smsUrl, smsContent).Result; var smsResp = smsRslt.Content.ReadAsStringAsync().Result; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(smsResp); XmlNodeList parentNode = xmlDoc.GetElementsByTagName("result"); foreach (XmlNode childrenNode in parentNode) { status.response = Convert.ToInt32(childrenNode.Attributes["service"].Value); } if (status.response > 1) { status.response = 3; // smartpay error } } else { status.response = 2;//access danied } } catch { status.response = 3; // error } return(status); }
/// <summary> /// Sends Damage from one DamageableObject to another DamageableObject /// </summary> /// <param name="damageSender">DamageableObject that is sending the damage</param> /// <param name="damageTo">DamageableObject that is receiving the damage</param> /// <param name="damageType">The type of damage that is being taken</param> /// <param name="damageDone">The amount of damage that is being sent</param> /// <param name="bIsStun">Is this damage going to stun the receiver</param> public void SendDamage(GameObject damageSender, DamageableObject damageTo, attribute damageType, float damageDone, bool bIsStun) { // Checks whether we're strong, neutral or weak against the attack's attribute. /* If we're stronger. Eg: We're Holy (0) and the attack is Demonic (1), or we're Natural (2) and the attack is Holy (0). */ if (damageTo.MyAttribute - damageType == -1 || damageTo.MyAttribute - damageType == 2) { // Halve damage. damageDone = damageDone / 2; } // If we're weaker. else if (damageTo.MyAttribute - damageType == 1 || damageTo.MyAttribute - damageType == -2) { // Double damage. damageDone = damageDone * 2; } // If we're the same. else { } damageTo.Health -= damageDone; if(damageTo.gameObject.tag != "Player") { Rigidbody2D body = damageTo.gameObject.GetComponent<Rigidbody2D>(); if(body) { if (damageSender.transform.position.x < damageTo.gameObject.transform.position.x) { body.AddForce((Vector2.up + Vector2.right) * 250.0f); } else { body.AddForce((Vector2.up - Vector2.right) * 250.0f); } } } if (bIsStun) { damageTo.bIsStunned = true; } if (!damageTo.bIsDamaged) { StartCoroutine(damageTo.CODamageCooldown()); } }
public void showAtt(attribute att) { if (a != null) { StopCoroutine(a); } rect.anchoredPosition = new Vector2(rect.anchoredPosition.x, 220); image.fillAmount = (float)att.Hp / att.MaxHp; this.amount = image.fillAmount; a = StartCoroutine(timeDown()); }
private void Start() { agent = GetComponentInChildren <UnityEngine.AI.NavMeshAgent>(); character = GetComponent <ThirdPersonCharacter>(); m_Animator = GetComponent <Animator>(); _attri = GetComponent <attribute>(); agent.updateRotation = true; agent.updatePosition = true; original_position = transform.position; stopping_distance = agent.stoppingDistance; }
public IEnumerator attribute_Test_rw_file_WithEnumeratorPasses() { UnityEngine.SceneManagement.SceneManager.LoadScene("Untitled"); SetCharacter.istest = true; yield return(null); /// init GameObject GameObject hero = SetCharacter.hero; Assert.AreNotEqual(hero, null); hero.transform.position = new Vector3(12, 0, 15); hero.transform.rotation = Quaternion.identity; /// init script test yield return(null); attribute testcs = hero.GetComponent <attribute> (); Assert.IsTrue(testcs.ifAlive); /// test SaveAttributeInFile /// test ReadAttributeFromFile testcs.gold = 99999f; testcs.SaveAttributeInFile(); testcs.gold = 0f; Assert.GreaterOrEqual(1e-5, Math.Abs(testcs.gold - 0f)); testcs.ReadAttributeFromFile(); Assert.GreaterOrEqual(1e-5, Math.Abs(testcs.gold - 99999f)); /// test GetLevelOfPlayerFromFile /// test GetGoldOfPlayerFromFile /// test GetTypeOfPlayerFromFile /// test GetLevelOfGameFromFile testcs.Level = 99999f; testcs.gold = 99999f; testcs.ZhiYe = "xx"; testcs.level_num = 99999; testcs.SaveAttributeInFile(); testcs.Level = 0f; testcs.gold = 0f; testcs.ZhiYe = "000"; testcs.level_num = 0; Assert.GreaterOrEqual(1e-5, Math.Abs(testcs.GetLevelOfPlayerFromFile() - 99999)); Assert.GreaterOrEqual(1e-5, Math.Abs(testcs.GetGoldOfPlayerFromFile() - 99999)); Assert.IsTrue("xx".Equals(testcs.GetTypeOfPlayerFromFile())); Assert.GreaterOrEqual(1e-5, Math.Abs(testcs.GetLevelOfGameFromFile() - 99999)); /// init testcs.AttributeInit(); /// cover testcs.SaveAttributeInFile(); SetCharacter.istest = false; }
private static void AssertAttributesEquivalent(attribute attribute, IEnumerable <attribute> expected) { var match = expected.Single(a => a.name == attribute.name); if (AssertNullEquivalent(attribute.present, match.present)) { Assert.That(attribute.present.xml, Is.EqualTo(match.present.xml)); } AssertFiltersEquivalent(attribute.filter_attributes, match.filter_attributes); AssertSortEquivalent(attribute.sort_attributes, match.sort_attributes); AssertSearchEquivalent(attribute.search_attributes, match.search_attributes); }
public void EditAttributesInvalidAttribute() { // arrange attribute invalidAttribute = new attribute(); // act controller.ModelState.AddModelError("Cannot create", "create exception"); ViewResult result = (ViewResult)controller.EditAttributes(invalidAttribute); // assert Assert.AreEqual("EditAttribute", result.ViewName); }
public virtual void visit(attribute _attribute) { DefaultVisit(_attribute); }
public void AssignNewValue(Cmdlet myCmdlet, attributeSchema prop, card so, object newValue) { if (newValue == null) { return; } // Hacky Workaround var lists = so.attributeList != null ? so.attributeList.ToList() : new List<attribute>(); myCmdlet.WriteVerbose("Want to set " + prop.name + " to " + newValue.ToString()); var dict = lists.ToDictionary(key => key.name, value => value); var as1 = new attribute{ name = prop.name}; switch (prop.type) { case "DATE": string valtoset = newValue != null ? newValue.ToString() : null; if (!string.IsNullOrEmpty(valtoset)) { try { myCmdlet.WriteVerbose("DATE: Convert string to DateTimeObject"); DateTime xd = DateTime.Parse(valtoset.ToString(), CultureInfo.CurrentCulture); as1.value = xd.ToString("yyyy-MM-ddThh:mm:ssZ"); } catch (Exception e) { myCmdlet.WriteWarning(e.Message); } } break; case "TIMESTAMP": string datetimetoset = newValue != null ? newValue.ToString() : null; if (!string.IsNullOrEmpty(datetimetoset)) { try { myCmdlet.WriteVerbose("TIMESTAMP: Convert string to DateTimeObject -> _" + datetimetoset.ToString() +"_"); DateTime xd = DateTime.Parse(datetimetoset.ToString(), CultureInfo.CurrentCulture); as1.value = xd.ToString("yyyy-MM-ddThh:mm:ssZ"); } catch (Exception e) { myCmdlet.WriteWarning(e.Message); } } break; case "REFERENCE": if (prop.referencedIdClassSpecified && newValue.ToString().Length > 0) { int codeint = 0; int.TryParse(newValue.ToString(), out codeint); if (codeint == 0) { myCmdlet.WriteVerbose("Try it with Workaround Parent Class: " + prop.referencedClassName); int tmpvalue = 0; var parentclass = _clientconnection.getAttributeList(prop.referencedClassName); foreach (attributeSchema attributeschema in parentclass) { if (attributeschema.name == as1.name) { string newclassname = attributeschema.referencedClassName; myCmdlet.WriteVerbose("Try it with Fulltext search classname: " + newclassname); tmpvalue = GetCardbyCode(newclassname, newValue.ToString()); if (tmpvalue == 0) { myCmdlet.WriteWarning("Reference Card not found: " + newValue.ToString()); dict.Remove(as1.name); } else { myCmdlet.WriteVerbose("Card found: " + tmpvalue); newValue = tmpvalue; } break; } } if (tmpvalue == 0) { myCmdlet.WriteVerbose("Fulltext search ReferenceCard: " + newValue.ToString()); myCmdlet.WriteVerbose("Fulltext search classname: " + prop.referencedClassName); tmpvalue = GetCardbyCode(prop.referencedClassName, newValue.ToString()); newValue = tmpvalue; } else { myCmdlet.WriteVerbose("Card found Set to Value: " + tmpvalue); newValue = tmpvalue; } } else { //myCmdlet.WriteVerbose("Check if ReferenceCard exists: " + codeint); //var check = _clientconnection.getCard(prop.referencedClassName, codeint, null); //if (check == null) //{ // myCmdlet.WriteWarning("Reference Card not found: " + codeint); // dict.Remove(as1.name); //} } as1.value = newValue.ToString(); } break; default: as1.value = newValue != null ? newValue.ToString() : null; break; } if (dict.ContainsKey(as1.name)) { dict[as1.name] = as1; } else { dict.Add(as1.name, as1); } so.attributeList = dict.Values.ToArray(); }
public override void visit(attribute _attribute) { executer.visit(_attribute); if (_attribute.qualifier != null) this.visit((dynamic)_attribute.qualifier); if (_attribute.type != null) this.visit((dynamic)_attribute.type); if (_attribute.arguments != null) this.visit((dynamic)_attribute.arguments); }
/// <summary> /// ユーザーデータキーの通知 /// </summary> /// <param name="part"></param> /// <param name="message"></param> public void NotifyUserData( SpritePart part, attribute.UserDataNotifier.UserData data ) { if ( OnUserData != null ) { OnUserData( this, part, data ); } }
public override void visit(attribute _attribute) { DefaultVisit(_attribute); pre_do_visit(_attribute); visit(attribute.qualifier); visit(attribute.type); visit(attribute.arguments); post_do_visit(_attribute); }
public virtual void post_do_visit(attribute _attribute) { }
public static PlayerCharacter Load(string filename) { PlayerCharacter pc = new PlayerCharacter(); XmlDocument doc = new XmlDocument(); doc.Load(filename); //Get Character Details XmlNodeList details = doc.SelectNodes("//Details"); foreach (XmlNode item in details) { pc.CombatantName = item["name"].InnerText.Trim(); } //Get Powers List XmlNodeList powers = doc.SelectNodes("//PowerStats/Power"); foreach (XmlNode item in powers) { power p = new power(); p.name = item.Attributes["name"].InnerText.Trim(); XmlNodeList spec = item.SelectNodes("specific"); foreach (XmlNode note in spec) { if (note.Attributes["name"].InnerText == "Power Usage") { switch (note.InnerText.Trim()) { case "At-Will": p.PowerUsage = power.PowerUsageType.ATWILL; break; case "Encounter": case "Encounter (Special)": p.PowerUsage = power.PowerUsageType.ENCOUNTER; break; case "Daily": p.PowerUsage = power.PowerUsageType.DAILY; break; default: throw new NotImplementedException(note.InnerText.Trim()); } } if (note.Attributes["name"].InnerText == "Action Type") { switch (note.InnerText.Trim().ToLower()) { case "standard action": p.action = ActionType.STANDARD; break; case "minor action": p.action = ActionType.MINOR; break; case "move action": p.action = ActionType.MOVE; break; case "immediate interrupt": p.action = ActionType.INTERRUPT; break; case "immediate reaction": p.action = ActionType.REACTION; break; default: throw new NotImplementedException(note.InnerText.Trim()); } } } pc.Powers.Add(p); } //Get Race and Class XmlNodeList rules = doc.SelectNodes ("//CharacterSheet/RulesElementTally/RulesElement"); foreach (XmlNode rule in rules) { if (rule.Attributes["type"].InnerText == "Race") pc.PlayerRace = rule.Attributes["name"].InnerText; if (rule.Attributes["type"].InnerText == "Class") pc.PlayerClass = rule.Attributes["name"].InnerText; } //Get Stat Block XmlNodeList Stats = doc.SelectNodes("//CharacterSheet/StatBlock/Stat"); foreach (XmlNode stat in Stats) { attribute a = new attribute(); a.value = int.Parse(stat.Attributes["value"].InnerText); foreach (XmlNode alias in stat.SelectNodes("alias")) a.alias.Add(alias.Attributes["name"].InnerText); pc.attList.Add(a); } foreach (attribute item in pc.attList) { if (item.att_name == "Hit Points") { pc.MaxHP = item.value; pc.CurrentHP = item.value; } if (item.att_name == "Healing Surges") { pc.MaxHealingSurges = item.value; pc.CurrentHealingSurges = item.value; } } doc = null; return pc; }
/// <summary> /// 追加 /// </summary> /// <param name="attribute"></param> public void Add( attribute.AttributeBase attribute ) { attributes_.Add( attribute ); }
public void removeLastingEffectFor(attribute attr, string id) { attributes[(int)attr].remove_lastingEffect(id); }
public Attribute getChangesFor(attribute attr) { return attributes[(int)attr].compileEffects(); }
public void addTimedEffectFor(attribute attr, string effect, GameObject target) { attributes[(int)attr].add_timedEffect(timedEffects[effect](target)); }
public void addLastingEffectFor(attribute attr, string effect, GameObject target) { attributes[(int)attr].add_lastingEffect(lastingEffects[effect](target)); }
public virtual void visit(attribute _attribute) { }
public void crowdControl (GameObject source, float manaCost, attribute attackType) { // This will be used in Holy or Demonic crowd control. Vector2 toSource = source.transform.position - this.transform.position; bool stronger, weaker; // If we're weaker. if (MyAttribute - attackType == -1 || MyAttribute - attackType == 2) { weaker = true; stronger = false; } // If we're stronger. else if (MyAttribute - attackType == 1 || MyAttribute - attackType == -2) { weaker = false; stronger = true; } // If we're the same type. else { weaker = false; stronger = false; } // If we're already crowd controlled, or we're outside it's range of influence, never mind. if (crowdControlled) { } // If it's Holy crowd control else if (attackType == attribute.Holy) { // Adjusts the mana cost based on wether we have the attribute advantage or not. // The mana cost is used as a scalar for the cc effects. if (stronger) { manaCost = manaCost / 2; } else if (weaker) { manaCost = manaCost * 2; } else { } // We get a vector away from the Holy CC, scaled by the pushPullScalar and the mana cost. toSource = -toSource.normalized * pushPullScalar * manaCost; // We then add a force equal to this vector to ourselves, shoving ourselves away. myRigid.AddForce(toSource); // We start our crowd control cooldown. StartCoroutine(crowdControlling(source)); } // If it's Demonic crowd control else if (attackType == attribute.Demonic) { // Adjusts the mana cost based on wether we have the attribute advantage or not. // The mana cost is used as a scalar for the cc effects. if (stronger) { manaCost = manaCost / 2; } else if (weaker) { manaCost = manaCost * 2; } else { } // We get a vector towards the Demonic CC, scaled by the pushPullScalar and the mana cost. toSource = toSource.normalized * pushPullScalar * manaCost; // We then add a force equal to this vector to ourselves, pulling ourselves in. myRigid.AddForce(toSource); // We start our crowd control cooldown. StartCoroutine(crowdControlling(source)); StartCoroutine(blackHole(source.transform.position, toSource.magnitude)); } // If it's Natural crowd control else if (attackType == attribute.Natural) { // Adjusts the mana cost based on wether we have the attribute advantage or not. // The mana cost is used as a scalar for the cc effects. if (stronger) { manaCost = manaCost / 2; } else if (weaker) { manaCost = manaCost * 2; } else { } // We start our crowd control cooldown. StartCoroutine(crowdControlling(source)); // We start our slow timer StartCoroutine(slow(manaCost * slowScalar, source)); } }