public int GetTouchObjID() { int object_id = -1; float skill_blear_radius = 0.5f; Vector3 touch_pos = new Vector3(position.x, position.y, 0); Ray ray = Camera.main.ScreenPointToRay(touch_pos); RaycastHit hitInfo; GameObject hitGameObj = null; int layermask = (1 << LayerMask.NameToLayer("Terrains")) | (1 << LayerMask.NameToLayer("Character")); SkillControllerInterface player_skill_ctrl = GetControl(); if (null != player_skill_ctrl) { SkillInputData skill_input_data = player_skill_ctrl.GetSkillInputData(SkillTags); if (null != skill_input_data) { skill_blear_radius = skill_input_data.targetChooseRange; } } if (Physics.Raycast(ray, out hitInfo, 200f, layermask)) { Collider[] hitObjs = Physics.OverlapSphere(hitInfo.point, skill_blear_radius, (1 << LayerMask.NameToLayer("Character"))); if (hitObjs.Length > 0) { hitGameObj = hitObjs[0].gameObject; if (null != hitGameObj) { SharedGameObjectInfo targetInfo = LogicSystem.GetSharedGameObjectInfo(hitGameObj); if (null != targetInfo && IsEnemy()) { // camp int camp_self = -1; GameObject goSelf = DashFire.LogicSystem.PlayerSelf; if (null != goSelf) { CharacterCamp camp_s = goSelf.GetComponent <CharacterCamp>(); if (null != camp_s) { camp_self = camp_s.m_CampId; } } CharacterCamp camp_t = hitGameObj.GetComponent <CharacterCamp>(); if (camp_t != null && camp_self != camp_t.m_CampId && targetInfo.Blood > 0) { object_id = targetInfo.m_LogicObjectId; } } } } } if (-1 != object_id && null != hitGameObj) { GfxSystem.PublishGfxEvent("Op_InputEffect", "Input", GestureEvent.OnSingleTap, hitGameObj.transform.position.x, hitGameObj.transform.position.y, hitGameObj.transform.position.z, true, false); } return(object_id); }
public void OnClick() { GameObject go = this.gameObject; if (go != null) { SkillControllerInterface skillCtrl = GetControl(); if (skillCtrl != null) { skillCtrl.PushSkill(m_SkillCat, Vector3.zero); collisonTime = 0.3f; SetCountDown(collisonTime); AddTweenScale(); } } if (this.transform.parent != null) { for (int index = 0; index < this.transform.parent.childCount; ++index) { Transform trans = this.transform.parent.GetChild(index); if (null != trans) { go = trans.gameObject; if (go.name == "SkillIcon(Clone)") { if (go != null && go != this.gameObject) { Destroy(go); } } } } } }
public static GestureArgs ToGestureArgs(Gesture args) { if (null == args) { return(null); } GestureArgs e = new GestureArgs(); e.startPositionX = args.StartPosition.x; e.startPositionY = args.StartPosition.y; e.positionX = args.Position.x; e.positionY = args.Position.y; e.startTime = args.StartTime; e.elapsedTime = args.ElapsedTime; Vector3 pos = args.GetTouchToWorldPoint(); e.gamePosX = pos.x; e.gamePosY = pos.y; e.gamePosZ = pos.z; e.name = args.Recognizer.EventMessageName; GameObject go = DashFire.LogicSystem.PlayerSelf; Vector3 srcPos = args.GetStartTouchToWorldPoint(); Vector3 destPos = pos; if (null != go) { destPos = go.transform.position; } e.towards = Geometry.GetYAngle(new ScriptRuntime.Vector2(destPos.x, destPos.z), new ScriptRuntime.Vector2(srcPos.x, srcPos.z)); e.moveType = curTouchState; e.selectedObjID = args.SelectedID; e.sectionNum = args.SectionNum; Vector3 airWellPos = args.GetTouchToAirWallWorldPoint(); e.airWelGamePosX = airWellPos.x; e.airWelGamePosY = airWellPos.y; e.airWelGamePosZ = airWellPos.z; e.startGamePosX = srcPos.x; e.startGamePosY = srcPos.y; e.startGamePosZ = srcPos.z; /// e.attackRange = 3f; SkillControllerInterface skill_contrl = GetControl(); if (null != skill_contrl) { SkillInputData skill_input_data = skill_contrl.GetSkillInputData(args.SkillTags); if (null != skill_input_data) { e.attackRange = skill_input_data.castRange; } } return(e); }
private IEnumerator EndGame() { // 关掉输入和移动 TouchManager.TouchEnable = false; GameObject player = GetPlayer(); if (null != player) { SharedGameObjectInfo info = LogicSystem.GetSharedGameObjectInfo(gameObject); if (null != info) { LogicSystem.PublishLogicEvent("ge_set_ai_enable", "ai", info.m_LogicObjectId, false); } } // 慢放 3s Time.timeScale = 0.1f; yield return(new WaitForSeconds(0.3f)); Time.timeScale = 1.0f; // stage clear OnStageClear(); player = GetPlayer(); if (null != player) { BaseSkillManager bsm = player.GetComponent <BaseSkillManager>(); if (null != bsm) { if (!bsm.IsUsingSkill()) { } else { SkillControllerInterface sc = bsm.GetSkillController(); if (null != sc) { sc.ForceStopCurSkill(); } } } } yield return(new WaitForSeconds(0.9f)); // 耍帅动作 GameObject gfxGameRoot = GameObject.Find("GfxGameRoot"); MainCamera cameraControl = gfxGameRoot.GetComponent <MainCamera>(); cameraControl.m_Distance = 10.0f; cameraControl.m_Height = 7.0f; player = GetPlayer(); if (null != player) { player.GetComponent <Animation>().PlayQueued("jianshi_shenguizhan_01", QueueMode.PlayNow); } yield return(new WaitForSeconds(1.2f)); cameraControl.m_Distance = 12.5f; cameraControl.m_Height = 7.9f; TouchManager.TouchEnable = true; OnShieldSword(); }
void On_JoystickMoveStart(MovingJoystick move) { IsMoving = true; SkillControllerInterface player_skill_ctrl = GetControl(); if (null != player_skill_ctrl) { player_skill_ctrl.AddBreakSkillTask(); } }
public Vector3 GetStartTouchToWorldPoint() { float skill_blear_radius = 0.5f; Vector3 start_touch_worldpos = Vector3.zero; Vector3 start_touch_pos = new Vector3(startPosition.x, startPosition.y, 0); Ray ray = Camera.main.ScreenPointToRay(start_touch_pos); RaycastHit hitInfo; //int layermask = (1 << LayerMask.NameToLayer("AirWall")); //layermask |= 1 << LayerMask.NameToLayer("Character"); //layermask |= 1 << LayerMask.NameToLayer("Player"); //layermask |= 1 << LayerMask.NameToLayer("SceneObjEffect"); //layermask |= 1 << LayerMask.NameToLayer("SceneObj"); //layermask = ~layermask; int layermask = (1 << LayerMask.NameToLayer("Terrains")) | (1 << LayerMask.NameToLayer("Character")); SkillControllerInterface player_skill_ctrl = GetControl(); if (null != player_skill_ctrl) { SkillInputData skill_input_data = player_skill_ctrl.GetSkillInputData(SkillTags); if (null != skill_input_data) { skill_blear_radius = skill_input_data.targetChooseRange; } } if (Physics.Raycast(ray, out hitInfo, 200f, layermask)) { start_touch_worldpos = hitInfo.point; GameObject go = DashFire.LogicSystem.PlayerSelf; if (null != go) { Vector3 srcPos = go.transform.position; Vector3 targetPos = start_touch_worldpos; float length = Vector3.Distance(srcPos, targetPos); RaycastHit airWallHitInfo = new RaycastHit(); int airWallLayermask = 1 << LayerMask.NameToLayer("AirWall"); Vector3 direction = (targetPos - srcPos).normalized; if (Physics.Raycast(go.transform.position, direction, out airWallHitInfo, length, airWallLayermask)) { BoxCollider bc = airWallHitInfo.collider.gameObject.GetComponent <BoxCollider>(); if (null != bc && !bc.isTrigger) { start_touch_worldpos = airWallHitInfo.point; } } } Collider[] hitObjs = Physics.OverlapSphere(start_touch_worldpos, skill_blear_radius, (1 << LayerMask.NameToLayer("Character"))); if (hitObjs.Length > 0) { start_touch_worldpos = hitObjs[0].gameObject.transform.position; } } return(start_touch_worldpos); }
private bool CanBreakSkill(GameObject obj) { BaseSkillManager bsm = obj.GetComponent <BaseSkillManager>(); if (null != bsm) { SkillControllerInterface sc = bsm.GetSkillController(); if (null != sc) { return(sc.IsCurSkillCanBreakByImpact()); } } return(true); }
private SkillControllerInterface GetControl() { SkillControllerInterface SkillCtrl = null; GameObject go = GameObject.FindGameObjectWithTag("Player"); if (null != go) { BaseSkillManager skill_Manager = go.GetComponent <BaseSkillManager>(); if (null != skill_Manager) { SkillCtrl = skill_Manager.GetSkillController(); } } return(SkillCtrl); }
public SkillControllerInterface GetControl() { SkillControllerInterface SkillCtrl = null; GameObject go = DashFire.LogicSystem.PlayerSelf; if (null != go) { BaseSkillManager skill_Manager = go.GetComponent <BaseSkillManager>(); if (null != skill_Manager) { SkillCtrl = skill_Manager.GetSkillController(); } } return(SkillCtrl); }
private void BreakCurSkill(GameObject obj) { BaseSkillManager bsm = obj.GetComponent <BaseSkillManager>(); if (null != bsm) { if (!bsm.IsUsingSkill()) { return; } SkillControllerInterface sc = bsm.GetSkillController(); if (null != sc) { sc.ForceStopCurSkill(); } } }
private Vector2 CalcSectionStartPos(EasyGesture gesture, Vector2 cp, Vector2 lp, Section section, Vector2 startpos) { ///Qte SkillControllerInterface skill_ctrl = gesture.GetControl(); if (null != skill_ctrl) { List <SkillNode> nodeInfo = skill_ctrl.QuerySkillQE(ActiveSkill, (int)section); if (null != nodeInfo && nodeInfo.Count > 0) { QteEnable = true; } else { QteEnable = false; } } /// Vector2 start_pos = Vector2.zero; if (Section.Second == section) { switch (ActiveSkill) { case SkillCategory.kSkillA: if (cp.x < lp.x) { start_pos = cp; } if (DetectionQTE(section, startpos, cp, EasySectionArg.UIMode.Horizontal)) { start_pos = cp; } break; case SkillCategory.kSkillB: if (cp.y > lp.y) { start_pos = cp; } if (DetectionQTE(section, startpos, cp, EasySectionArg.UIMode.Vertical)) { start_pos = cp; } break; case SkillCategory.kSkillC: if (cp.x > lp.x) { start_pos = cp; } if (DetectionQTE(section, startpos, cp, EasySectionArg.UIMode.Horizontal)) { start_pos = cp; } break; case SkillCategory.kSkillD: if (cp.y < lp.y) { start_pos = cp; } if (DetectionQTE(section, startpos, cp, EasySectionArg.UIMode.Vertical)) { start_pos = cp; } break; } } else if (Section.Third == section) { switch (ActiveSkill) { case SkillCategory.kSkillA: if (cp.x > lp.x) { start_pos = cp; } if (DetectionQTE(section, startpos, cp, EasySectionArg.UIMode.Horizontal)) { start_pos = cp; } break; case SkillCategory.kSkillB: if (cp.y < lp.y) { start_pos = cp; } if (DetectionQTE(section, startpos, cp, EasySectionArg.UIMode.Vertical)) { start_pos = cp; } break; case SkillCategory.kSkillC: if (cp.x < lp.x) { start_pos = cp; } if (DetectionQTE(section, startpos, cp, EasySectionArg.UIMode.Horizontal)) { start_pos = cp; } break; case SkillCategory.kSkillD: if (cp.y > lp.y) { start_pos = cp; } if (DetectionQTE(section, startpos, cp, EasySectionArg.UIMode.Vertical)) { start_pos = cp; } break; } } return(start_pos); }