예제 #1
0
	IEnumerator OnlockmultiTarget(){
		CursorManager._instance.setNormal ();
				//点击地面
				Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
				RaycastHit hitInfo;
				bool iscollider = Physics.Raycast (ray, out hitInfo);
		print ("iscollider");
		if(iscollider&&hitInfo.collider.tag==Tags.ground){
			//if (iscollider) {
						animation.CrossFade (infotarget.aniname);
						yield return new WaitForSeconds (infotarget.anitime);
						playerattackxu = PlayerAttackState.ControllWalk;
			//实例化特效
			GameObject prefab = null;
			skillIeffectDict.TryGetValue (  infotarget.efx_name, out prefab);
			//print (prefab);
		GameObject go=	GameObject.Instantiate (prefab, hitInfo.point+Vector3.up*0.5f, Quaternion.identity) as GameObject;
			go.GetComponent<Magicsphere>().attack=getAttack()*(infotarget.applyValue/100f);
				} else {
			playerattackxu = PlayerAttackState.ControllWalk;
		}
		}
예제 #2
0
	void Update(){
			//正在释放技能不做检测		
		if (islocking==false&&  Input.GetMouseButtonDown (0)&&playerattackxu != PlayerAttackState.Death) {
			Ray ray=Camera.main.ScreenPointToRay(Input.mousePosition);
			RaycastHit hitInfo;
			bool iscollider=Physics.Raycast(ray,out hitInfo);
			if(iscollider&&hitInfo.collider.tag==Tags.enemy){
				attacknormal_target=hitInfo.collider.transform;
				//print (attacknormal_target);
				playerattackxu=PlayerAttackState.Attack_normal;
				attack_time=0; isShowEffect=false;

			}
			else{
				playerattackxu=PlayerAttackState.ControllWalk;
				attacknormal_target=null;
			}
		

		}
		if(Input.GetMouseButtonDown(0)&&islocking==true){
			OnlockTarget();
		}
		//普通攻击
		if (playerattackxu == PlayerAttackState.Attack_normal) {
						if (attacknormal_target == null) {
								playerattackxu = PlayerAttackState.ControllWalk;
						} else {
								float distance = Vector3.Distance (transform.position, attacknormal_target.position);
								if (distance <= minAttackDis) {
										//进行攻击

										transform.LookAt (attacknormal_target.position);//面向怪物
										attackIndisxu = PlayerAttackIndis.Attack;
										attack_time += Time.deltaTime;
										animation.CrossFade (Attack_now);
										if (attack_time >= attack_normalTime) {
												Attack_now = Attack_idle;//进行过一次攻击了
												if (isShowEffect == false) {//大错误导致不断刷新攻击效果
														isShowEffect = true;
														GameObject.Instantiate (effect, attacknormal_target.position, Quaternion.identity);
														attacknormal_target.GetComponent<Wolfbaby> ().Takedamage (getAttack ());
												}
										}
										if (attack_time >= (1f / attack_rate)) {//下一次攻击
												attack_time = 0;
												isShowEffect = false;
												Attack_now = Attack_normalAnim;
										}
								} else {//走向敌人
										//播放行走动画
										attackIndisxu = PlayerAttackIndis.Moving;
										movexu.simplemove (attacknormal_target.position);
								}
						}
				} 
		else if(playerattackxu == PlayerAttackState.Death){
			animation.CrossFade(Death_anim);

	}
	}
예제 #3
0
	IEnumerator OnlocksingleTarget(){
		Ray ray=Camera.main.ScreenPointToRay(Input.mousePosition);
		RaycastHit hitInfo;
		bool iscollider=Physics.Raycast(ray,out hitInfo);
		if(iscollider&&hitInfo.collider.tag==Tags.enemy){
			animation.CrossFade (infotarget.aniname);
			yield return new WaitForSeconds(infotarget.anitime);
			playerattackxu = PlayerAttackState.ControllWalk;
			//实例化特效
			GameObject prefab = null;
			skillIeffectDict.TryGetValue (  infotarget.efx_name, out prefab);
			GameObject.Instantiate (prefab, hitInfo.collider.transform.position, Quaternion.identity);

			hitInfo.collider.GetComponent<Wolfbaby>().Takedamage((int) (getAttack()*(infotarget.applyValue/100f)));
		}
		else{
			playerattackxu = PlayerAttackState.Attack_normal;
		}
		CursorManager._instance.setNormal ();
}
예제 #4
0
	void 	OnmultiUse(SkillInfo info){
		playerattackxu = PlayerAttackState.Skill_attack;
		CursorManager._instance.setLocalTarget ();
		islocking = true;
		this.infotarget = info;
	}
