Пример #1
0
        public void Init(AirArrow airArrow)
        {
            float uvStart, uvEnd;

            if (airArrow.IsUp)
            {
                uvStart = 0f;
                uvEnd   = 0.5f;
            }
            else
            {
                uvStart = 0.5f;
                uvEnd   = 1f;
            }

            GetComponent <MeshFilter>().mesh = GenerateMesh(airArrow.Position.Width, uvStart, uvEnd, airArrow.ArrowShift);

            var material = GetComponent <MeshRenderer>().material;

            float scrollSpeed = ShaderScrollSpeed;

            if (!airArrow.IsUp)
            {
                scrollSpeed *= -1;                //invert for down arrows
            }
            material.SetFloat(ShaderSpeedPropertyID, scrollSpeed);
        }
Пример #2
0
        private void InitArrowMesh(AirArrow airArrow)
        {
            var arrowMesh = Instantiate(ArrowMeshPrefab);                                    //new generic arrow mesh

            arrowMesh.transform.parent        = transform;                                   //parent to us
            arrowMesh.transform.localPosition = new Vector3(airArrow.Position.Center, 0, 0); //offset from us
            arrowMesh.GetComponent <AirArrowSetup>().Init(airArrow);                         //generate mesh
        }