Beispiel #1
0
 private void InitShadow(GhostShadow item)
 {
     for (int i = 0; i < _renderers.Length; i++)
     {
         item.Init(i, _renderers[i].material, GetShader(), Despwan);
     }
 }
Beispiel #2
0
 public void StopGhostShadow()
 {
     if (m_ghostShadow != null)
     {
         m_ghostShadow.enabled = false;
         GameObject.Destroy(m_ghostShadow);
         m_ghostShadow = null;
     }
 }
Beispiel #3
0
 private void UpdateShadow(GhostShadow item)
 {
     for (int i = 0; i < _renderers.Length; i++)
     {
         Mesh mesh = new Mesh();
         _renderers[i].BakeMesh(mesh);
         item.UpdateMesh(i, mesh, _renderers[i].transform.position, _renderers[i].transform.rotation);
     }
 }
Beispiel #4
0
    public void BeginGhostShadow(Color color)
    {
        m_ghostShadow = GetComponent <GhostShadow>();
        if (m_ghostShadow == null)
        {
            m_ghostShadow = gameObject.AddComponent <GhostShadow>();
        }

        m_ghostShadow.m_Color      = color;
        m_ghostShadow.m_bOpenGhost = true;
    }
Beispiel #5
0
        public void SetGhostShadow(bool bShow)
        {
            if (m_object == null)
            {
                return;
            }

            GhostShadow gs = GhostShadow.Get(m_object);

            gs.SetShow(bShow);
        }
Beispiel #6
0
        private object OnShowShadow(params object[] objs)
        {
            bool b = (bool)objs[0];

            if (null == gs)
            {
                if (null == Owner.BodyGo)
                {
                    return(null);
                }
                gs = Owner.BodyGo.AddComponent <GhostShadow>();
            }
            gs.subMeshs = Owner.property.weapon;
            gs.enabled  = b;
            return(null);
        }
Beispiel #7
0
    public void Spwan()
    {
        GhostShadow item = null;

        if (_inactiveList.Count > 0)
        {
            item = _inactiveList[0];
            _inactiveList.Remove(item);
        }
        else
        {
            item = SpawnNew();
            InitShadow(item);
        }

        item.SetActive(true);
        UpdateShadow(item);
        _activeList.Add(item);
    }
Beispiel #8
0
    public void CreateGhostShadow(string s)
    {
        //解析数据
        float   holdTime          = 0;
        float   freneselIntensity = 0;
        Vector4 beginColor        = Vector4.zero;
        Vector4 endColor          = Vector4.zero;

        string[] paramsList = s.Split(';');
        for (int i = 0; i < paramsList.Length; i++)
        {
            string[] nameValueList = paramsList[i].Split(':');
            switch (nameValueList[0])
            {
            case "chixushijian(s)":
            {
                holdTime = float.Parse(nameValueList[1]);
            }
            break;

            case "bianyuankuandu":
            {
                freneselIntensity = float.Parse(nameValueList[1]);
            }
            break;

            case "kaishiyanse(RGBA)":
            {
                beginColor = ParaseVector4(nameValueList[1]);
            }
            break;

            case "jieshuyanse(RGBA)":
            {
                endColor = ParaseVector4(nameValueList[1]);
            }
            break;
            }
        }

        GhostShadow.CreateGhostShadow(gameObject, holdTime, freneselIntensity, beginColor, endColor);
    }
Beispiel #9
0
    public static void CreateGhostShadow(GameObject obj, float holdTime, float freneselIntensity, Vector4 beginColor, Vector4 endColor)
    {
        Animation animation = obj.GetComponentInChildren <Animation>();

        if (animation == null)
        {
            return;
        }

        AnimationState curState = GetCurPlayAnimation(animation);

        if (curState != null)
        {
            //clone对象
            GameObject gsObj = Instantiate(obj);
            gsObj.transform.parent   = null;
            gsObj.transform.name     = obj.transform.name + "(GhostShadow)";
            gsObj.transform.position = obj.transform.position;
            gsObj.transform.rotation = obj.transform.rotation;
            GhostShadowCreator gsc = gsObj.GetComponentInChildren <GhostShadowCreator>();
            if (gsc != null)
            {
                gsc.enabled = false;
            }

            //初始化残影数据
            GhostShadow gsScrpit = gsObj.AddComponent <GhostShadow>();
            gsScrpit.SetHoldTime(holdTime);
            gsScrpit.SetFreneselIntensity(freneselIntensity);
            gsScrpit.SetBeginColor(beginColor);
            gsScrpit.SetEndColor(endColor);

            //定格动画
            Animation gsAnimation = gsObj.GetComponentInChildren <Animation>();
            if (gsAnimation != null)
            {
                gsAnimation[curState.name].time  = curState.time;
                gsAnimation[curState.name].speed = 0;
                gsAnimation.Play(curState.name);
            }
        }
    }
Beispiel #10
0
 private void Awake()
 {
     ghostShadow = this;
 }
Beispiel #11
0
 private void Despwan(GhostShadow item)
 {
     _activeList.Remove(item);
     _inactiveList.Add(item);
     item.SetActive(false);
 }