SetWidth() приватный Метод

private SetWidth ( float start, float end ) : void
start float
end float
Результат void
Пример #1
0
        // Update is called once per frame
        void Update()
        {
            while (_lrVerticesCount < _vertices.Count)
            {
                _lineRenderer.SetVertexCount(_lrVerticesCount + 1);
                _lineRenderer.SetPosition(_lrVerticesCount, _vertices[_lrVerticesCount]);

                _lrVerticesCount++;
            }

            if (_size != _lrSize)
            {
                _lrSize = _size;
                _lineRenderer.SetWidth(_lrSize, _lrSize);
            }

            if (_lrColor != _color)
            {
                _lrColor = _color;
                _lineRenderer.SetColors(_color, _color);
            }

            if (_lrSortingLayer != _sortingLayer)
            {
                _lrSortingLayer = _sortingLayer;
                _lineRenderer.sortingLayerName = _lrSortingLayer;
            }
        }
Пример #2
0
    void Start()
    {
        // Link to LeanTouch events
        LeanTouch.OnFingerDown += OnFingerDown;
        LeanTouch.OnFingerUp += OnFingerUp;
        LeanTouch.OnSoloDrag += OnSoloDrag;
        LeanTouch.OnMultiDrag += OnMultiDrag;
        currFinger = null;

        // Initialize LineRenderer
        lineGameObject = new GameObject("SlashLine");
        lineGameObject.AddComponent<LineRenderer>();

        lineRenderer = lineGameObject.GetComponent<LineRenderer>();
        lineRenderer.material = new Material(Shader.Find("Mobile/Particles/Additive"));
        lineRenderer.SetColors(c0, c1);
        lineRenderer.SetWidth(0.1f, 0f);
        lineRenderer.SetVertexCount(0);

        // Initialize other variables
        i = 0;
        slashing = false;
        soloDragging = false;
        currSoloDragDelta = Vector2.zero;

        // Init GM ref
        GM = GameObject.Find("GameManager").GetComponent<GameManager>();
    }
Пример #3
0
        // Use this for initialization
        void Start()
        {
            _lineRenderer = GetComponent <UnityEngine.LineRenderer>();

            _lineRenderer.SetColors(_color, _color);
            _lineRenderer.SetWidth(_size, _size);
        }
Пример #4
0
 // Use this for initialization
 void Awake()
 {
     visualLine = GetComponent<LineRenderer> ();
     player = GameObject.FindGameObjectWithTag ("Player").transform;
     visualLine.SetColors (Color.red, Color.red);
     visualLine.SetWidth (0.01f, 0.01f);
 }
Пример #5
0
 void Start()
 {
     line = GetComponent<LineRenderer>();
     line.SetVertexCount(2);
     line.GetComponent<LineRenderer>().material = lineMaterial;
     line.SetWidth(0.1f, 0.1f);
 }
Пример #6
0
    void Start()
    {
        highlight_box = (GameObject) Instantiate(highlight_prefab, new Vector3(1000f, 1000f, 1000f), Quaternion.identity);
        movement_line = (LineRenderer) ((GameObject) Instantiate(new GameObject("movement_line"), new Vector3(0f, 0f, 0f), Quaternion.identity)).AddComponent<LineRenderer>();
        movement_line.SetColors(Color.cyan, Color.cyan);
        movement_line.SetWidth(.2f, .2f);
        movement_line.SetVertexCount(3);
        highlight_box.GetComponent<Renderer>().enabled = false;
        movement_line.enabled = false;

        for (int y = 0; y < map_size; y++)
        {
            List<Tile> row = new List<Tile>();
            for (int x = 0; x < map_size; x++)
            {
                Tile tile = ((GameObject)Instantiate(tile_prefab, new Vector3(x - Mathf.Floor(map_size / 2), 0f, y - Mathf.Floor(map_size / 2)), Quaternion.identity)).GetComponent<Tile>();
                tile.grid_position = new Vector2(x, y);
                row.Add(tile);
            }
            map.Add(row);
        }

        player = ((GameObject)Instantiate(player_prefab, new Vector3(7f, 1.2f, 7f), Quaternion.identity)).GetComponent<Player>();
        player.gameObject.tag = "Player";
        other_player = ((GameObject)Instantiate(player_prefab, new Vector3(7f, 1.2f, -7f), Quaternion.identity)).GetComponent<Player>();
        other_player.gameObject.AddComponent<QuestGiver>();
        other_player.gameObject.tag = "QuestGiver";
        players.Add(player);
        players.Add(other_player);
        current_player = players[current_player_index];
        destination = player.transform.position;
        current_player.start_turn();
    }
