public void CalculateStatLv(GameObject pet) { StatusC stat = pet.GetComponent <StatusC>(); //[min_stat*(max_lv-lv)/(max_lv- 1)] + [max_stat*(lv- 1)/(max_lv- 1)] //Atk min = minStatus.atk * (maxLevel - currentLv) / (maxLevel - 1); max = maxStatus.atk * (currentLv - 1) / (maxLevel - 1); stat.atk = min + max; //Def min = minStatus.def * (maxLevel - currentLv) / (maxLevel - 1); max = maxStatus.def * (currentLv - 1) / (maxLevel - 1); stat.def = min + max; //Matk min = minStatus.matk * (maxLevel - currentLv) / (maxLevel - 1); max = maxStatus.matk * (currentLv - 1) / (maxLevel - 1); stat.matk = min + max; //Mdef min = minStatus.mdef * (maxLevel - currentLv) / (maxLevel - 1); max = maxStatus.mdef * (currentLv - 1) / (maxLevel - 1); stat.mdef = min + max; //HP min = minStatus.maxHealth * (maxLevel - currentLv) / (maxLevel - 1); max = maxStatus.maxHealth * (currentLv - 1) / (maxLevel - 1); stat.maxHealth = min + max; stat.health = stat.maxHealth; //MP min = minStatus.maxMana * (maxLevel - currentLv) / (maxLevel - 1); max = maxStatus.maxMana * (currentLv - 1) / (maxLevel - 1); stat.maxMana = min + max; stat.mana = stat.maxMana; }
void Update() { StatusC stat = GetComponent <StatusC>(); if (freeze || atkDelay || Time.timeScale == 0.0f || stat.freeze || GlobalConditionC.freezeAll || GlobalConditionC.freezePlayer) { return; } CharacterController controller = GetComponent <CharacterController>(); if (flinch) { controller.Move(knock * 6 * Time.deltaTime); return; } if (meleefwd) { Vector3 lui = transform.TransformDirection(Vector3.forward); controller.Move(lui * 5 * Time.deltaTime); } if (aimingType == AimType.Raycast) { Aiming(); } else { attackPoint.transform.rotation = Maincam.GetComponent <ARPGcameraC>().aim; } if (Input.GetButton("Fire1") && Time.time > nextFire && !isCasting) { if (Time.time > (nextFire + 0.5f)) { c = 0; } //连招 if (attackCombo.Length >= 1) { conCombo++; StartCoroutine(AttackCombo()); } } //魔法 if (Input.GetButtonDown("Fire2") && Time.time > nextFire && !isCasting && skill[skillEquip].skillPrefab && !stat.silence) { StartCoroutine(MagicSkill(skillEquip)); } if (Input.GetKeyDown("1") && !isCasting && skill[0].skillPrefab) { skillEquip = 0; } if (Input.GetKeyDown("2") && !isCasting && skill[1].skillPrefab) { skillEquip = 1; } if (Input.GetKeyDown("3") && !isCasting && skill[2].skillPrefab) { skillEquip = 2; } }
void OnGUI() { StatusC stat = GetComponent <StatusC>(); if (show) { windowRect = GUI.Window(0, windowRect, StatWindow, "Status"); } //Show Buffs Icon if (stat.brave) { GUI.DrawTexture(new Rect(360, 50, 40, 40), braveIcon); } if (stat.barrier) { GUI.DrawTexture(new Rect(400, 50, 40, 40), barrierIcon); } if (stat.faith) { GUI.DrawTexture(new Rect(440, 50, 40, 40), faithIcon); } if (stat.mbarrier) { GUI.DrawTexture(new Rect(480, 50, 40, 40), magicBarrierIcon); } }
void OnGUI() { StatusC stat = GetComponent <StatusC>(); GUI.skin = skin; if (show) { windowRect = GUI.Window(0, windowRect, StatWindow, "Status"); } //Show Buffs Icon if (stat.brave) { GUI.DrawTexture(new Rect(30, 200, 60, 60), braveIcon); } if (stat.barrier) { GUI.DrawTexture(new Rect(30, 260, 60, 60), barrierIcon); } if (stat.faith) { GUI.DrawTexture(new Rect(30, 320, 60, 60), faithIcon); } if (stat.mbarrier) { GUI.DrawTexture(new Rect(30, 380, 60, 60), magicBarrierIcon); } }
// Token: 0x06000481 RID: 1153 RVA: 0x000229FC File Offset: 0x00020DFC private void OnGUI() { StatusC component = base.GetComponent <StatusC>(); GUI.skin = this.skin; if (this.show) { this.windowRect = GUI.Window(0, this.windowRect, new GUI.WindowFunction(this.StatWindow), "Status"); } if (component.brave) { GUI.DrawTexture(new Rect(30f, 200f, 60f, 60f), this.braveIcon); } if (component.barrier) { GUI.DrawTexture(new Rect(30f, 260f, 60f, 60f), this.barrierIcon); } if (component.faith) { GUI.DrawTexture(new Rect(30f, 320f, 60f, 60f), this.faithIcon); } if (component.mbarrier) { GUI.DrawTexture(new Rect(30f, 380f, 60f, 60f), this.magicBarrierIcon); } }
void StatWindow ( int windowID ){ StatusC stat = GetComponent<StatusC>(); GUI.Label(new Rect(20, 40, 100, 50), "Level" , textStyle); GUI.Label(new Rect(20, 70, 100, 50), "STR" , textStyle); GUI.Label(new Rect(20, 100, 100, 50), "DEF" , textStyle); GUI.Label(new Rect(20, 130, 100, 50), "MATK" , textStyle); GUI.Label(new Rect(20, 160, 100, 50), "MDEF" , textStyle); GUI.Label(new Rect(20, 220, 100, 50), "EXP" , textStyle); GUI.Label(new Rect(20, 250, 100, 50), "Next LV" , textStyle); GUI.Label(new Rect(20, 280, 120, 50), "Status Point" , textStyle); if (GUI.Button ( new Rect(200,5,30,30), "X")) { OnOffMenu(); } int lv = stat.level; int atk = stat.atk; int def = stat.def; int matk = stat.matk; int mdef = stat.mdef; int exp = stat.exp; int next = stat.maxExp - exp; int stPoint = stat.statusPoint; GUI.Label(new Rect(30, 40, 100, 50), lv.ToString() , textStyle2); GUI.Label(new Rect(70, 70, 100, 50), atk.ToString() , textStyle2); GUI.Label(new Rect(70, 100, 100, 50), def.ToString() , textStyle2); GUI.Label(new Rect(70, 130, 100, 50), matk.ToString() , textStyle2); GUI.Label(new Rect(70, 160, 100, 50), mdef.ToString() , textStyle2); GUI.Label(new Rect(95, 220, 100, 50), exp.ToString() , textStyle2); GUI.Label(new Rect(95, 250, 100, 50), next.ToString() , textStyle2); GUI.Label(new Rect(95, 280, 100, 50), stPoint.ToString() , textStyle2); if(stPoint > 0){ if (GUI.Button ( new Rect(200,70,25,25), "+") && stPoint > 0) { GetComponent<StatusC>().atk += 1; GetComponent<StatusC>().statusPoint -= 1; GetComponent<StatusC>().CalculateStatus(); } if (GUI.Button ( new Rect(200,100,25,25), "+") && stPoint > 0) { GetComponent<StatusC>().def += 1; GetComponent<StatusC>().maxHealth += 5; GetComponent<StatusC>().statusPoint -= 1; GetComponent<StatusC>().CalculateStatus(); } if (GUI.Button ( new Rect(200,130,25,25), "+") && stPoint > 0) { GetComponent<StatusC>().matk += 1; GetComponent<StatusC>().maxMana += 3; GetComponent<StatusC>().statusPoint -= 1; GetComponent<StatusC>().CalculateStatus(); } if (GUI.Button ( new Rect(200,160,25,25), "+") && stPoint > 0) { GetComponent<StatusC>().mdef += 1; GetComponent<StatusC>().statusPoint -= 1; GetComponent<StatusC>().CalculateStatus(); } } GUI.DragWindow (new Rect (0,0,10000,10000)); }
// Update is called once per frame void Update() { StatusC stat = GetComponent <StatusC>(); float moveHorizontal = 0.0f; float moveVertical = 0.0f; if (stat.freeze || stat.flinch) { motor.inputMoveDirection = new Vector3(0, 0, 0); return; } if (Input.GetButton("Horizontal") || Input.GetButton("Vertical")) { moveHorizontal = Input.GetAxis("Horizontal"); moveVertical = Input.GetAxis("Vertical"); } else if (joyStick) { moveHorizontal = joyStick.GetComponent <MobileJoyStickC>().position.x; moveVertical = joyStick.GetComponent <MobileJoyStickC>().position.y; } // Get the input vector from kayboard or analog stick Vector3 directionVector = new Vector3(moveHorizontal, 0, moveVertical); //Vector3 directionVector = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); if (directionVector != Vector3.zero) { // Get the length of the directon vector and then normalize it // Dividing by the length is cheaper than normalizing when we already have the length anyway float directionLength = directionVector.magnitude; directionVector = directionVector / directionLength; // Make sure the length is no bigger than 1 directionLength = Mathf.Min(1, directionLength); // Make the input vector more sensitive towards the extremes and less sensitive in the middle // This makes it easier to control slow speeds when using analog sticks directionLength = directionLength * directionLength; // Multiply the normalized direction vector by the modified length directionVector = directionVector * directionLength; } if (moveHorizontal != 0 || moveVertical != 0) { transform.eulerAngles = new Vector3(transform.eulerAngles.x, Mathf.Atan2(moveHorizontal, moveVertical) * Mathf.Rad2Deg, transform.eulerAngles.z); } //----------------------------------------------------------------------------- if (moveVertical != 0 && walkingSound && !GetComponent <AudioSource>().isPlaying || moveHorizontal != 0 && walkingSound && !GetComponent <AudioSource>().isPlaying) { GetComponent <AudioSource>().clip = walkingSound; GetComponent <AudioSource>().Play(); } motor.inputMoveDirection = new Vector3(moveHorizontal, 0, moveVertical); motor.inputJump = Input.GetButton("Jump"); }
void Update() { StatusC stat = GetComponent <StatusC>(); if (freeze || atkDelay || Time.timeScale == 0.0f || stat.freeze) { return; } CharacterController controller = GetComponent <CharacterController>(); if (flinch) { controller.Move(knock * 6 * Time.deltaTime); return; } if (meleefwd) { Vector3 lui = transform.TransformDirection(Vector3.forward); controller.Move(lui * 5 * Time.deltaTime); } attackPoint.transform.rotation = Maincam.GetComponent <ARPGcameraC>().aim; //---------------------------- //Normal Trigger if (Input.GetButton("Fire1") && Time.time > nextFire && !isCasting) { if (Time.time > (nextFire + 0.5f)) { c = 0; } //Attack Combo if (attackCombo.Length >= 1) { conCombo++; //AttackCombo(); StartCoroutine(AttackCombo()); } } //Magic if (Input.GetButtonDown("Fire2") && Time.time > nextFire && !isCasting && skillPrefab[skillEquip] && !stat.silence) { //MagicSkill(skillEquip); StartCoroutine(MagicSkill(skillEquip)); } if (Input.GetKeyDown("1") && !isCasting && skillPrefab[0]) { skillEquip = 0; } if (Input.GetKeyDown("2") && !isCasting && skillPrefab[1]) { skillEquip = 1; } if (Input.GetKeyDown("3") && !isCasting && skillPrefab[2]) { skillEquip = 2; } }
public void Activator() { StatusC stat = GetComponent <StatusC>(); //if(!actvateObj || actvateMsg == ""){ if (!actvateObj || actvateMsg == "" || stat.freeze) { return; } actvateObj.SendMessage(actvateMsg, SendMessageOptions.DontRequireReceiver); }
void SettingEquipmentStatus() { ItemDataC dataItem = database.GetComponent <ItemDataC>(); StatusC stat = GetComponent <StatusC>(); //Reset Power of Current Weapon & Armor //Set New Variable of Weapon stat.weaponAtk = dataItem.equipment[weaponEquip].attack; stat.addDef = dataItem.equipment[weaponEquip].defense; stat.weaponMatk = dataItem.equipment[weaponEquip].magicAttack; stat.addMdef = dataItem.equipment[weaponEquip].magicDefense; stat.addHP = dataItem.equipment[weaponEquip].hpBonus; stat.addMP = dataItem.equipment[weaponEquip].mpBonus; //Set New Variable of Armor stat.weaponAtk += dataItem.equipment[armorEquip].attack; stat.addDef += dataItem.equipment[armorEquip].defense; stat.weaponMatk += dataItem.equipment[armorEquip].magicAttack; stat.addMdef += dataItem.equipment[armorEquip].magicDefense; stat.addHP += dataItem.equipment[armorEquip].hpBonus; stat.addMP += dataItem.equipment[armorEquip].mpBonus; //Set New Variable of Accessory stat.weaponAtk += dataItem.equipment[accessoryEquip].attack; stat.addDef += dataItem.equipment[accessoryEquip].defense; stat.weaponMatk += dataItem.equipment[accessoryEquip].magicAttack; stat.addMdef += dataItem.equipment[accessoryEquip].magicDefense; stat.addHP += dataItem.equipment[accessoryEquip].hpBonus; stat.addMP += dataItem.equipment[accessoryEquip].mpBonus; //Status Resist stat.eqResist.poisonResist = dataItem.equipment[weaponEquip].statusResist.poisonResist + dataItem.equipment[armorEquip].statusResist.poisonResist + dataItem.equipment[accessoryEquip].statusResist.poisonResist; stat.eqResist.stunResist = dataItem.equipment[weaponEquip].statusResist.stunResist + dataItem.equipment[armorEquip].statusResist.stunResist + dataItem.equipment[accessoryEquip].statusResist.stunResist; stat.eqResist.silenceResist = dataItem.equipment[weaponEquip].statusResist.silenceResist + dataItem.equipment[armorEquip].statusResist.silenceResist + dataItem.equipment[accessoryEquip].statusResist.silenceResist; stat.eqResist.webResist = dataItem.equipment[weaponEquip].statusResist.webResist + dataItem.equipment[armorEquip].statusResist.webResist + dataItem.equipment[accessoryEquip].statusResist.webResist; stat.hiddenStatus.doubleJump = false; if (dataItem.equipment[weaponEquip].canDoubleJump) { stat.hiddenStatus.doubleJump = true; } if (dataItem.equipment[armorEquip].canDoubleJump) { stat.hiddenStatus.doubleJump = true; } if (dataItem.equipment[accessoryEquip].canDoubleJump) { stat.hiddenStatus.doubleJump = true; } stat.hiddenStatus.autoGuard = dataItem.equipment[weaponEquip].autoGuard + dataItem.equipment[armorEquip].autoGuard + dataItem.equipment[accessoryEquip].autoGuard; stat.hiddenStatus.drainTouch = dataItem.equipment[weaponEquip].drainTouch + dataItem.equipment[armorEquip].drainTouch + dataItem.equipment[accessoryEquip].drainTouch; stat.hiddenStatus.mpReduce = dataItem.equipment[weaponEquip].mpReduce + dataItem.equipment[armorEquip].mpReduce + dataItem.equipment[accessoryEquip].mpReduce; stat.CalculateStatus(); }
void OnGUI() { if (aimingType == AimType.Normal) { GUI.DrawTexture(new Rect(Screen.width / 2 - 16, Screen.height / 2 - 90, aimIconSize, aimIconSize), aimIcon); } if (aimingType == AimType.Raycast) { GUI.DrawTexture(new Rect(Screen.width / 2 - 20, Screen.height / 2 - 20, 40, 40), aimIcon); } if (drawGUI) { if (skill[skillEquip].skillPrefab && skill[skillEquip].icon) { GUI.DrawTexture(new Rect(Screen.width - skillIconSize - 28, Screen.height - skillIconSize - 20, skillIconSize, skillIconSize), skill[skillEquip].icon); } if (skill[0].skillPrefab && skill[0].icon) { GUI.DrawTexture(new Rect(Screen.width - skillIconSize - 50, Screen.height - skillIconSize - 50, skillIconSize / 2, skillIconSize / 2), skill[0].icon); } if (skill[1].skillPrefab && skill[1].icon) { GUI.DrawTexture(new Rect(Screen.width - skillIconSize - 10, Screen.height - skillIconSize - 60, skillIconSize / 2, skillIconSize / 2), skill[1].icon); } if (skill[2].skillPrefab && skill[2].icon) { GUI.DrawTexture(new Rect(Screen.width - skillIconSize + 30, Screen.height - skillIconSize - 50, skillIconSize / 2, skillIconSize / 2), skill[2].icon); } } StatusC stat = GetComponent <StatusC>(); //Show Buffs Icon if (stat.brave) { GUI.DrawTexture(new Rect(30, 200, 60, 60), braveIcon); } if (stat.barrier) { GUI.DrawTexture(new Rect(30, 260, 60, 60), barrierIcon); } if (stat.faith) { GUI.DrawTexture(new Rect(30, 320, 60, 60), faithIcon); } if (stat.mbarrier) { GUI.DrawTexture(new Rect(30, 380, 60, 60), magicBarrierIcon); } }
// Token: 0x06000DE1 RID: 3553 RVA: 0x00058888 File Offset: 0x00056C88 private void Update() { StatusC component = base.GetComponent <StatusC>(); CharacterController component2 = base.GetComponent <CharacterController>(); if (this.RunningInRange) { Vector3 a = base.transform.TransformDirection(this.runDirection); component2.Move(a * this.speed * Time.deltaTime); return; } this.followTarget = null; this.FindClosestEnemy(); if (this.useMecanim) { this.animator.SetBool("hurt", this.flinch); } if (this.flinch) { component2.Move(this.knock * 6f * Time.deltaTime); return; } if (this.freeze || component.freeze) { return; } if (!this.followTarget) { return; } if (this.followState == WeakAI.AIState.Idle) { Vector3 position = this.followTarget.position; position.y = base.transform.position.y - position.y; int num = base.GetComponent <StatusC>().maxHealth - base.GetComponent <StatusC>().health; this.distance = (base.transform.position - this.GetDestination()).magnitude; if ((this.distance < this.detectRange && Mathf.Abs(position.y) <= 4f) || num > 0) { this.followState = WeakAI.AIState.Moving; if (!this.useMecanim) { this.mainModel.GetComponent <Animation>().CrossFade(this.movingAnimation.name, 0.2f); } else { this.animator.SetBool("run", true); } } } }
// Use this for initialization void Start() { StatusC mainPlayer = StatusManager.instance.MainPlayer; //暂时数据初始化放这里 todo 得到角色数据 if (mainPlayer != null) { //血条变化监听 InitData(mainPlayer); mainPlayer.onChangeHealth = (c, m) => { Debug.Log("hp:" + c + "|" + m); if (c == m) { SetImgAndTxt(c, m, _imgHp, _txtHp); } else { // ReSharper disable once PossibleLossOfFraction StartCoroutine(UpdateImageAndTxt(c, m, _imgHp, _txtHp)); } }; //魔法变化监听 mainPlayer.onChangeMp = (c, m) => { Debug.Log("mp:" + c + "|" + m); if (c == m) { SetImgAndTxt(c, m, _imgMp, _txtMp); } else { StartCoroutine(UpdateImageAndTxt(c, m, _imgMp, _txtMp)); } }; mainPlayer.onChangeExp = (c, m) => { StartCoroutine(UpdateExpImage(c, m, _imgExp)); //_imgExp.fillAmount = Mathf.Lerp(_imgExp.fillAmount, c/(m*1.0f), Time.deltaTime); // _txtExp.text = sb.ToString(); }; mainPlayer.onUpdateLevel = (data) => { _txtLevel.text = data.ToString(); }; } }
void Start() { if (!player) { player = this.gameObject; } mainModel = GetComponent <AttackTriggerC>().mainModel; if (!mainModel) { mainModel = this.gameObject; } if (!animator) { animator = mainModel.GetComponent <Animator>(); } controller = player.GetComponent <CharacterController>(); GetComponent <AttackTriggerC>().useMecanim = true; stat = GetComponent <StatusC>(); }
void Start() { gameObject.tag = "Enemy"; if (!attackPoint) { attackPoint = this.transform; } if (!mainModel) { mainModel = this.gameObject; } stat = GetComponent <StatusC>(); controller = GetComponent <CharacterController>(); mAudio = GetComponent <AudioSource>(); stat.useMecanim = useMecanim; //Assign MainModel in Status Script stat.mainModel = mainModel; //Set ATK = Monster's Status atk = stat.atk; matk = stat.matk; followState = AIState.Idle; if (!useMecanim) { //If using Legacy Animation mAnim = mainModel.GetComponent <Animation>(); mAnim.Play(idleAnimation.name); mAnim[hurtAnimation.name].layer = 10; } else { //If using Mecanim Animation if (!animator) { animator = mainModel.GetComponent <Animator>(); } } }
// private Transform void FindClosestEnemy() { // Find all game objects with tag Enemy //如果当前对象没死 就不进行搜索 if (targetStatC != null && targetStatC.Health > 0) { return; } canNormalAttack = false; if (followTarget != null && followTarget.gameObject.activeInHierarchy) { return; } followTarget = null; float distance = Mathf.Infinity; float findingradius = detectRange; //为什么血量会影响视野 // if (mStatusC.health < mStatusC.maxHealth) // { // findingradius += lostSight + 3.0f; // } Collider[] objectsAroundMe = Physics.OverlapSphere(transform.position, findingradius); foreach (Collider obj in objectsAroundMe) { if (obj.CompareTag("Enemy")) //|| obj.CompareTag("Boss")) { Vector3 diff = (obj.transform.position - transform.position); float curDistance = diff.sqrMagnitude; if (curDistance < distance) { //------------ followTarget = obj.transform; targetStatC = obj.GetComponent <StatusC>(); distance = curDistance; } } } }
void Update() { StatusC stat = GetComponent <StatusC>(); if (freeze || atkDelay || Time.timeScale == 0.0f || stat.freeze) { return; } CharacterController controller = GetComponent <CharacterController>(); if (stat.flinch) { controller.Move(stat.knock * 6 * Time.deltaTime); return; } if (meleefwd) { Vector3 lui = transform.TransformDirection(Vector3.forward); controller.Move(lui * 5 * Time.deltaTime); } //---------------------------- //Normal Trigger if (Input.GetKey("j") && Time.time > nextFire && !isCasting) { TriggerAttack(); } //Magic if (Input.GetKeyDown("1") && !isCasting && skill[0].skillPrefab) { StartCoroutine(MagicSkill(0)); } if (Input.GetKeyDown("2") && !isCasting && skill[1].skillPrefab) { StartCoroutine(MagicSkill(1)); } if (Input.GetKeyDown("3") && !isCasting && skill[2].skillPrefab) { StartCoroutine(MagicSkill(2)); } }
public void OnLand() { if (!fallingDamage.enable) { return; } //print(airTime); StatusC stat = GetComponent <StatusC>(); if (airTime > fallingDamage.minSurviveFall && transform.position.y < yPos - fallingDamage.surviveHeight) { float df = fallingDamage.minSurviveFall / 2; float aa = airTime - df; float dmg = (float)fallingDamage.damageForSeconds * aa; stat.FallingDamage((int)dmg); if (fallingDamage.hitEffect) { Instantiate(fallingDamage.hitEffect, transform.position, fallingDamage.hitEffect.rotation); } } airTime = 0; }
/// <summary> /// Добавление QBE полей /// </summary> private void AddColectionQbe() { StatusC.Add(new ParamQbe() { ColorNum = Brushes.Yellow, Num = 14 }); StatusC.Add(new ParamQbe() { ColorNum = Brushes.Aqua, Num = 11 }); StatusC.Add(new ParamQbe() { ColorNum = Brushes.Brown, Num = 4 }); StatusF.Add(new ParamQbe() { ColorNum = Brushes.Yellow, Num = 14 }); StatusF.Add(new ParamQbe() { ColorNum = Brushes.Orange, Num = 6 }); }
public void UpgradeStatus(int statusId) { //0 = Atk , 1 = Def , 2 = Matk , 3 = Mdef if (!player) { return; } StatusC stat = player.GetComponent <StatusC>(); if (statusId == 0 && stat.statusPoint > 0) { stat.atk += 1; stat.statusPoint -= 1; stat.CalculateStatus(); } if (statusId == 1 && stat.statusPoint > 0) { stat.def += 1; stat.maxHealth += 5; stat.statusPoint -= 1; stat.CalculateStatus(); } if (statusId == 2 && stat.statusPoint > 0) { stat.matk += 1; stat.maxMana += 3; stat.statusPoint -= 1; stat.CalculateStatus(); } if (statusId == 3 && stat.statusPoint > 0) { stat.mdef += 1; stat.statusPoint -= 1; stat.CalculateStatus(); } }
/// <summary> /// 更新image /// </summary> /// <param name="obj"></param> /// <returns></returns> IEnumerator UpdateImage(StatusC obj) { if (obj.transform != _lastObj) { _txtName.text = obj.name; _imgHp.fillAmount = 1.0f; _lastObj = obj.transform; } float target = obj.Health / (obj.MaxHealth * 1.0f); if (target > 1.0f) { while (_imgHp.fillAmount < 1.0f) { _imgHp.fillAmount += 0.03f; yield return(new WaitForSeconds(0.03f)); } _imgHp.fillAmount = 0.0f; float leftTarget = target - 1.0f; while (_imgHp.fillAmount < leftTarget) { _imgHp.fillAmount += 0.03f; yield return(new WaitForSeconds(0.03f)); } } else { while (_imgHp.fillAmount > target) { //减 _imgHp.fillAmount -= 0.03f; yield return(new WaitForSeconds(0.03f)); } } }
void Update() { if (!player) { Destroy(gameObject); return; } StatusC stat = player.GetComponent <StatusC>(); int maxHp = stat.totalMaxHealth; float hp = stat.health; int maxMp = stat.totalMaxMana; float mp = stat.mana; int exp = stat.exp; float maxExp = stat.maxExp; //float target = (float)cur_hp / (float)cur_mhp; float curHp = hp / maxHp; float curMp = mp / maxMp; float curExp = exp / maxExp; /*if(curHp >= 0.75){ * hpBar.color = Color.green; * hpBar.sprite = hp2; * }else{ * hpBar.color = Color.red; * }*/ //HP Gauge if (curHp > hpBar.fillAmount) { hpBar.fillAmount += 1 / 1 * Time.unscaledDeltaTime; if (hpBar.fillAmount > curHp) { hpBar.fillAmount = curHp; } } if (curHp < hpBar.fillAmount) { hpBar.fillAmount -= 1 / 1 * Time.unscaledDeltaTime; if (hpBar.fillAmount < curHp) { hpBar.fillAmount = curHp; } } //MP Gauge if (curMp > mpBar.fillAmount) { mpBar.fillAmount += 1 / 1 * Time.unscaledDeltaTime; if (mpBar.fillAmount > curMp) { mpBar.fillAmount = curMp; } } if (curMp < mpBar.fillAmount) { mpBar.fillAmount -= 1 / 1 * Time.unscaledDeltaTime; if (mpBar.fillAmount < curMp) { mpBar.fillAmount = curMp; } } //EXP Gauge if (expBar) { expBar.fillAmount = curExp; } if (lvText) { lvText.text = stat.level.ToString(); } if (hpText) { hpText.text = hp.ToString() + "/" + maxHp.ToString(); } if (mpText) { mpText.text = mp.ToString() + "/" + maxMp.ToString(); } }
void Update() { StatusC stat = GetComponent <StatusC>(); CharacterController controller = GetComponent <CharacterController>(); gos = GameObject.FindGameObjectsWithTag("Player"); if (gos.Length > 0) { followTarget = FindClosest().transform; } if (flinch) { controller.Move(knock * 6 * Time.deltaTime); return; } if (freeze || stat.freeze) { return; } if (!followTarget) { return; } //----------------------------------- if (followState == AIState.Moving) { if ((followTarget.position - transform.position).magnitude <= approachDistance) { followState = AIState.Pausing; mainModel.animation.CrossFade(idleAnimation.name, 0.2f); //----Attack---- //Attack(); StartCoroutine(Attack()); } else if ((followTarget.position - transform.position).magnitude >= lostSight) { //Lost Sight GetComponent <StatusC>().health = GetComponent <StatusC>().maxHealth; followState = AIState.Idle; mainModel.animation.CrossFade(idleAnimation.name, 0.2f); } else { Vector3 forward = transform.TransformDirection(Vector3.forward); controller.Move(forward * speed * Time.deltaTime); Vector3 destiny = followTarget.position; destiny.y = transform.position.y; transform.LookAt(destiny); } } else if (followState == AIState.Pausing) { Vector3 destinya = followTarget.position; destinya.y = transform.position.y; transform.LookAt(destinya); distance = (transform.position - GetDestination()).magnitude; if (distance > approachDistance) { followState = AIState.Moving; mainModel.animation.CrossFade(movingAnimation.name, 0.2f); } } //----------------Idle Mode-------------- else if (followState == AIState.Idle) { Vector3 destinyheight = followTarget.position; destinyheight.y = transform.position.y - destinyheight.y; int getHealth = GetComponent <StatusC>().maxHealth - GetComponent <StatusC>().health; distance = (transform.position - GetDestination()).magnitude; if (distance < detectRange && Mathf.Abs(destinyheight.y) <= 4 || getHealth > 0) { followState = AIState.Moving; mainModel.animation.CrossFade(movingAnimation.name, 0.2f); } } //----------------------------------- }
void Update() { if (!player) { Destroy(gameObject); return; } StatusC stat = player.GetComponent <StatusC>(); if (charName) { charName.text = stat.characterName.ToString(); } if (lv) { lv.text = stat.level.ToString(); } if (atk) { atk.text = stat.atk.ToString(); } if (def) { def.text = stat.def.ToString(); } if (matk) { matk.text = stat.matk.ToString(); } if (mdef) { mdef.text = stat.mdef.ToString(); } if (exp) { exp.text = stat.exp.ToString(); } if (nextLv) { nextLv.text = (stat.maxExp - stat.exp).ToString(); } if (stPoint) { stPoint.text = stat.statusPoint.ToString(); } if (totalAtk) { totalAtk.text = "(" + stat.addAtk.ToString() + ")"; } if (totalDef) { totalDef.text = "(" + (stat.def + stat.addDef + stat.buffDef).ToString() + ")"; } if (totalMatk) { totalMatk.text = "(" + stat.addMatk.ToString() + ")"; } if (totalMdef) { totalMdef.text = "(" + (stat.mdef + stat.addMdef + stat.buffMdef).ToString() + ")"; } if (stat.statusPoint > 0) { if (atkUpButton) { atkUpButton.gameObject.SetActive(true); } if (defUpButton) { defUpButton.gameObject.SetActive(true); } if (matkUpButton) { matkUpButton.gameObject.SetActive(true); } if (mdefUpButton) { mdefUpButton.gameObject.SetActive(true); } } else { if (atkUpButton) { atkUpButton.gameObject.SetActive(false); } if (defUpButton) { defUpButton.gameObject.SetActive(false); } if (matkUpButton) { matkUpButton.gameObject.SetActive(false); } if (mdefUpButton) { mdefUpButton.gameObject.SetActive(false); } } }
void OnGUI() { if (canvasElement.useCanvas) { return; } /*if(aimingType == AimType.Normal){ * GUI.DrawTexture(new Rect(Screen.width/2 - 16,Screen.height/2 - 90,aimIconSize,aimIconSize), aimIcon); * }*/ if (aimingType == AimType.Raycast) { GUI.DrawTexture(new Rect(Screen.width / 2 - 20, Screen.height / 2 - 20, 40, 40), aimIcon); } if (drawGUI) { GUI.Box(new Rect(Screen.width - 630, Screen.height - 105, 60, 60), skill[0].icon); if (skillCoolDown[0] > 0) { GUI.Box(new Rect(Screen.width - 630, Screen.height - 105, 60, 60), skillCoolDown[0].ToString()); } //---------------------- GUI.Box(new Rect(Screen.width - 570, Screen.height - 105, 60, 60), skill[1].icon); if (skillCoolDown[1] > 0) { GUI.Box(new Rect(Screen.width - 570, Screen.height - 105, 60, 60), skillCoolDown[1].ToString()); } //---------------------- GUI.Box(new Rect(Screen.width - 510, Screen.height - 105, 60, 60), skill[2].icon); if (skillCoolDown[2] > 0) { GUI.Box(new Rect(Screen.width - 510, Screen.height - 105, 60, 60), skillCoolDown[2].ToString()); } //---------------------- if (skill.Length >= 4) { GUI.Box(new Rect(Screen.width - 450, Screen.height - 105, 60, 60), skill[3].icon); if (skillCoolDown[3] > 0) { GUI.Box(new Rect(Screen.width - 450, Screen.height - 105, 60, 60), skillCoolDown[3].ToString()); } } //---------------------- if (skill.Length >= 5) { GUI.Box(new Rect(Screen.width - 390, Screen.height - 105, 60, 60), skill[4].icon); if (skillCoolDown[4] > 0) { GUI.Box(new Rect(Screen.width - 390, Screen.height - 105, 60, 60), skillCoolDown[4].ToString()); } } //---------------------- if (skill.Length >= 6) { GUI.Box(new Rect(Screen.width - 330, Screen.height - 105, 60, 60), skill[5].icon); if (skillCoolDown[5] > 0) { GUI.Box(new Rect(Screen.width - 330, Screen.height - 105, 60, 60), skillCoolDown[5].ToString()); } } //---------------------- if (skill.Length >= 7) { GUI.Box(new Rect(Screen.width - 270, Screen.height - 105, 60, 60), skill[6].icon); if (skillCoolDown[6] > 0) { GUI.Box(new Rect(Screen.width - 270, Screen.height - 105, 60, 60), skillCoolDown[6].ToString()); } } //---------------------- if (skill.Length >= 8) { GUI.Box(new Rect(Screen.width - 210, Screen.height - 105, 60, 60), skill[7].icon); if (skillCoolDown[7] > 0) { GUI.Box(new Rect(Screen.width - 210, Screen.height - 105, 60, 60), skillCoolDown[7].ToString()); } } } if (showButton && !GlobalConditionC.freezeAll && Time.timeScale != 0 && actvateObj) { GUI.depth = -100; if (button) { GUI.DrawTexture(new Rect(Screen.width / 2 - 130, Screen.height - 180, 260, 80), button); } GUI.Label(new Rect(Screen.width / 2 - 140, Screen.height - 180, 260, 80), "[E] " + buttonText, buttonTextStyle); } StatusC stat = GetComponent <StatusC>(); //Show Buffs Icon if (stat.brave) { GUI.DrawTexture(new Rect(30, 200, 60, 60), braveIcon); } if (stat.barrier) { GUI.DrawTexture(new Rect(30, 260, 60, 60), barrierIcon); } if (stat.faith) { GUI.DrawTexture(new Rect(30, 320, 60, 60), faithIcon); } if (stat.mbarrier) { GUI.DrawTexture(new Rect(30, 380, 60, 60), magicBarrierIcon); } }
void Update() { StatusC stat = GetComponent <StatusC>(); if (stat.freeze) { motor.inputMoveDirection = new Vector3(0, 0, 0); return; } if (Time.timeScale == 0.0f) { return; } CharacterController controller = GetComponent <CharacterController>(); float swimUp; // Get the input vector from kayboard or analog stick if (Input.GetButton("Jump")) { swimUp = 2.0f; } else { swimUp = 0.0f; } Vector3 directionVector = new Vector3(Input.GetAxis("Horizontal"), swimUp, Input.GetAxis("Vertical")); if (directionVector != Vector3.zero) { float directionLength = directionVector.magnitude; directionVector = directionVector / directionLength; directionLength = Mathf.Min(1, directionLength); directionLength = directionLength * directionLength; directionVector = directionVector * directionLength; } if (Input.GetAxis("Vertical") != 0 && transform.position.y < surfaceExit || transform.position.y >= surfaceExit && Input.GetAxis("Vertical") > 0 && mainCam.transform.eulerAngles.x >= 25 && mainCam.transform.eulerAngles.x <= 180) { transform.rotation = mainCam.transform.rotation; } //motor.inputMoveDirection = transform.rotation * directionVector; controller.Move(transform.rotation * directionVector * swimSpeed * Time.deltaTime); //-------------Animation---------------- if (!useMecanim) { //If using Legacy Animation if (Input.GetAxis("Horizontal") > 0.1) { mainModel.GetComponent <Animation>().CrossFade(swimRight.name); } else if (Input.GetAxis("Horizontal") < -0.1) { mainModel.GetComponent <Animation>().CrossFade(swimLeft.name); } else if (Input.GetAxis("Vertical") > 0.1) { mainModel.GetComponent <Animation>().CrossFade(swimForward.name); } else if (Input.GetAxis("Vertical") < -0.1) { mainModel.GetComponent <Animation>().CrossFade(swimBack.name); } else { mainModel.GetComponent <Animation>().CrossFade(swimIdle.name); } //---------------------------------------- } else { //If using Mecanim Animation float h = Input.GetAxis("Horizontal"); float v = Input.GetAxis("Vertical"); animator.SetFloat(moveHorizontalState, h); animator.SetFloat(moveVerticalState, v); } //------------------------------------------- }
// Token: 0x06000483 RID: 1155 RVA: 0x00022B74 File Offset: 0x00020F74 private void StatWindow(int windowID) { StatusC component = base.GetComponent <StatusC>(); GUI.Label(new Rect(20f, 40f, 100f, 50f), "Level", this.textStyle); GUI.Label(new Rect(20f, 70f, 100f, 50f), "STR", this.textStyle); GUI.Label(new Rect(20f, 100f, 100f, 50f), "DEF", this.textStyle); GUI.Label(new Rect(20f, 130f, 100f, 50f), "MATK", this.textStyle); GUI.Label(new Rect(20f, 160f, 100f, 50f), "MDEF", this.textStyle); GUI.Label(new Rect(20f, 220f, 100f, 50f), "EXP", this.textStyle); GUI.Label(new Rect(20f, 250f, 100f, 50f), "Next LV", this.textStyle); GUI.Label(new Rect(20f, 280f, 120f, 50f), "Status Point", this.textStyle); if (GUI.Button(new Rect(200f, 5f, 30f, 30f), "X")) { this.OnOffMenu(); } int level = component.level; int atk = component.atk; int def = component.def; int matk = component.matk; int mdef = component.mdef; int exp = component.exp; int num = component.maxExp - exp; int statusPoint = component.statusPoint; GUI.Label(new Rect(30f, 40f, 100f, 50f), level.ToString(), this.textStyle2); GUI.Label(new Rect(70f, 70f, 100f, 50f), atk.ToString(), this.textStyle2); GUI.Label(new Rect(70f, 100f, 100f, 50f), def.ToString(), this.textStyle2); GUI.Label(new Rect(70f, 130f, 100f, 50f), matk.ToString(), this.textStyle2); GUI.Label(new Rect(70f, 160f, 100f, 50f), mdef.ToString(), this.textStyle2); GUI.Label(new Rect(95f, 220f, 100f, 50f), exp.ToString(), this.textStyle2); GUI.Label(new Rect(95f, 250f, 100f, 50f), num.ToString(), this.textStyle2); GUI.Label(new Rect(95f, 280f, 100f, 50f), statusPoint.ToString(), this.textStyle2); if (statusPoint > 0) { if (GUI.Button(new Rect(200f, 70f, 25f, 25f), "+") && statusPoint > 0) { base.GetComponent <StatusC>().atk++; base.GetComponent <StatusC>().statusPoint--; base.GetComponent <StatusC>().CalculateStatus(); } if (GUI.Button(new Rect(200f, 100f, 25f, 25f), "+") && statusPoint > 0) { base.GetComponent <StatusC>().def++; base.GetComponent <StatusC>().maxHealth += 5; base.GetComponent <StatusC>().statusPoint--; base.GetComponent <StatusC>().CalculateStatus(); } if (GUI.Button(new Rect(200f, 130f, 25f, 25f), "+") && statusPoint > 0) { base.GetComponent <StatusC>().matk++; base.GetComponent <StatusC>().maxMana += 3; base.GetComponent <StatusC>().statusPoint--; base.GetComponent <StatusC>().CalculateStatus(); } if (GUI.Button(new Rect(200f, 160f, 25f, 25f), "+") && statusPoint > 0) { base.GetComponent <StatusC>().mdef++; base.GetComponent <StatusC>().statusPoint--; base.GetComponent <StatusC>().CalculateStatus(); } } GUI.DragWindow(new Rect(0f, 0f, 10000f, 10000f)); }
void Start() { stat = GetComponent <StatusC>(); }
void Update() { StatusC stat = GetComponent <StatusC>(); CharacterController controller = GetComponent <CharacterController>(); /*gos = GameObject.FindGameObjectsWithTag("Player"); * if (gos.Length > 0) { * followTarget = FindClosest().transform; * }*/ FindClosestEnemy(); if (useMecanim) { animator.SetBool("hurt", flinch); } if (flinch) { controller.Move(knock * 6 * Time.deltaTime); return; } if (freeze || stat.freeze) { return; } if (GlobalConditionC.freezeAll) { followState = AIState.Idle; if (!useMecanim) { //If using Legacy Animation mainModel.GetComponent <Animation>().CrossFade(idleAnimation.name, 0.2f); } else { animator.SetBool("run", false); } return; } if (!followTarget) { if (followState == AIState.Moving || followState == AIState.Pausing) { followState = AIState.Idle; if (!useMecanim) { //If using Legacy Animation mainModel.GetComponent <Animation>().CrossFade(idleAnimation.name, 0.2f); } else { animator.SetBool("run", false); } } return; } //----------------------------------- distance = (transform.position - GetDestination()).magnitude; if (followState == AIState.Moving) { if (!useMecanim) { //If using Legacy Animation mainModel.GetComponent <Animation>().CrossFade(movingAnimation.name, 0.2f); } else { animator.SetBool("run", true); } if (distance <= approachDistance) { followState = AIState.Pausing; //----Attack---- //Attack(); StartCoroutine(Attack()); } else if (distance >= lostSight) { //Lost Sight GetComponent <StatusC>().health = GetComponent <StatusC>().maxHealth; followState = AIState.Idle; if (!useMecanim) { //If using Legacy Animation mainModel.GetComponent <Animation>().CrossFade(idleAnimation.name, 0.2f); } else { animator.SetBool("run", false); } } else { Vector3 forward = transform.TransformDirection(Vector3.forward); controller.Move(forward * speed * Time.deltaTime); Vector3 destinationy = followTarget.position; destinationy.y = transform.position.y; transform.LookAt(destinationy); } } else if (followState == AIState.Pausing) { if (!useMecanim) { //If using Legacy Animation mainModel.GetComponent <Animation>().CrossFade(idleAnimation.name, 0.2f); } else { animator.SetBool("run", false); } Vector3 destinya = followTarget.position; destinya.y = transform.position.y; transform.LookAt(destinya); if (distance > approachDistance) { followState = AIState.Moving; } } else if (followState == AIState.Idle) { /*if(!useMecanim){ * //If using Legacy Animation * mainModel.GetComponent<Animation>().CrossFade(idleAnimation.name, 0.2f); * }else{ * animator.SetBool("run" , false); * }*/ //----------------Idle Mode-------------- Vector3 destinyheight = followTarget.position; destinyheight.y = transform.position.y - destinyheight.y; int getHealth = GetComponent <StatusC>().maxHealth - GetComponent <StatusC>().health; if (distance < detectRange && Mathf.Abs(destinyheight.y) <= 4 || getHealth > 0) { followState = AIState.Moving; } } //----------------------------------- }
void OnTriggerEnter(Collider other) { //When Player Shoot at Enemy //GameObject dmgPop = new GameObject(); //GameObject clone1 = new GameObject(); if (shooterTag == "Player" && other.tag == "Enemy") { Transform dmgPop = Instantiate(Popup, other.transform.position, transform.rotation) as Transform; StatusC otherStatus = other.GetComponent <StatusC>(); if (AttackType == AtkType.Physic) { popDamage = otherStatus.OnDamage(totalDamage, (int)element); } else { popDamage = otherStatus.OnMagicDamage(totalDamage, (int)element); } //if(shooter && shooter.GetComponent<ShowEnemyHealthC>()){ if (shooter && VMMonsterPhoto.instance) { //shooter.GetComponent<ShowEnemyHealthC>().GetHP(other.GetComponent<StatusC>().MaxHealth , other.gameObject , other.name); VMMonsterPhoto.instance.ChangeMonsterHp(otherStatus); } if (dmgPop != null) { dmgPop.GetComponent <DamagePopupC>().damage = popDamage; } if (hitEffect) { Instantiate(hitEffect, transform.position, transform.rotation); } if (flinch) { Vector3 dir = (other.transform.position - transform.position).normalized; //other.GetComponent<AIsetC>().Flinch(dir); other.SendMessage("Flinch", dir, SendMessageOptions.DontRequireReceiver); } if (!penetrate) { Destroy(gameObject); } //When Enemy Shoot at Player } else if (shooterTag == "Enemy" && other.tag == "Player" || shooterTag == "Enemy" && other.tag == "Ally") { if (AttackType == AtkType.Physic) { popDamage = other.GetComponent <StatusC>().OnDamage(totalDamage, (int)element); } else { popDamage = other.GetComponent <StatusC>().OnMagicDamage(totalDamage, (int)element); } Transform dmgPop = Instantiate(Popup, transform.position, transform.rotation) as Transform; dmgPop.GetComponent <DamagePopupC>().damage = popDamage; if (hitEffect) { Instantiate(hitEffect, transform.position, transform.rotation); } if (flinch) { Vector3 dir = (other.transform.position - transform.position).normalized; //other.GetComponent<AttackTriggerC>().Flinch(dir); other.SendMessage("Flinch", dir, SendMessageOptions.DontRequireReceiver); } if (!penetrate) { Destroy(gameObject); } } }