예제 #5
0
	//增强
	IEnumerator  OnBuffUse(SkillInfo info){
		playerattackxu = PlayerAttackState.Skill_attack;
		animation.CrossFade (info.aniname);
		yield return new WaitForSeconds(info.anitime);
		playerattackxu = PlayerAttackState.ControllWalk;
		switch (info.applyPro) {
		case ApplyProperty.Attack:
			psxu.attack*=(info.applyValue/100f);
			break;
		case ApplyProperty.Def:
			psxu.def*=(info.applyValue/100f);
			break;
		case ApplyProperty.AttackSpeed:
			attack_rate*=(info.applyValue/100f);
			break;
		case ApplyProperty.Speed:
			movexu.speed*=(info.applyValue/100f);
			break;
		}
		yield return new WaitForSeconds(info.applyTime);
		switch (info.applyPro) {
		case ApplyProperty.Attack:
			psxu.attack/=(info.applyValue/100f);
			break;
		case ApplyProperty.Def:
			psxu.def/=(info.applyValue/100f);
			break;
		case ApplyProperty.AttackSpeed:
			attack_rate/=(info.applyValue/100f);
			break;
		case ApplyProperty.Speed:
			movexu.speed/=(info.applyValue/100f);
			break;
		}
		//实例化特效
		GameObject prefab = null;
		skillIeffectDict.TryGetValue (info.efx_name, out prefab);
		GameObject.Instantiate (prefab, transform .position, Quaternion.identity);
	}
예제 #6
0
	//增益
	IEnumerator OnPassiveUse(SkillInfo info){
		playerattackxu = PlayerAttackState.Skill_attack;
		animation.CrossFade (info.aniname);
		yield return new WaitForSeconds(info.anitime);
		playerattackxu = PlayerAttackState.ControllWalk;
		int hp = 0, mp = 0;
		if (info.applyPro == ApplyProperty.HP) {
						hp = info.applyValue;
				} else if (info.applyPro == ApplyProperty.Mp) {
						mp = info.applyValue;
				}
		psxu.GetDrug (hp, mp);

		//实例化特效
		GameObject prefab = null;
		skillIeffectDict.TryGetValue (info.efx_name, out prefab);
		GameObject.Instantiate (prefab, transform .position, Quaternion.identity);
	}
예제 #7
0
	public void TakeDamage(int attack){
		if (playerattackxu == PlayerAttackState.Death)
						return;
		float def = Equipmentxu._instance.def + psxu.def + psxu.defPlus;
		float temp = attack * ((200 - def) / 200);//防御抵消伤害
		if (temp < 1)  temp = 1;
		float value = Random.Range (0f, 1f);
		if (value < missrateplayer) {
			AudioSource.PlayClipAtPoint(misssong,transform.position);
			hudtext.Add("Miss",Color.gray,1);
				} 
		else {//打中
			hudtext.Add("-"+temp,Color.yellow,1);
			psxu.hp_remain-=temp;
			//显示红色被攻击状态
			StartCoroutine(ShowRedAttack());
			if(psxu.hp_remain<=0){
				psxu.hp_remain=0;
			 playerattackxu=PlayerAttackState.Death;
				//Destroy(this.gameObject,2);//2s之后消失
			     StartCoroutine(fuhuo());
			}
		}
		FaceTextureUI._instance.Updateshow ();

	}
예제 #8
0
	void ShowCharacter(){
		GameObject.Find ("Magician_Body").GetComponent<SkinnedMeshRenderer> ().enabled = true;
		GameObject.Find ("Magician_Staff").GetComponent<SkinnedMeshRenderer> ().enabled =true;
	//	playerController.isControllable = true;
		dir.targetposition =  checkpoint.isActivePt.transform.position;
		playerattackxu = PlayerAttackState.ControllWalk;

	}
예제 #9
0
    // Update is called once per frame
    void Update()
    {
        if (GameStateManager.GameState == StateEnum.Play)
        {
            transform.rotation = Quaternion.Euler(new Vector3(0, 0, AngleToFaceMouse2D()));

            if (InputControl.Fire.InputReturn > 0)
            {
                gunAnim.SetBool("isShooting", true);
                CuppyGunAttackState = PlayerAttackState.Attacking;
            }
            else
            {
                gunAnim.SetBool("isShooting", false);
                CuppyGunAttackState = PlayerAttackState.Idling;
            }
        }
    }