Пример #7
0
 // Use this for initialization
 void Start()
 {
     lineRenderer = GetComponent<LineRenderer>();
     lineRenderer.SetPosition(0, p0.position);
     lineRenderer.SetPosition(1, p1.position);
     lineRenderer.SetWidth(.02f, 0.02f);
 }
Пример #8
0
	// Use this for initialization
	void SetupThrustTrails () {
		lineRenderer = gameObject.AddComponent<LineRenderer>();
		lineRenderer.material = new Material(Shader.Find("Sprites/Default"));
		lineRenderer.SetColors(Color.yellow, Color.yellow);
		lineRenderer.SetWidth(0.2F, 0.2F);
		lineRenderer.useWorldSpace = false;
	}
Пример #9
0
 private void Start()
 {
     m_LayerMask 	= ~m_LayerMask;
     m_BaseTransform = transform.parent;
     m_Line 			= GetComponent<LineRenderer> () as LineRenderer;
     m_Line.SetWidth (Width, Width);
 }
Пример #10
0
    public void RouteGraphicsPopulate(int patroli)
    {
        //populate stage
        line = new GameObject();
        line.name = "Trail "+(patroli+1);
        linerenderer = line.AddComponent<LineRenderer>();

        for (int ii = 0; ii < patrol[patroli].waypoint.Count; ii++)
        {
        //Waypoint Objects
        Vector3 spawn;
        spawn = new Vector3(patrol[patroli].waypoint[ii].Coord.x, patrol[patroli].waypoint[ii].Coord.y+0.1f, patrol[patroli].waypoint[ii].Coord.z);
        WpObject = (GameObject)Instantiate(WPModel,spawn, Quaternion.identity);
        WpObject.name ="WP "+(patroli+1)+"."+(ii+1);
        WpText = WpObject.GetComponentInChildren<TextMesh>();
        WpText.text = (patroli + 1) + "." + (ii + 1);
        //Trail / LineRenderer
        linerenderer.SetVertexCount(patrol[patroli].waypoint.Count+1);
        linerenderer.SetWidth(0.1f,0.1f);
        //linerenderer.material.color = Color.green;
        line.renderer.enabled = true;
        linerenderer.renderer.material = TrailMaterial;
        linerenderer.SetPosition(ii,patrol[patroli].waypoint[ii].Coord);
        linerenderer.SetPosition(patrol[patroli].waypoint.Count,patrol[patroli].waypoint[0].Coord);

        }
    }
Пример #11
0
 // Use this for initialization
 void Start()
 {
     trackedObj = GetComponent<SteamVR_TrackedObject>();
     DrawLine = this.gameObject.AddComponent<LineRenderer>();
     //DrawLine.material = 
     DrawLine.SetWidth(0, 3);
 }
Пример #12
0
 // Use this for initialization
 void Start()
 {
     line_renderer = (LineRenderer)this.gameObject.GetComponent<LineRenderer>();
     line_renderer.SetWidth(1f, 3f);
     line_renderer.SetColors(Color.red, Color.green);
     line_renderer.SetVertexCount(2);
 }
Пример #13
0
    // Use this for initialization
    void Start()
    {
        lrender = GetComponent<LineRenderer>();
        lrender.SetWidth(5, 2);

        child = transform.GetChild(0);
    }
