示例#1
0
 private void CreateGameObjectImpl(int id, string resource, SharedGameObjectInfo info)
 {
     if (null != info)
     {
         try {
             Vector3 pos = new Vector3(info.X, info.Y, info.Z);
             if (!info.IsFloat && null != Terrain.activeTerrain)
             {
                 pos.y = Terrain.activeTerrain.SampleHeight(pos);
             }
             Quaternion q   = Quaternion.Euler(0, RadianToDegree(info.FaceDir), 0);
             GameObject obj = ResourceManager.Instance.NewObject(resource) as GameObject;
             if (null != obj)
             {
                 if (null != obj.transform)
                 {
                     obj.transform.position      = pos;
                     obj.transform.localRotation = q;
                     obj.transform.localScale    = new Vector3(info.Sx, info.Sy, info.Sz);
                 }
                 RememberGameObject(id, obj, info);
                 obj.SetActive(true);
             }
             else
             {
                 CallGfxLog("CreateGameObject {0} can't load resource", resource);
             }
         } catch (Exception ex) {
             CallGfxLog("CreateGameObject {0} throw exception:{1}\n{2}", resource, ex.Message, ex.StackTrace);
         }
     }
 }
示例#2
0
 public virtual bool StartSkill()
 {
     if (!CanStart())
     {
         return(false);
     }
     ImpactSystem.Instance.StopAllImpacts(gameObject);
     LogicSystem.NotifyGfxAnimationStart(gameObject);
     if (m_IsControlMove)
     {
         LogicSystem.NotifyGfxMoveControlStart(gameObject);
     }
     m_Status                 = MyCharacterStatus.kSkilling;
     m_StartTime              = Time.time;
     m_IsSkillActive          = true;
     m_IsHaveCollideMoveCurve = false;
     m_ClampedTime            = 0;
     if (m_ColliderManager != null)
     {
         m_ColliderManager.ClearColliders();
     }
     if (m_RageCast > 0)
     {
         DashFire.SharedGameObjectInfo selfObjInfo = DashFire.LogicSystem.GetSharedGameObjectInfo(gameObject);
         DashFire.LogicSystem.NotifyGfxHitTarget(gameObject, m_CostImpact, gameObject, 0);
     }
     return(true);
 }
示例#3
0
        internal SharedGameObjectInfo GetSharedGameObjectInfo(int id)
        {
            SharedGameObjectInfo ret = null;

            if (m_GameObjects.ContainsKey(id))
            {
                ret = m_GameObjects[id].ObjectInfo;
            }
            return(ret);
        }
示例#4
0
        public static void NotifyGfxMoveMeetObstacle(GameObject obj)
        {
            SharedGameObjectInfo info = GfxSystem.Instance.GetSharedGameObjectInfo(obj);

            if (null != info)
            {
                if (null != GfxSystem.Instance.GameLogicNotification)
                {
                    QueueLogicAction(() => { GfxSystem.Instance.GameLogicNotification.OnGfxMoveMeetObstacle(info.m_LogicObjectId); });
                }
            }
        }
示例#5
0
 public virtual bool IsInCD()
 {
     if (Time.time <= m_CDBeginTime + m_CD)
     {
         return(true);
     }
     DashFire.SharedGameObjectInfo selfObjInfo = DashFire.LogicSystem.GetSharedGameObjectInfo(gameObject);
     if (selfObjInfo == null || selfObjInfo.Blood <= 0 || selfObjInfo.Rage < m_RageCast)
     {
         return(true);
     }
     return(false);
 }
示例#6
0
        public static void NotifyGfxAnimationStart(GameObject obj)
        {
            SharedGameObjectInfo info = GfxSystem.Instance.GetSharedGameObjectInfo(obj);

            if (null != info)
            {
                info.IsGfxAnimation = true;

                //GfxLog("NotifyGfxAnimationStart:{0}", info.m_LogicObjectId);
            }
            else
            {
                GfxLog("NotifyGfxAnimationStart:{0}, can't find object !", obj.name);
            }
        }
示例#7
0
        public static void NotifyGfxMoveControlFinish(GameObject obj)
        {
            SharedGameObjectInfo info = GfxSystem.Instance.GetSharedGameObjectInfo(obj);

            if (null != info)
            {
                info.IsGfxMoveControl = false;

                //GfxLog("NotifyGfxMoveControlFinish:{0}", info.m_LogicObjectId);
            }
            else
            {
                GfxLog("NotifyGfxMoveControlFinish:{0}, can't find object !", obj.name);
            }
        }
示例#8
0
        public static void NotifyGfxUpdatePosition(GameObject obj, float x, float y, float z)
        {
            SharedGameObjectInfo info = GfxSystem.Instance.GetSharedGameObjectInfo(obj);

            if (null != info)
            {
                info.X = x;
                info.Y = y;
                info.Z = z;
                info.DataChangedByGfx = true;
            }
            else
            {
                GfxLog("NotifyGfxUpdatePosition:{0} {1} {2} {3}, can't find object !", obj.name, x, y, z);
            }
        }
示例#9
0
 private void RememberGameObject(int id, GameObject obj, SharedGameObjectInfo info)
 {
     if (m_GameObjects.ContainsKey(id))
     {
         GameObject oldObj = m_GameObjects[id].ObjectInstance;
         oldObj.SetActive(false);
         m_GameObjectIds.Remove(oldObj);
         GameObject.Destroy(oldObj);
         m_GameObjects[id] = new GameObjectInfo(obj, info);
     }
     else
     {
         m_GameObjects.Add(id, new GameObjectInfo(obj, info));
     }
     m_GameObjectIds.Add(obj, id);
 }
