Beispiel #1
0
    public override void IPauseUpdate()
    {
        if (IsUsed)
        {
            return;
        }
        //檢查是否撞到玩家執行物品效果
        if (!isValidPlayerPos())
        {
            if (!IsStop)//不是停止的道具才要新增下一個方塊
            {
                FindObjectOfType <Spawner>().spawnNext();
                //恢復可以按下往下按鈕
                m_moveAct.downPush = false;
                //移除監聽
                m_moveAct.DeletBtnListener();
            }

            mans[0].GetComponent <Man>().setItemGroup(this.gameObject.GetComponent <ItemGroup>());
            mans[0].GetComponent <Man>().setItemAction(m_manItemAct);
            m_itemAct.ActionStart(); //執行效果
            deletThisGroup();        //刪除grid中紀錄的格子
            Destroy(this.gameObject, 1f);
            IsUsed = true;           //已經使用了
            //Destroy(this.gameObject);//將自己刪除
            return;
        }
        if (IsStop)
        {
            return;
        }
        base.IPauseUpdate();
    }
Beispiel #2
0
    //public void DebugManAddSpeed(string str)
    // {
    //     try
    //     {
    //         float temp = float.Parse(str);
    //         if (temp > 0)
    //{
    //	Grid.getGrid.ManSpeed = temp;
    //	setManMoveable(new NormalManMove(this.gameObject, null));
    //}
    //    }
    //    catch
    //    {
    //        Debug.LogError("輸入錯誤 " + str);
    //    }
    //}

    public override void IPauseUpdate()
    {
        if (Grid.getGrid.GO_lastBox != null)
        {
            return;
        }
        if (ManMove.tempitw == null)
        {
            if (ManMove.IsEnd)            //道具結束的標記,結束後回歸一般模式
            {
                setManMoveable(new NormalManMove(this.gameObject, ManMove));
            }
            ManMove.Move();
            AddScore();            //加分
        }
        else
        {
            //吃到道具做動作
            if (itemAction != null)
            {
                itemAction.ActionStart();                                                          //人物吃到道具的道具反應
                setManMoveable(CreatManMoveFac.CreatManMove(this.gameObject, ManMove, itemGroup)); //設定吃到道具之後的效果
                if (itemGroup.Type == Group.groupType.bag)
                {
                    AddBagBox();
                }
                if (itemGroup.Type == Group.groupType.coin)
                {
                    AddCoinBox();
                }
                itemAction = null;
                return;
            }


            //移動方向有BOX擋住,將人物退回原位
            if (Grid.getGrid.grids[(int)ManMove.New_Pos.x][(int)ManMove.New_Pos.y] != null)
            {
                if (Grid.getGrid.grids[(int)ManMove.New_Pos.x][(int)ManMove.New_Pos.y].parent.tag == "itemBox")
                {
                    return;
                }
                ManMove.tempitw.isRunning = false;
                Destroy(ManMove.tempitw);
                ManMove.Move();
            }
        }
    }