Пример #14
0
    void Awake()
    {
        // Set up line renderer.
        child = new GameObject("Bird Renderer");
        child.transform.SetParent(transform);

        lineRenderer = child.AddComponent<LineRenderer>();
        lineRenderer.sharedMaterial = Resources.Load("Materials/Unlit") as Material;
        lineRenderer.useWorldSpace = false;
        lineRenderer.SetColors(color, color);
        lineRenderer.SetWidth(lineWidth, lineWidth);

        // Set up ship and use line renderer.
        drawPoints = new List<Vector3>();

        foreach (Vector2 point in shipPoints)
        {
            Vector3 pos = new Vector3(point.x, point.y, 0);
            drawPoints.Add(pos);
        }
        SetPoints(drawPoints);

        // Setup the polygon collider.
        //polyCollider = child.AddComponent<PolygonCollider2D>();
        //polyCollider.points = shipPoints;

        // Set up the circle collider.
        //circleCollider = child.AddComponent<CircleCollider2D>();
        //circleCollider.isTrigger = true;
    }
Пример #15
0
    IEnumerator Fade(LineRenderer line)
    {
        float durationModifier=1f/fadeDuration;

        float duration=0;
        while(duration<1){

            float width=Mathf.Lerp(startingWidth, 0, duration);
            line.SetWidth(width, width);

            duration+=Time.deltaTime*durationModifier;
            yield return null;
        }

        line.SetWidth(0, 0);
    }
Пример #16
0
    // Use this for initialization
    void Start()
    {
        GameObject lockedCrosshairImage = new GameObject();
        Image crossHairImage = lockedCrosshairImage.AddComponent<Image>();

        crossHairImage.rectTransform.pivot = new Vector2(0.5f,0.5f);
        crossHairImage.rectTransform.anchorMax = Vector2.zero;
        crossHairImage.rectTransform.anchorMin = Vector2.zero;
        crossHairImage.rectTransform.sizeDelta = new Vector2(64,64);

        crossHairImage.raycastTarget = false;
        crossHairImage.sprite = trackingCrosshair;
        crossHairImage.color = Color.black;
        crossHairImage.type = Image.Type.Filled;
        crossHairImage.fillMethod = Image.FillMethod.Radial360;
        crossHairImage.fillAmount = 0;

        //TODO get reference to the correct canvas
        Canvas canvas = GameObject.Find("Canvas").GetComponent<Canvas>();

        crossHairImage.transform.SetParent(canvas.transform);
        crossHairImage.transform.SetAsFirstSibling();
        crossHairImage.transform.localScale = Vector3.one;

        myTrackingCrosshair = crossHairImage;

        myTargetingLine = myTrackingModule.gameObject.AddComponent<LineRenderer>();

        myTargetingLine.useWorldSpace = true;
        myTargetingLine.SetVertexCount(2);
        myTargetingLine.SetPositions(new Vector3[]{Vector3.zero,Vector3.zero});
        myTargetingLine.SetWidth(0.5f,0.5f);
        myTargetingLine.SetColors(Color.red,Color.red);
        myTargetingLine.enabled = false;
    }
Пример #17
0
	void Awake ()
	{
		aniMat = characterModel.GetComponent<Animator>();
		CameraBase = GameObject.Find("CameraBase");
		OxGun = GameObject.Find("Gun");
		lineRenderer = gameObject.AddComponent<LineRenderer>();
		lineRenderer.material = lineMat;
		lineRenderer.SetWidth(0.2F, 0.2F);
		//lineMat.renderQueue = 9999999;
		// NEW ABOVE
		floorMask = LayerMask.GetMask ("FloorMask");
		anim = GetComponent <Animator> ();
		playerRigidbody = GetComponent <Rigidbody> ();
		playerRigidbody.mass = 100f;
		mainCamera = GameObject.Find("Camera").GetComponent<Camera>();
		GameObject[] FoundTerrain = GameObject.FindGameObjectsWithTag("Terrain");

		// turn of bounciness?
		foreach(GameObject terrainPiece in FoundTerrain)
		{
			terrainPiece.layer = 8; // 8 is floormask
			terrainPiece.GetComponent<Collider>().material.bounciness = 0f;
		}
		this.GetComponent<Collider>().material.bounciness = 0f;
	}
