// Use this for initialization
    void Start()
    {
        mMesh = TmUtils.CreateTileMesh(SLICE_NUM_X, SLICE_NUM_Y, Color.white);
        MeshFilter filter = GetComponent <MeshFilter>();

        filter.mesh = mMesh;
    }
    // Use this for initialization
    void Start()
    {
        mGame = GameScript.instance;
        MeshFilter meshFilter = GetComponent <MeshFilter>();

        if ((meshFilter != null) && (meshFilter.mesh != null))
        {
            TmUtils.SetMeshColor(meshFilter.mesh, new Color(1.0f, 0.3f, 0.2f, 0.5f));
        }
    }
Beispiel #3
0
    // Use this for initialization
    void Start()
    {
        MeshFilter meshFilter = GetComponent <MeshFilter>();

        if ((meshFilter != null) && (meshFilter.mesh != null))
        {
            mMesh           = TmUtils.CreateLineCircle(2);
            mVertices       = mMesh.vertices.Clone() as Vector3[];
            meshFilter.mesh = meshFilter.sharedMesh = mMesh;
        }
    }
Beispiel #4
0
 // Update is called once per frame
 void Update()
 {
     transform.Rotate(rot * Time.deltaTime);
     if (radius > mDefLocalScale.y)
     {
         radius *= TmUtils.LeapBreak(radius, 0.995f, Time.deltaTime * 5.0f);
         transform.localScale = Vector3.one * radius;
     }
     transform.position = mDefPos - Vector3.up * radius * 0.5f + Vector3.Scale(mDefLocalScale, Vector3.up * 0.5f);
     stratosphereObj.transform.position   = transform.position + Vector3.back * radius * 0.5f;
     stratosphereObj.transform.localScale = mDefStratosphereScale * radius;
 }
    //-----------------------------------------------------------
    bool r00MoveTypeBlink()
    {
        switch (mRno[0])
        {
        case 0:
            mRno[0] = 1;
            gameObject.renderer.enabled = true;
            mTimer = 0.0f;
            break;

        case 1:
            mTimer += Time.deltaTime;
            mAlpha  = (Mathf.Sin(mTimer * 4.0f) + 1.0f) * 0.4f + 0.2f;
            mMesh   = TmUtils.SetMeshColor(mMesh, new Color(1.0f, 0.0f, 0.0f, mAlpha));
            break;
        }
        return(true);
    }
    // Use this for initialization
    void Start()
    {
        mSys           = TmSystem.instance;
        mGame          = GameScript.instance;
        mSelPosId      = Vector2.one * -1.0f;
        mTouchLocalPos = Vector2.one * -1.0f;
        mTouchEnable   = true;
        mTimer         = 0.0f;
        MeshFilter meshFilter = GetComponent <MeshFilter>();

        if ((meshFilter != null) && (meshFilter.mesh != null))
        {
            meshFilter.mesh = meshFilter.sharedMesh = TmUtils.CreateGridXY(MESH_W, MESH_H);
            mMesh           = meshFilter.mesh;
        }
        posPanelObj.transform.localScale = new Vector3(1.0f / MESH_W, 1.0f / MESH_H, 1.0f);
        mMesh = TmUtils.SetMeshColor(mMesh, new Color(0.2f, 0.5f, 0.2f, 0.2f));
    }
    //-----------------------------------------------------------
    bool r00MoveTypeFlashBlink()
    {
        const float FLASH_BLINK_TIME       = 2.0f;
        const float FLASH_BLINK_ALPHA_TIME = 1.5f;

        switch (mRno[0])
        {
        case 0:
            mDelay -= Time.deltaTime;
            if (mDelay <= 0.0f)
            {
                mRno[0] = 1;
                mTimer  = FLASH_BLINK_TIME + mDelay;
                gameObject.renderer.enabled = true;
            }
            else
            {
                gameObject.renderer.enabled = false;
            }
            break;

        case 1:
            mTimer -= Time.deltaTime;
            if (mTimer <= 0.0f)
            {
                gameObject.renderer.enabled = true;
                mTimer += FLASH_BLINK_TIME;
            }
            mAlpha = (mTimer - (FLASH_BLINK_TIME - FLASH_BLINK_ALPHA_TIME)) / FLASH_BLINK_ALPHA_TIME;
            if (mAlpha > 0.0f)
            {
                mMesh = TmUtils.SetMeshColor(mMesh, new Color(1.0f, 0.0f, 0.0f, mAlpha));
            }
            else
            {
                gameObject.renderer.enabled = false;
            }
            break;
        }
        return(true);
    }
    //-----------------------------------------------------------
    bool r00MoveTypeBlinkOff()
    {
        switch (mRno[0])
        {
        case 0:
            if (mTypeOld == TYPE.OFF)
            {
                mRno[0] = 2;
                mRno[1] = 0;               // カウンタとして使用
            }
            else
            {
                mRno[0] = 1;
                mRno[1] = 0;               // カウンタとして使用
                gameObject.renderer.enabled = true;
                mTimer = 0.0f;
                mAlpha = 0.5f;
                mMesh  = TmUtils.SetMeshColor(mMesh, new Color(1.0f, 1.0f, 0.0f, mAlpha));
            }
            break;

        case 1:
            mTimer += Time.deltaTime;
            if (mTimer > 0.1f)
            {
                mTimer -= 0.1f;
                mRno[1]++;
                gameObject.renderer.enabled = (mRno[1] % 2 == 0);
                if (mRno[1] >= 8)
                {
                    gameObject.renderer.enabled = false;
                    mRno[0] = 2;
                    mRno[1] = 0;
                }
            }
            break;
        }
        return(true);
    }
