示例#1
0
 void Start()
 {
     // StartParts() ;
     //_setting = new Setting(10 , 5 , 0.5f , -0.5f ,0.02f , 2f) ;
     _tentacleData = new TentacleData(20, 5, 0.5f, 0.2f);
     lineRenderer  = GetComponent <LineRenderer> ();
 }
示例#2
0
	void Start () 
	{
		m_LineRenderer = GetComponent<LineRenderer> ();
		m_EdgeCollider = GetComponent<EdgeCollider2D> ();
		// StartParts() ;
		_setting = new Setting(5 , 5 , 0f , 0f ,0.02f , 2f) ;
		_tentacleData = new TentacleData(20 , 2 , 0.5f , 0.2f);

	}
示例#3
0
    /*
     * float revealVal = 0;
     * private void Update()
     * {
     *  if (Input.GetKey(KeyCode.A))
     *  {
     *      revealVal -= 0.005f;
     *      Debug.Log("reveal : " + revealVal);
     *  }
     *  if (Input.GetKey(KeyCode.D))
     *  {
     *      revealVal += 0.005f;
     *      Debug.Log("reveal : " + revealVal);
     *  }
     *  MonsterReveal(revealVal);
     * }*/

    private TentacleData NewTentacle(float rotation)
    {
        GameObject newTentacle = Instantiate(tentaclePrefab, transform);

        newTentacle.transform.localPosition    = new Vector3(0, 0, 40);
        newTentacle.transform.localScale       = Vector3.one;
        newTentacle.transform.localEulerAngles = new Vector3(0, 0, rotation);



        TentacleData newTentacleData = new TentacleData();

        newTentacleData.seed                 = Random.Range(0, 1000);
        newTentacleData.parentTransform      = newTentacle.transform;
        newTentacleData.components           = newTentacle.GetComponent <TentacleComponents>();
        newTentacleData.parentOriginRotation = newTentacle.transform.localEulerAngles;

        return(newTentacleData);
    }
示例#4
0
文件: ViewStatus.cs 项目: xqy/game
    /// <summary>
    /// B后撤一步
    /// </summary>
    /// <param name="data"></param>
    private void retreatB(TentacleData data)
    {
        CellData cellA = cellDataList[data.indexA];
        CellData cellB = cellDataList[data.indexB];

        int n = 1;
        if (cellA.camp != cellB.camp && data.cutStatus == CutStatus.CUT_A)
        {
            n = -1;
        }
        if (data.nodeListB[0])
        {
            n *= 2;
        }
        data.nodeListB.RemoveAt(0);
        hpChange(cellB, n, cellA.camp);

        if (data.cutStatus == CutStatus.CUT_A && data.nodeListB.Count == 0)
        {
            data.cutStatus = CutStatus.NONE;
        }
    }
示例#5
0
文件: ViewStatus.cs 项目: xqy/game
 /// <summary>
 /// B传输一步
 /// </summary>
 private void pkB(TentacleData data)
 {
     int len = data.nodeListB.Count;
     if (data.nodeListB[len - 1])
     {
         CellData cellA = cellDataList[data.indexA];
         CellData cellB = cellDataList[data.indexB];
         int n = 1;
         if (cellA.camp != cellB.camp)
         {
             n = -1;
         }
         hpChange(cellA, n, cellB.camp);
     }
     data.nodeListB.RemoveAt(len - 1);
     data.nodeListB.Insert(0, false);
 }