Пример #18
0
    public override void initialize()
    {
        Level = 4;
        Type = CannonType.LaserI;
        CannonName = "Laser I";
        Range = 150;
        Frequency = 1;
        TimeBeforeShoot = 0;
        Cost = 460;
        Speed = 1;
        Damage = 12;
        target = null;
        gradeTree = new CannonType[4];
        gradeTree[0] = CannonType.LaserII;
        gradeTree[1] = CannonType.Nothing;
        gradeTree[2] = CannonType.Nothing;
        gradeTree[3] = CannonType.Degrade;
        prefabs = new GameObject[4];
        prefabs[0] = Resources.Load("Prefabs/LaserII") as GameObject;
        prefabs[1] = null;
        prefabs[2] = null;
        prefabs[3] = Resources.Load("Prefabs/SniperCannonI") as GameObject;
        CannonReloadTime = (float)1 / Frequency;
        RotationFactor = 20;

        Line = this.transform.FindChild("PivotPoint").GetComponent<LineRenderer>() as LineRenderer;
        EndOfBeam = this.transform.FindChild("PivotPoint").transform.FindChild("EndOfBeam");
        
        Line.SetWidth(0, 0);
    }
Пример #19
0
    void DrawCircleOnAxis( Vector3 N, float Radius )
    {
        N = N / N.magnitude;
        Vector3 U = new Vector3();
        if     ( N.x != 0 && N.y != 0 && N.z != 0 )  U = ( new Vector3( - N.x,   N.y,   N.z ) / ( new Vector3( - N.x,   N.y,   N.z ) ).magnitude ) * Radius;
        else if( N.x != 0 && N.y != 0 && N.z == 0 )  U = ( new Vector3( - N.x,   N.y,   N.z ) / ( new Vector3( - N.x,   N.y,   N.z ) ).magnitude ) * Radius;
        else if( N.x != 0 && N.y == 0 && N.z != 0 )  U = ( new Vector3( - N.x,   N.y,   N.z ) / ( new Vector3( - N.x,   N.y,   N.z ) ).magnitude ) * Radius;
        else if( N.x == 0 && N.y != 0 && N.z != 0 )  U = ( new Vector3(   N.x, - N.y,   N.z ) / ( new Vector3(   N.x, - N.y,   N.z ) ).magnitude ) * Radius;
        else if( N.x != 0 && N.y == 0 && N.z == 0 )  U = ( new Vector3(   N.x,   N.x,   N.z ) / ( new Vector3(   N.x,   N.x,   N.z ) ).magnitude ) * Radius;
        else if( N.x == 0 && N.y != 0 && N.z == 0 )  U = ( new Vector3(   N.y,   N.y,   N.z ) / ( new Vector3(   N.y,   N.y,   N.z ) ).magnitude ) * Radius;
        else if( N.x == 0 && N.y == 0 && N.z != 0 )  U = ( new Vector3(   N.z,   N.y,   N.z ) / ( new Vector3(   N.z,   N.y,   N.z ) ).magnitude ) * Radius;

        Vector3 V = ( Vector3.Cross( N, U ) / Vector3.Cross( N, U ).magnitude ) * Radius;
        Circle = GameObject.Find( "Circle" ).GetComponent<LineRenderer>();
        Circle.SetVertexCount( 100 );
        Circle.SetWidth( 0.05f, 0.05f );
        float Angle = 0;
        for ( int i = 0; i < 100; i++ )
        {
            //Circle.SetPosition( i, new Vector3( Radius * Mathf.Cos( Angle * Mathf.Deg2Rad ), Radius * Mathf.Sin( Angle * Mathf.Deg2Rad ), 0 ) );
            Circle.SetPosition( i, new Vector3( Radius * ( U.x * Mathf.Cos ( Angle * Mathf.Deg2Rad ) + V.x * Mathf.Sin ( Angle * Mathf.Deg2Rad ) ),
                                                Radius * ( U.y * Mathf.Cos ( Angle * Mathf.Deg2Rad ) + V.y * Mathf.Sin ( Angle * Mathf.Deg2Rad ) ),
                                                Radius * ( U.z * Mathf.Cos ( Angle * Mathf.Deg2Rad ) + V.z * Mathf.Sin ( Angle * Mathf.Deg2Rad ) ) ) );
            Debug.Log( (Radius * Mathf.Cos( Angle )).ToString() );
            Angle += 3.6f;
        }
    }
