Пример #1
0
        private void PointDown()
        {
            m_ChainInfo.StartStronghold = null;
            m_ChainInfo.EndStronghold   = null;
            if (m_ChainInfo.LineList == null)
            {
                m_ChainInfo.LineList = new List <Line>();
            }
            m_ChainInfo.LineList.Clear();
            //第一个点
            m_Line       = null;
            m_LineOrigin = null;
            Cell c = GetCell(Input.mousePosition);

            if (c != null)
            {
                Stronghold s = c.GetStronghold();
                if (s != null)
                {
                    if (!s.HasConnectStronghold())
                    {
                        bool isOk = true;
                        if (GameLevelSceneCtrl.Instance.IsGuide)
                        {
                            if (GameLevelSceneCtrl.Instance.ContainsGuideObj(c.gameObject))
                            {
                                isOk = true;
                            }
                            else
                            {
                                isOk = false;
                            }
                        }
                        if (isOk)
                        {
                            GameObject go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.Item, "Building/Line", isCache: true, isClone: true);
                            m_Line = go.GetComponent <Line>();
                            m_Line.AddCell(c);
                            m_LineOrigin  = c;
                            m_Line.Parent = null;
                            m_ChainInfo.Start(s, OnValidLineCountChange);
                            m_ChainInfo.AddLine(m_Line);
                            EazySoundManager.PlaySound(ClickStronghold);
                        }
                    }
                    else
                    {
                        ChainInfo info = m_AllChainInfo.Find(x => x.StartStronghold == s || x.EndStronghold == s);
                        if (!info.IsEmpty())
                        {
                            m_AllChainInfo.Remove(info);
                            info.Destory();
                        }
                    }
                }
            }
        }
Пример #2
0
        public ChainInfo Clone()
        {
            ChainInfo info = new ChainInfo();

            info.StartStronghold = StartStronghold;
            info.EndStronghold   = EndStronghold;
            info.LineList        = new List <Line>();
            for (int i = 0; i < LineList.Count; i++)
            {
                info.LineList.Add(LineList[i]);
            }
            return(info);
        }