示例#6
0
文件: ViewStatus.cs 项目: xqy/game
    /// <summary>
    /// 获取触手下回动作
    /// </summary>
    /// <returns></returns>
    private int getTentacleNextTime()
    {
        int nextTime = int.MaxValue;
        outTentacleData = null;
        outTenStatus = TenStatus.NONE;
        int countA;
        int countB;

        foreach (TentacleData data in tentacleDataDic.Values)
        {
            countA = data.nodeListA.Count;
            countB = data.nodeListB.Count;

            if (!data.isAttackA)    //A未进攻
            {
                if (countA > 0 && nextTime > data.timeA + CellConstant.MOVE_RETREAT)
                {
                    outTenStatus = TenStatus.MOVE_RETREAT_A;  //在撤退或切断
                    outTentacleData = data;
                    nextTime = data.timeA + CellConstant.MOVE_RETREAT;
                }
            }
            else                   //A在进攻
            {
                if (countA == data.count &&
                    nextTime > data.timeA + CellConstant.MOVE_PK)
                {
                    outTenStatus = TenStatus.MOVE_PK_A;   //单方输出
                    outTentacleData = data;
                    nextTime = data.timeA + CellConstant.MOVE_PK;
                }
                else if (countA == Mathf.Floor(data.count / 2) && data.isAttackB &&
                    countA + countB == data.count &&
                    nextTime > data.timeA + CellConstant.MOVE_PK)
                {
                    outTenStatus = TenStatus.MOVE_PK_A;   //比拼消耗
                    outTentacleData = data;
                    nextTime = data.timeA + CellConstant.MOVE_PK;
                }
                else if (countA + countB != data.count &&
                    nextTime > data.timeA + CellConstant.MOVE_ATTACK)
                {
                    outTenStatus = TenStatus.MOVE_ATTACK_A;   //A右移
                    outTentacleData = data;
                    nextTime = data.timeA + CellConstant.MOVE_ATTACK;
                }
                else if (countA + countB == data.count &&
                    countA < Mathf.Floor(data.count / 2) &&
                    nextTime > data.timeA + CellConstant.MOVE_ATTACK)
                {
                    outTenStatus = TenStatus.MOVE_AB_A;   //整体右移
                    outTentacleData = data;
                    nextTime = data.timeA + CellConstant.MOVE_ATTACK;
                }
            }

            if (!data.isAttackB)    //B未进攻
            {
                if (countB > 0 && nextTime > data.timeB + CellConstant.MOVE_RETREAT)
                {
                    outTenStatus = TenStatus.MOVE_RETREAT_B;  //在撤退或切断
                    outTentacleData = data;
                    nextTime = data.timeB + CellConstant.MOVE_RETREAT;
                }
            }
            else                   //B在进攻
            {
                if (countB == data.count &&
                    nextTime > data.timeB + CellConstant.MOVE_PK)
                {
                    outTenStatus = TenStatus.MOVE_PK_B;   //单方输出
                    outTentacleData = data;
                    nextTime = data.timeB + CellConstant.MOVE_PK;
                }
                else if (countB == Mathf.Ceil(data.count / 2) && data.isAttackA &&
                    countA + countB == data.count &&
                    nextTime > data.timeB + CellConstant.MOVE_PK)
                {
                    outTenStatus = TenStatus.MOVE_PK_B;   //比拼消耗
                    outTentacleData = data;
                    nextTime = data.timeB + CellConstant.MOVE_PK;
                }
                else if (countA + countB != data.count &&
                    nextTime > data.timeB + CellConstant.MOVE_ATTACK)
                {
                    outTenStatus = TenStatus.MOVE_ATTACK_B;   //B左移
                    outTentacleData = data;
                    nextTime = data.timeB + CellConstant.MOVE_ATTACK;
                }
                else if (countA + countB == data.count &&
                    countB < Mathf.Ceil(data.count / 2) &&
                    nextTime > data.timeB + CellConstant.MOVE_ATTACK)
                {
                    outTenStatus = TenStatus.MOVE_AB_B;   //整体左移
                    outTentacleData = data;
                    nextTime = data.timeB + CellConstant.MOVE_ATTACK;
                }
            }
        }
        return nextTime;
    }
示例#7
0
文件: ViewStatus.cs 项目: xqy/game
 /// <summary>
 /// B行进一步
 /// </summary>
 /// <param name="data"></param>
 private bool attackB(TentacleData data)
 {
     if (cellDataList[data.indexB].hp > 0)
     {
         data.nodeListB.Insert(0, false);
         cellDataList[data.indexB].hp--;
         return true;
     }
     else
     {
         data.isAttackB = false;
         return false;
     }
 }
示例#8
0
文件: ViewStatus.cs 项目: xqy/game
    /// <summary>
    /// 创建TentacleData
    /// </summary>
    /// <param name="indexA"></param>
    /// <param name="indexB"></param>
    /// <returns></returns>
    public TentacleData getTentacleData(int indexA, int indexB)
    {
        if (indexA > indexB)
        {
            int t = indexA;
            indexA = indexB;
            indexB = t;
        }
        string key = indexA + ":" + indexB;

        if (tentacleDataDic.ContainsKey(key))
        {
            return tentacleDataDic[key];
        }
        else
        {
            TentacleData tentacleData = new TentacleData(this);
            tentacleData.indexA = indexA;
            tentacleData.indexB = indexB;
            tentacleData.count = getTentacleNodeNum(indexA, indexB);
            tentacleDataDic.Add(key, tentacleData);
            return tentacleData;
        }
    }
示例#9
0
文件: ViewStatus.cs 项目: xqy/game
 public TentacleData clone()
 {
     TentacleData data = new TentacleData(viewStatus);
     data.count = count;
     data.indexA = indexA;
     data.indexB = indexB;
     data.cutStatus = cutStatus;
     data.isAttackA = isAttackA;
     data.isAttackB = isAttackB;
     data.nodeListA = new List<bool>(nodeListA);
     data.nodeListB = new List<bool>(nodeListB);
     data.timeA = timeA;
     data.timeB = timeB;
     return data;
 }
示例#10
0
 void Start()
 {
     // StartParts() ;
     _setting      = new Setting(10, 5, 0.5f, -0.5f, 0.02f, 2f);
     _tentacleData = new TentacleData(20, 2, 0.5f, 0.2f);
 }