Пример #20
0
	void Start () {
	    lineRenderer = gameObject.AddComponent<LineRenderer>();
        lineRenderer.SetColors(Color.red, Color.red);
        lineRenderer.material = mat;
        lineRenderer.SetWidth(0.1f, 0.1f);
        lineRenderer.SetVertexCount(2);
	}
Пример #21
0
    void Start()
    {
        bulletTrail = GetComponent<LineRenderer>();
        Vector3 direction = end - start;
        Vector3 right = Vector3.Cross(direction, Vector3.up).normalized;
        Vector3 up = Vector3.Cross(direction, right).normalized;
        float length = direction.magnitude;
        count = Mathf.CeilToInt(length / width * density);
        velocities = new Vector3[count];
        positions = new Vector3[count];
        Vector3 increment = direction / count;

        bulletTrail.SetVertexCount(count);
        bulletTrail.SetWidth(width, width);
        bulletTrail.material.mainTextureScale = new Vector2(length / width * 0.25f, 1);

        float offset1 = Random.value * 100.0f;
        float offset2 = Random.value * 100.0f;
        for (int i = 0; i < count; ++i) {
            velocities[i] = speed * (right * (Mathf.PerlinNoise(0, i * frequency + offset1) - 0.5f) + up * (Mathf.PerlinNoise(0, i * frequency + offset2) - 0.5f));
            //velocities[i] = speed * (right * Mathf.Sin(frequency * i + offset1) + up * Mathf.Cos(frequency * i + offset1));
            positions[i] = start + increment * i;
        }
        SetPositions();
    }
Пример #22
0
    void Start()
    {
        player = GameObject.Find ("Player");

        line = GetComponent<LineRenderer> ();
        line.SetWidth (0.1f, 0.1f);
    }
Пример #23
0
 // Use this for initialization
 void Start()
 {
     lineRenderer = GetComponent<LineRenderer> ();
     lineRenderer.SetPosition (0, origin.position);
     lineRenderer.SetWidth (.45f, .45f);
     dist = Vector3.Distance( origin.position , endPoint.position);
 }
    void OnMouseDown()
    {
        float sizeValue = (2.0f * Mathf.PI) / theta_scale;
        size = (int)sizeValue;
        size++;
        lineRenderer = gameObject.AddComponent<LineRenderer>();
        //lineRenderer.material = new Material(Shader.Find("Materials/Menu"));
        lineRenderer.SetWidth(0.02f, 0.02f); //thickness of line
        lineRenderer.SetVertexCount(size);

        Vector3 pos;
        float theta = 0f;
        for (int i = 0; i < size; i++)
        {
            theta += (2.0f * Mathf.PI * theta_scale);
            float x = radius * Mathf.Cos(theta);
            float y = radius * Mathf.Sin(theta);
            x += canvasSheet.transform.position.x;
            y += canvasSheet.transform.position.y;
            float z = canvasSheet.transform.position.z - 0.1f;
            pos = new Vector3(x, y, z);
            lineRenderer.SetColors(c1, c1);
            lineRenderer.SetPosition(i, pos);
        }
    }
