/// <summary> /// 自动检查身边可以交互的物体,按钮图要随之改变 /// </summary> void CheckCanInteractive() { if (!theButton) { return; } if (!theETCButton) { theETCButton = theButton.GetComponent <ETCButton> (); } if (!ButtonImage) { ButtonImage = theButton.GetComponent <Image> (); } if (!theETCButton || !ButtonImage) { return; } InteractiveBasic aim = GetAim(); Sprite aimPicture = aim == null ? canNotInteractivePicture : canInteractivePicture; theETCButton.normalSprite = aimPicture; ButtonImage.sprite = aimPicture; }
//播放技能动画 public override void UseTheSkill() { if (canUseTheSkill()) { OnUse(); theStateNow = skillState.isUsing; thePlayer.theSkillNow = this; InteractiveBasic aim = GetAim(); if (aim) { //print ("aim - "+aim.name); aim.MakeInteractive(); this.thePlayer.theMoveController.MakeLookAt(aim.transform); this.thePlayer.OnInteractive(aim); } else { UIController.GetInstance().ShowUI <messageBox> ("附近没有可交互的事物"); } } else { UIController.GetInstance().ShowUI <messageBox> ("暂时无法进行交互"); } }
public void OnInteractive(InteractiveBasic aim) { if (InteractiveEvent != null) { InteractiveEvent(aim); } }
/// <summary> /// 交互事件在这里处理 /// </summary> /// <param name="aim">Aim.</param> private void OnInteractive(InteractiveBasic aim) { theMissions.RemoveAll(X => X == null); for (int i = 0; i < theMissions.Count; i++) { theMissions [i].OnPlayerIntweactive(aim); } }
public override void OnPlayerIntweactive(InteractiveBasic aim) { if (aim.InterName != "凤血草") { return; } getCount++; GameObject.Destroy(aim.gameObject); if (checkMissionOver()) { OnMissionOver(); } else { UIController.GetInstance().ShowUI <messageBox> ("获得凤血草"); this.thePlayer.OnGetLearningValue(20f); missionInformation = "【主线任务】在这凤栖野中有一些凤血草,摘取三株作为救助李生的药引。\n已经采摘" + getCount + "/" + getMax; } }
} //击杀任务用这个方法处理 public virtual void OnPlayerIntweactive(InteractiveBasic aim) { } //当进行交互的时候进行判断