示例#10
0
        public static void NotifyGfxHitTarget(GameObject src, int impactId, GameObject target, int hitCount)
        {
            SharedGameObjectInfo srcInfo    = GfxSystem.Instance.GetSharedGameObjectInfo(src);
            SharedGameObjectInfo targetInfo = GfxSystem.Instance.GetSharedGameObjectInfo(target);

            if (null != srcInfo && null != targetInfo)
            {
                if (null != GfxSystem.Instance.GameLogicNotification)
                {
                    QueueLogicAction(() => { GfxSystem.Instance.GameLogicNotification.OnGfxHitTarget(srcInfo.m_LogicObjectId, impactId, targetInfo.m_LogicObjectId, hitCount); });
                }
            }
            else
            {
                GfxLog("NotifyGfxHitTarget:{0} {1} {2} {3}, can't find object !", src.name, impactId, target.name, hitCount);
            }
        }
示例#11
0
        private void CrossFadeAnimationImpl(int id, string animationName, float fadeLength, bool isStopAll)
        {
            GameObject           obj      = GetGameObject(id);
            SharedGameObjectInfo obj_info = GetSharedGameObjectInfo(id);

            if (null != obj && null != obj.animation)
            {
                try {
                    if (null != obj.animation[animationName] && obj_info != null && !obj_info.IsGfxAnimation)
                    {
                        obj.animation.CrossFade(animationName, fadeLength, isStopAll ? PlayMode.StopAll : PlayMode.StopSameLayer);
                        //CallLogicLog("Obj {0} CrossFadeAnimation {1} clipcount {2}", id, animationName, obj.animation.GetClipCount());
                    }
                    else
                    {
                        CallLogicLog("Obj {0} CrossFadeAnimation {1} AnimationState is null, clipcount {2}", id, animationName, obj.animation.GetClipCount());
                    }
                } catch {
                }
            }
        }
示例#12
0
    // Use this for initialization
    void Start()
    {
        m_ColliderManager = gameObject.GetComponent <SkillColliderManager>();
        m_SkillMovement   = gameObject.GetComponent <SkillMovement>();
        m_SelfObjInfo     = DashFire.LogicSystem.GetSharedGameObjectInfo(gameObject);
        if (m_SkillTipObjPrefab != null)
        {
            m_SkillTipObj = Instantiate(m_SkillTipObjPrefab, Vector3.zero, Quaternion.identity) as GameObject;
            m_SkillTipObj.SetActive(false);
        }
        if (m_SkillTipObj == null)
        {
            Debug.Log("--create skill tip obj failed!");
        }
        int weapon_count = m_WeaponsName.Length;

        m_Weapons       = new Transform[weapon_count];
        m_WeaponsParent = new Transform[weapon_count];
        for (int i = 0; i < weapon_count; i++)
        {
            string name = m_WeaponsName[i];
            if (!string.IsNullOrEmpty(name))
            {
                m_Weapons[i] = EffectManager.GetChildNodeByName(gameObject, name);
                if (m_Weapons[i] != null)
                {
                    m_WeaponsParent[i] = m_Weapons[i].parent;
                    continue;
                }
            }
            m_Weapons[i] = null;
        }
        SkillScript[] skills = gameObject.GetComponents <SkillScript>();
        m_Skills.AddRange(skills);
        m_NewSwordManController = new NewSwordManSkillController(this, m_Skills);
        m_NewSwordManController.Init();

        TouchManager.OnGestureEvent += OnGestureEvent;
    }
示例#13
0
    public virtual bool CanStart()
    {
        if (IsInCD())
        {
            return(false);
        }
        bool ret = false;

        if (IsNeedOnGround)
        {
            if (m_SkillMovement.IsGrounded())
            {
                ret = true;
            }
            else if (m_SkillMovement.GetHeightWithGround() <= MaxHeightWithGround)
            {
                ret = true;
            }
            else
            {
                ret = false;
            }
        }
        else
        {
            ret = (m_SkillMovement.GetHeightWithGround() >= MinHeightWithGround);
        }
        if (ret)
        {
            DashFire.SharedGameObjectInfo selfObjInfo = DashFire.LogicSystem.GetSharedGameObjectInfo(gameObject);
            if (selfObjInfo != null && selfObjInfo.Blood > 0 && selfObjInfo.Rage >= m_RageCast)
            {
                return(true);
            }
        }
        return(false);
    }
示例#14
0
    private List <GameObject> FiltUnEndureObj(List <GameObject> list)
    {
        List <GameObject> result = new List <GameObject>();

        foreach (GameObject obj in list)
        {
            if (obj == null)
            {
                continue;
            }
            CharacterCamp cc = obj.GetComponent <CharacterCamp>();
            if (cc == null || cc.m_IsEndure)
            {
                continue;
            }
            DashFire.SharedGameObjectInfo selfObjInfo = DashFire.LogicSystem.GetSharedGameObjectInfo(obj);
            if (selfObjInfo == null || selfObjInfo.Blood <= 0)
            {
                continue;
            }
            result.Add(obj);
        }
        return(result);
    }
示例#15
0
 public static void CreateGameObject(int id, string resource, SharedGameObjectInfo info)
 {
     s_Instance.m_GfxInvoker.QueueAction(s_Instance.CreateGameObjectImpl, id, resource, info);
 }
示例#16
0
 public GameObjectInfo(GameObject o, SharedGameObjectInfo i)
 {
     ObjectInstance = o;
     ObjectInfo     = i;
 }