Пример #25
0
 // Use this for initialization
 void Start()
 {
     lineRendererRight = rightGunTag.GetComponent<LineRenderer> ();
     lineRendererRight.SetWidth (0, 0);
     lineRendererLeft = leftGunTag.GetComponent<LineRenderer> ();
     lineRendererLeft.SetWidth (0, 0);
 }
	void Start ()
	{
		isActive = false;

		spaceCraftHelper = new GameObject[numOfHelpers];
		planetHelper = new GameObject[numOfHelpers];

		for (int i = 0; i < numOfHelpers; i++) {
			spaceCraftHelper [i] = Instantiate (Resources.Load ("Prefabs/Helper") as GameObject) as GameObject;
			spaceCraftHelper [i].transform.localScale = new Vector3 (helperSize, helperSize, helperSize);
			spaceCraftHelper [i].SetActive (isActive);
		}
		for (int i = 0; i < numOfHelpers; i++) {
			planetHelper [i] = Instantiate (Resources.Load ("Prefabs/Helper") as GameObject) as GameObject;
			planetHelper [i].transform.localScale = new Vector3 (helperSize, helperSize, helperSize);
			planetHelper [i].SetActive (isActive);
		}

		earth = GameObject.Find ("Earth");
		poEarth = earth.GetComponent<PlanetaryOrbit> ();

		lineRendererLength = 40;
		line = gameObject.GetComponent<LineRenderer> () as LineRenderer;
		line.material = Resources.Load ("Materials/LineAux") as Material;
		line.SetWidth (5f, 5f);
		line.SetVertexCount (lineRendererLength);
	}
	// Use this for initialization
	void Awake () {
        ignoreCollisionList = new List<Collider2D>();

        rigid = GetComponent<Rigidbody2D>();

        ball = this.gameObject.AddComponent<PolygonCollider2D>();
        ball.sharedMaterial = ballPhysicsMat;

        rend = GetComponent<LineRenderer>();

        Vector2[] points = new Vector2[2 * (numSides + 1)];
        rend.SetVertexCount(numSides + 1);

        float visualRadius = (outerRadius + innerRadius) / 2;
        rend.SetWidth(outerRadius - innerRadius, outerRadius - innerRadius);

        // inner points
        for (int i = 0; i <= numSides; i++)
        {
            float angle = TwoPI * i / numSides;
            Vector2 direction = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle));
            points[i] = innerRadius * direction;
            rend.SetPosition(i, visualRadius * direction);

        }

        // outer points
        for (int i = numSides + 1; i < points.Length; i++)
        {
            float angle = TwoPI * i / numSides;
            points[i] = new Vector2(outerRadius * Mathf.Cos(angle), outerRadius * Mathf.Sin(angle));
        }

        ball.points = points;
	}
Пример #28
0
    //Variables End___________________________________________________________
    // Use this for initialization
    void Start()
    {
        if(networkView.isMine == true)
        {
            //Store a reference to these objects since we will need to reference
            //them frequently.

            myTransform = transform.parent;

            cameraHeadTransform = myTransform.FindChild("CameraHead");

            resourceScript = myTransform.GetComponent<PlayerResource>();

            changeScript = myTransform.GetComponent<ChangeWeapon>();

            //Attaching a LineRenderer component which will give a visual
            //effect for the block eraser. Only the player will be able to see it.

            lineRenderer = gameObject.AddComponent<LineRenderer>();

            lineRenderer.material = new Material(Shader.Find("Particles/Additive"));

            lineRenderer.SetColors(c1, c2);

            lineRenderer.SetWidth(0.04f, 0.01f);

            lineRenderer.SetVertexCount(2); //Start and end position.
        }

        else
        {
            enabled = false;
        }
    }
Пример #29
0
    // Use this for initialization
    void Start()
    {
        path = NewPath();
        iTween.PutOnPath(pfadPrefab, path, 1);
        pfadPrefab.SetActive (true);
        hash.Clear();
        hash.Add ("name", "moveOnRandom");
        hash.Add ("path", path);
        hash.Add ("time", time);
        hash.Add ("oncomplete", "Die");
        hash.Add ("easetype", iTween.EaseType.linear);

        pfadPrefab.SetActive (true);
        Move ();
        path.Initialize ();

        mittelpunkt = GameObject.FindGameObjectWithTag("mittelpunkt");

        lineSegmentCount = 1;

        line = gameObject.AddComponent("LineRenderer") as LineRenderer;
        line.SetWidth (0.1f, 0.1f);
        line.material = material;
        line.SetColors (Color.white, Color.white);
        line.SetVertexCount (lineSegmentCount);
        line.renderer.enabled = true;
        line.SetPosition(lineSegmentCount-1, mittelpunkt.transform.position);
    }
