// Use this for initialization internal void Start() { Application.targetFrameRate = 60; QualitySettings.vSyncCount = 1; QualitySettings.SetQualityLevel(1); try { if (!GameControler.IsInited) { Application.runInBackground = true; string dataPath = Application.dataPath; string persistentDataPath = Application.persistentDataPath; string streamingAssetsPath = Application.streamingAssetsPath; string tempPath = Application.temporaryCachePath; LogicSystem.GfxLog("dataPath:{0} persistentDataPath:{1} streamingAssetsPath:{2} tempPath:{3}", dataPath, persistentDataPath, streamingAssetsPath, tempPath); #if UNITY_ANDROID GameControler.InitGame(tempPath, streamingAssetsPath); #elif UNITY_IPHONE GameControler.InitGame(tempPath, streamingAssetsPath); #else GameControler.InitGame(dataPath, streamingAssetsPath); #endif GlobalVariables.Instance.IsMobile = true; GameControler.StartGame(); LogicSystem.SetLoadingBarScene("LoadingBar"); //LogicSystem.PublishLogicEvent("ge_change_scene", "game", 6); Application.LoadLevel("Loading"); } } catch (Exception ex) { LogicSystem.GfxLog("GameLogic.Start throw exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
// Anim public static bool PlayAnims(GameObject target, params SkillAnimInfo[] infos) { Animation animCom = target.GetComponent <Animation>(); if (animCom == null) { LogicSystem.GfxLog("PlayAnim animation component miss!"); return(false); } for (int i = 0; i < infos.Length; ++i) { SkillAnimInfo info = infos[i]; if (info == null || info.AnimName == null || animCom[info.AnimName.name] == null) { continue; } animCom[info.AnimName.name].speed = info.AnimSpeed; animCom[info.AnimName.name].wrapMode = info.AnimWrapMode; animCom[info.AnimName.name].layer = info.AnimLayer; animCom.PlayQueued(info.AnimName.name, QueueMode.CompleteOthers); } return(true); }
public static void ChangeWeapon(GameObject target, SkillWeaponInfo param) { WeaponControl control = target.GetComponent <WeaponControl>(); if (control == null) { LogicSystem.GfxLog("ShooterSkillExecutor WeaponControl Script miss!"); } control.ChangeWeapon(param); }
public static void SwitchNextWeapon(GameObject target) { WeaponControl control = target.GetComponent <WeaponControl>(); if (control == null) { LogicSystem.GfxLog("SwitchWeapon WeaponControl Script miss!"); return; } control.SwitchNextWeapon(); }
public static void StartMoveScale(GameObject target, SkillMoveScaleInfo info) { MovementControl tLockFrame = target.gameObject.GetComponent <MovementControl>(); if (tLockFrame == null) { LogicSystem.GfxLog("StartMoveScale component miss!"); return; } tLockFrame.StartMoveScale(info); }
public static void StartLockFrame(GameObject target, SkillLockFrameInfo info) { SkillLockFrame tLockFrame = target.gameObject.GetComponent <SkillLockFrame>(); if (tLockFrame == null) { LogicSystem.GfxLog("Trigger_LockFrame component miss!"); return; } tLockFrame.StartLockFrame(info); }
public static void ChangeSkillByCategory(GameObject target, SkillCategory category, int skillId) { ShooterSkillManager mgr = target.GetComponent <ShooterSkillManager>(); if (mgr == null) { LogicSystem.GfxLog("GetCurSkill skill manager miss!"); return; } mgr.ChangeSkillByCategory(category, skillId); }
public static SkillLockFrameInfo GetLockFrameInfoById(GameObject target, int id) { SkillSceneObjManager tSceneObjMgr = target.GetComponent <SkillSceneObjManager>(); if (tSceneObjMgr == null) { LogicSystem.GfxLog("SkillSceneObjManager miss!"); return(null); } return(tSceneObjMgr.TryGetSkillLockFrameInfo(id)); }
public static void SetFacePos(GameObject target, Vector3 targetPos, MathRange YRotateRange) { ShooterSkillManager mgr = target.GetComponent <ShooterSkillManager>(); if (mgr == null) { LogicSystem.GfxLog("SetFacePos skill manager miss!"); return; } mgr.SetFacePos(targetPos, YRotateRange); }
internal void Start() { m_SceneObjMgr = gameObject.GetComponent <SkillSceneObjManager>(); if (m_SceneObjMgr == null) { LogicSystem.GfxLog("ShooterSkillTrigger miss!"); return; } TriggerImpl.OnGetSkillSoundInfo = m_SceneObjMgr.TryGetSkillSoundInfo; }
public static SkillAnimInfo GetDefaultAnimInfo(GameObject target) { ShooterSkillManager mgr = target.GetComponent <ShooterSkillManager>(); if (mgr == null) { LogicSystem.GfxLog("GetDefaultAnimInfo control miss!"); return(null); } return(mgr.DefaultAnimInfo); }
public static void HideJoyStick(GameObject target) { ShooterSkillManager mgr = target.GetComponent <ShooterSkillManager>(); if (mgr == null) { LogicSystem.GfxLog("HideJoyStick control miss!"); return; } mgr.HideJoyStick(); }
public static void StopMove(GameObject target) { MovementControl mgr = target.GetComponent <MovementControl>(); if (mgr == null) { LogicSystem.GfxLog("StartMove movement control miss!"); return; } mgr.StopMove(); }
public static void NotifyIngoreGravity(GameObject target, bool isIngore) { MovementControl mgr = target.GetComponent <MovementControl>(); if (mgr == null) { LogicSystem.GfxLog("NotifyIngoreGravity control miss!"); return; } mgr.NotifyIngoreGravity(isIngore); }
public static int GetCurWeaponId(GameObject target, MasterWeaponType masterType = MasterWeaponType.Master) { WeaponControl control = target.GetComponent <WeaponControl>(); if (control == null) { LogicSystem.GfxLog("ShooterSkillExecutor GetCurWeaponId Script miss!"); return(-1); } return(control.GetCurWeaponId(masterType)); }
public static GameObject GetCurTarget(GameObject target) { SkillTargetControl control = target.GetComponent <SkillTargetControl>(); if (control == null) { LogicSystem.GfxLog("GetCurTarget control miss!"); return(null); } return(control.GetCurTarget()); }
public static void ResetTarget(GameObject target) { SkillTargetControl control = target.GetComponent <SkillTargetControl>(); if (control == null) { LogicSystem.GfxLog("ResetTarget control miss!"); return; } control.ResetTarget(); }
public static IShooterSkill GetCurSkill(GameObject target) { ShooterSkillManager mgr = target.GetComponent <ShooterSkillManager>(); if (mgr == null) { LogicSystem.GfxLog("GetCurSkill skill manager miss!"); return(null); } return(mgr.GetCurPlaySkill()); }
public static GameObject GetWeaponByHand(GameObject target, WeaponHand hand) { WeaponControl control = target.GetComponent <WeaponControl>(); if (control == null) { LogicSystem.GfxLog("ShooterSkillExecutor WeaponControl Script miss!"); return(null); } return(control.GetWeaponByHand(hand)); }
public static bool IsAnimPlaying(GameObject target, SkillAnimInfo info) { Animation animCom = target.GetComponent <Animation>(); if (animCom == null || info == null || info.AnimName == null || animCom[info.AnimName.name] == null) { LogicSystem.GfxLog("IsAnimPlaying animation component miss!"); return(false); } return(animCom.IsPlaying(info.AnimName.name) && animCom[info.AnimName.name].normalizedTime < 1.0f); }
public static bool StopAllAnim(GameObject target) { Animation animCom = target.GetComponent <Animation>(); if (animCom == null) { LogicSystem.GfxLog("PlayAnim animation component miss!"); return(false); } animCom.Stop(); return(true); }
public static bool GetCurTargetPos(GameObject target, out Vector3 targetPos) { targetPos = Vector3.zero; SkillTargetControl control = target.GetComponent <SkillTargetControl>(); if (control == null) { LogicSystem.GfxLog("GetCurTargetPos control miss!"); return(false); } return(control.GetCurTargetPos(out targetPos)); }
public static bool FadeOutAnim(GameObject target, SkillAnimInfo info) { Animation animCom = target.GetComponent <Animation>(); if (animCom == null || info == null || info.AnimName == null || animCom[info.AnimName.name] == null) { LogicSystem.GfxLog("PlayAnim animation component miss!"); return(false); } animCom[info.AnimName.name].weight = 0.0f; return(true); }
public static float GetAnimTime(GameObject target, SkillAnimInfo info, float tweak = 0.0f) { Animation animCom = target.GetComponent <Animation>(); if (animCom == null || info == null || info.AnimName == null || animCom[info.AnimName.name] == null) { LogicSystem.GfxLog("GetAnimTime animation component miss!"); return(0); } float speed = Mathf.Max(info.AnimSpeed, 0.001f); return(animCom[info.AnimName.name].length / speed - tweak); }
public static void RecordTarget(GameObject target, GameObject target2) { SkillTargetControl control = target.GetComponent <SkillTargetControl>(); if (control == null) { LogicSystem.GfxLog("RecordTarget control miss!"); return; } if (TriggerImpl.GetCharacterCamp(target2) != 0) { control.RecordTarget(target2); } }
////////////////////////////////////////////////////////////////////////// // Anim public static bool PlayAnim(GameObject target, SkillAnimInfo info) { Animation animCom = target.GetComponent <Animation>(); if (animCom == null || info == null || info.AnimName == null || animCom[info.AnimName.name] == null) { LogicSystem.GfxLog("PlayAnim animation component miss!"); return(false); } animCom[info.AnimName.name].speed = info.AnimSpeed; animCom[info.AnimName.name].wrapMode = info.AnimWrapMode; animCom[info.AnimName.name].layer = info.AnimLayer; animCom.CrossFade(info.AnimName.name, info.AnimCrossFadeTime); return(true); }
public static void StartMoveById(GameObject target, int id) { SkillSceneObjManager m_SceneObjMgr = target.GetComponent <SkillSceneObjManager>(); if (m_SceneObjMgr == null) { LogicSystem.GfxLog("StartMoveById miss!"); return; } SkillMovementInfo moveInfo = m_SceneObjMgr.TryGetSkillMovementInfo(id); if (moveInfo != null) { StartMove(target, moveInfo); } }
public static void ForceStartSkillById(GameObject target, SkillCategory category, Vector3 targetpos) { ShooterSkillManager mgr = target.GetComponent <ShooterSkillManager>(); if (mgr == null) { LogicSystem.GfxLog("GetCurSkill skill manager miss!"); return; } ShooterControlHandler control = (ShooterControlHandler)(mgr.GetSkillController()); if (control != null) { control.ForceStartSkillById(category, targetpos); } }
public static GameObject CreateGameObjectByAsset(GameObject asset) { if (asset == null) { LogicSystem.GfxLog("CreateGameObjectByAsset load resource failed:{0}", asset.name); return(null); } GameObject effect = GameObject.Instantiate(asset) as GameObject; if (effect == null) { LogicSystem.GfxLog("CreateGameObjectByName Instantiate resource failed:{0}", asset.name); return(null); } return(effect); }
public static GameObject CreateGameObjectByName(string name) { UnityEngine.Object effect_prefab = Resources.Load(name); if (effect_prefab == null) { LogicSystem.GfxLog("CreateGameObjectByName load resource failed:{0}", name); return(null); } GameObject effect = GameObject.Instantiate(effect_prefab) as GameObject; if (effect == null) { LogicSystem.GfxLog("CreateGameObjectByName Instantiate resource failed:{0}", name); return(null); } return(effect); }