public IEnumerator Attack(BattleProfile other, int damageTaken, float shakeIntensity, float scaleIntensity, float duration) { Transform ourSprite = this.renderer.transform; Transform theirSprite = other.renderer.transform; Vector3 startPosition = ourSprite.position; Vector3 endPosition = theirSprite.position; yield return Approach(ourSprite, startPosition, endPosition, duration, NEXT_TO_PORTRAIT); other.ps.Play(); StartCoroutine(other.life.ChangeCount(shakeIntensity, scaleIntensity, other.life.Count - damageTaken, duration)); StartCoroutine(Util.ShakeItem(shakeIntensity, scaleIntensity, duration, () => { }, theirSprite)); yield return new WaitForSeconds(duration); yield return Approach(ourSprite, ourSprite.position, startPosition, duration, 1f); }
//public void CreateHeroHp(System.Guid uid, bool bMyTeam) //{ // var goHPRes = Global.ResourceMgr.CreateUIResource("UI/Common/Prefabs/HPGauge", false); // if (goHPRes == null) return; // GameObject goHP = Instantiate(goHPRes.ResourceData) as GameObject; // if (goHP != null) // { // goHP.transform.parent = HeroHp.transform; // goHP.transform.name = uid.ToString(); // goHP.transform.position = Vector3.zero; // goHP.transform.rotation = Quaternion.identity; // goHP.transform.localScale = new Vector3(0.8f, 0.8f, 1); // goHP.SetActive(true); // } //} //public void UpdateHPGauge(System.Guid uid, float fFillAmountHp) //{ // if (HeroHp == null) return; // for (int i = 0; i < HeroHp.childCount; ++i) // { // Transform tChild = HeroHp.GetChild(i); // if (tChild == null) continue; // if (tChild.name.Equals(uid.ToString())) // { // Transform tSlider = tChild.Find("SpriteSlider"); // if (tSlider == null) continue; // UISprite sprite = tSlider.GetComponent<UISprite>(); // if (sprite == null) continue; // sprite.fillAmount = fFillAmountHp; // } // } //} //public void SetPosHPGauge(System.Guid uid, Transform tEf_HP) //{ // if (HeroHp == null) return; // for (int i = 0; i < HeroHp.childCount; ++i) // { // Transform tChild = HeroHp.GetChild(i); // if (tChild == null) continue; // if (tChild.name.Equals(uid.ToString())) // { // Vector3 vScreenPos = Camera.main.WorldToScreenPoint(tEf_HP.position); // tChild.position = UICamera.currentCamera.ScreenToWorldPoint(new Vector3(vScreenPos.x, vScreenPos.y, 0)); // } // } //} //public void DestroyHPGauge(System.Guid uid) //{ // if (HeroHp == null) return; // for (int i = 0; i < HeroHp.childCount; ++i) // { // Transform tChild = HeroHp.GetChild(i); // if (tChild == null) continue; // if (tChild.name.Equals(uid.ToString())) // { // NGUITools.Destroy(tChild.gameObject); // } // } //} BattleProfile GetProfile(int heroNo) { var heroCont = BattleHeroManager.Instance.GetHeroControl(heroNo); if (heroCont != null) { BattleProfile bp = null; if (heroCont.IsMyTeam) { bp = Profiles[0]; } else { bp = Profiles[1]; } return(bp); } return(null); }