Пример #30
0
		void Start()
		{
			startTime = Time.time;
			prevPosition = gameObject.transform.position;
			
			sourceOriginalV = sourceVessel.rigidbody.velocity;
			
			Light light = gameObject.AddComponent<Light>();
			light.type = LightType.Point;
			light.color = lightColor;
			light.range = 8;
			light.intensity = 1;
			
			bulletTrail = gameObject.AddComponent<LineRenderer>();
			bulletTrail.SetVertexCount(2);
			bulletTrail.SetPosition(0, transform.position);
			bulletTrail.SetPosition(1, transform.position);
			bulletTrail.SetWidth(tracerStartWidth, tracerEndWidth);
			bulletTrail.material = new Material(Shader.Find("KSP/Particles/Alpha Blended"));
			bulletTrail.material.mainTexture = GameDatabase.Instance.GetTexture("BDArmory/Textures/bullet", false);
			bulletTrail.material.SetColor("_TintColor", projectileColor);
			
			rigidbody.useGravity = false;
			
		}
Пример #31
0
		void Start()
		{
			startTime = Time.time;
			prevPosition = gameObject.transform.position;
			
			Light light = gameObject.AddComponent<Light>();
			light.type = LightType.Point;
			light.range = 15;
			light.intensity = 8;
			
			audioSource = gameObject.AddComponent<AudioSource>();
			audioSource.minDistance = 0.1f;
			audioSource.maxDistance = 75;
			audioSource.clip = GameDatabase.Instance.GetAudioClip("BDArmory/Sounds/shellWhistle");
			audioSource.volume = Mathf.Sqrt(GameSettings.SHIP_VOLUME);// * 0.85f;
			audioSource.dopplerLevel = 0.02f;
			
			explosion = GameDatabase.Instance.GetModel("BDArmory/Models/explosion/explosion");
			explosion.SetActive(true);
			
			bulletTrail = gameObject.AddComponent<LineRenderer>();
			bulletTrail.SetVertexCount(2);
			bulletTrail.SetPosition(0, transform.position);
			bulletTrail.SetPosition(1, transform.position);
			bulletTrail.SetWidth(tracerStartWidth, tracerEndWidth);
			bulletTrail.material = new Material(Shader.Find("KSP/Particles/Additive"));
			bulletTrail.material.mainTexture = GameDatabase.Instance.GetTexture("BDArmory/Textures/bullet", false);
			bulletTrail.material.SetColor("_TintColor", projectileColor);
			
			
			rigidbody.useGravity = false;
			
		}
Пример #32
0
    public void reset()
    {
        startPos.x = 0;
        startPos.y = 0;
        startPos.z = 0;

        endPos.x = 0;
        endPos.y = 0;
        endPos.z = 0;

        penDown = false;
        sessionStart = false;
        inSession = false;

        localLRend = this.transform.gameObject.GetComponent<LineRenderer>();
        localLRend.material = new Material(Shader.Find("Diffuse"));
        localLRend.material.color = Color.black;
        localLRend.castShadows = false;
        localLRend.receiveShadows = false;
        localLRend.SetVertexCount(2);
        localLRend.SetWidth(lineThickness,lineThickness);
        localLRend.SetColors(Color.black,Color.black);

        localLRend.SetPosition(0,Vector3.zero);
        localLRend.SetPosition(1,Vector3.zero);
        localLRend.enabled = false;
    }
Пример #33
0
 static int SetWidth(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         UnityEngine.LineRenderer obj = (UnityEngine.LineRenderer)ToLua.CheckObject(L, 1, typeof(UnityEngine.LineRenderer));
         float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         float arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
         obj.SetWidth(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static public int SetWidth(IntPtr l)
 {
     try {
         UnityEngine.LineRenderer self = (UnityEngine.LineRenderer)checkSelf(l);
         System.Single            a1;
         checkType(l, 2, out a1);
         System.Single a2;
         checkType(l, 3, out a2);
         self.SetWidth(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #35
0
 static public int SetWidth(IntPtr l)
 {
     try {
         UnityEngine.LineRenderer self = (UnityEngine.LineRenderer)checkSelf(l);
         System.Single            a1;
         checkType(l, 2, out a1);
         System.Single a2;
         checkType(l, 3, out a2);
         self.SetWidth(a1, a2);
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }