public void changeDirection() { if(targetObj == null) { getNewTarget(); } if(targetObj == null) { return; } atkHero = targetObj.GetComponent<Hero>(); if(atkHero.getIsDead()) { getNewTarget(); } if(atkHero) { if(model.transform.localScale.x > 0 && (model.transform.position.x > atkHero.transform.position.x)) { model.transform.localScale += new Vector3(-0.8f,0,0); // model.transform.localScale.x = -0.8f; } if(model.transform.localScale.x < 0 && (model.transform.position.x < atkHero.transform.position.x)) { model.transform.localScale += new Vector3(0.8f,0,0); // model.transform.localScale.x = 0.8f; } } }
public void startHeal( Hero hero ) { if(this.isDead){ return; } //gwp GameObject tempTarget = targetObj; Hero tempTargetData = null; //gwp end state = ATK_STATE; targetObj = hero.gameObject; //gwp if(tempTarget != null){ tempTargetData = tempTarget.GetComponent<Hero>(); if(!tempTargetData.getIsDead()){ if(isAddAtk){ // tempTargetData.addAtk(-addAtkValue); } if(isAddDef){ // tempTargetData.addDef(-addDefValue); } } } //gwp end if(!hero.getIsDead()) { if(isAddAtk){ // addAtkValue = hero.realAtk*25/100; // hero.addAtk(addAtkValue); } if(isAddDef){ // addDefValue = hero.realDef*25/100; // hero.addDef(addDefValue); } if( !IsInvoking("healTarget") ) { healTarget(); CancelInvoke("healTarget"); InvokeRepeating("healTarget", realAspd, realAspd); } } }
public void startHeal( Hero hero ) { if(this.isDead) { return; } state = ATK_STATE; targetObj = hero.gameObject; if(!hero.getIsDead()) { if( !IsInvoking("healTarget") ) { healTarget(); CancelInvoke("healTarget"); InvokeRepeating("healTarget", realAspd, realAspd); } } }