Beispiel #9
0
 void SM_SetColor(Color _col)
 {
     TmUtils.SetMeshColor(mMesh, _col);
 }
    // Update is called once per frame
    void Update()
    {
//		mTouchEnable = (mGame.command=="CMD16");

        float alpha = (Mathf.Sin(mTimer * 4.0f) + 1.0f) * 0.4f + 0.2f;

        mMesh = TmUtils.SetMeshColor(mMesh, new Color(0.2f, 0.5f, 0.2f, alpha));
        if (!mTouchEnable)
        {
            mTimer = 0.0f;
            posPanelObj.SendMessage("SM_SetType", selGridOne.TYPE.OFF);
            return;
        }
        mTimer += Time.deltaTime;

        if ((mSys.mw.buttonState == TmMouseWrapper.STATE.ON) || (mSys.mw.buttonState == TmMouseWrapper.STATE.DOWN))
        {
            if (mSys.mw.isOnDragTarget(gameObject))
            {
//				mTouchLocalPos = mSys.mw.mouseHit.textureCoord+Vector2.one*-0.5f;
                mTouchLocalPos = transform.worldToLocalMatrix.MultiplyPoint(mSys.mw.mouseHit.point);
                posPanelObj.SendMessage("SM_SetDestLocalPos", mTouchLocalPos);
                posPanelObj.SendMessage("SM_SetType", selGridOne.TYPE.ON);
                mSelPosId = new Vector2(Mathf.Floor((mTouchLocalPos.x + 0.5f) * MESH_W), Mathf.Floor((mTouchLocalPos.y + 0.5f) * MESH_H));

                // display touch cursor at touch grid.
                if (mSys.mw.buttonState == TmMouseWrapper.STATE.DOWN)
                {
                    mNearestPlObj = mGame.GetNrarestPl(mTouchLocalPos, new Vector2(0.5f / MESH_W, 0.5f / MESH_H));
                    if (mNearestPlObj == null)
                    {
                        posLineObj.SendMessage("SM_SetSttPos", mTouchLocalPos);
                    }
                }
                if (mNearestPlObj != null)
                {
                    Vector2 tmpLocalPos = mNearestPlObj.transform.localPosition;
                    posLineObj.SendMessage("SM_SetSttPos", tmpLocalPos);
                }
                posLineObj.SendMessage("SM_SetEndPos", mTouchLocalPos);
                posLineObj.SendMessage("SM_SetColor", (mNearestPlObj == null) ? Color.red : Color.white);
                posLineObj.renderer.enabled = true;
            }
        }
        else
        {
            posPanelObj.SendMessage("SM_SetType", selGridOne.TYPE.BLINK_OFF);
            if (mSys.mw.buttonState == TmMouseWrapper.STATE.UP)
            {
                if (mNearestPlObj != null)
                {
                    if ((mSelPosId.x >= 0) && (mSelPosId.y >= 0))
                    {
                        mNearestPlObj.SendMessage("SM_SetDestGridId", mSelPosId);
                        mNearestPlObj = null;
                    }
                }
            }

            posLineObj.renderer.enabled = false;
        }
    }