コード例 #1
0
    public void Init()
    {
        EventManager.Register(this,
                              EventID.EVENT_TOUCH_DOWN, EventID.EVENT_TOUCH_MOVE);
        addCount = (int)(GameConst.GAME_STEP_INTERVAL * 7);

        addStepDis += GameConst.GAME_STEP_INTERVAL;
        for (int i = 0; i < 1; i++)
        {
            InGameBaseObj obj = AddObj(InGameBaseObj.enObjType.step);

            obj.transform.position = new Vector3(0, 0, addStepDis);
            addStepDis            += GameConst.GAME_STEP_INTERVAL;

            InGameStep step = (InGameStep)obj;

            step.RandScale(4, 0);
        }
        AddStepUpdate();
    }
コード例 #2
0
    void AddStepUpdate()
    {
        float roleposz = InGameManager.GetInstance().role.transform.position.z;

        while (addStepDis - roleposz < addCount)
        {
            InGameBaseObj obj = AddObj(InGameBaseObj.enObjType.step);

            float y = 0;
            if (addStepDis > addCount)
            {
                y = -5;
            }

            obj.transform.position = new Vector3(0, y, addStepDis);
            addStepDis            += GameConst.GAME_STEP_INTERVAL;

            InGameStep step = (InGameStep)obj;

            step.RandScale(Random.Range(2f - InGameManager.GetInstance().gameScale, 5f - InGameManager.GetInstance().gameScale),
                           -3 + Random.Range(0f, 6f));
        }
    }