public Terrain(Device device, String texture, int pitch, Renderer renderer) { HeightMap = new System.Drawing.Bitmap(@"Data/Textures/"+texture); WaterShader = new WaterShader(device); TerrainShader = new TerrainShader(device); _width = HeightMap.Width-1; _height = HeightMap.Height-1; _pitch = pitch; _terrainTextures = new ShaderResourceView[4]; _terrainTextures[0] = new Texture(device, "Sand.png").TextureResource; _terrainTextures[1] = new Texture(device, "Grass.png").TextureResource; _terrainTextures[2] = new Texture(device, "Ground.png").TextureResource; _terrainTextures[3] = new Texture(device, "Rock.png").TextureResource; _reflectionClippingPlane = new Vector4(0.0f, 1.0f, 0.0f, 0.0f); _refractionClippingPlane = new Vector4(0.0f, -1.0f, 0.0f, 0.0f); _noClippingPlane = new Vector4(0.0f, 1.0f, 0.0f, 10000); _reflectionTexture = new RenderTexture(device, renderer.ScreenSize); _refractionTexture = new RenderTexture(device, renderer.ScreenSize); _renderer = renderer; _bitmap = new Bitmap(device,_refractionTexture.ShaderResourceView,renderer.ScreenSize, new Vector2I(100, 100), 0); _bitmap.Position = new Vector2I(renderer.ScreenSize.X - 100, 0); _bitmap2 = new Bitmap(device, _reflectionTexture.ShaderResourceView, renderer.ScreenSize, new Vector2I(100, 100), 0); _bitmap2.Position = new Vector2I(renderer.ScreenSize.X - 100, 120); _bumpMap = _renderer.TextureManager.Create("OceanWater.png"); _skydome = new ObjModel(device, "skydome.obj", renderer.TextureManager.Create("Sky.png")); BuildBuffers(device); WaveTranslation = new Vector2(0,0); }
void Start() { pointer = GameObject.Find("GazePointer"); rend = pointer.GetComponent<Renderer> (); rgp = pointer.GetComponent<ResizeGazePointer> (); rend.material.color = Color.white; }
void Start() { rend = GetComponent<Renderer>(); noiseTex = new Texture2D(pixWidth, pixHeight); pix = new Color[noiseTex.width * noiseTex.height]; rend.material.mainTexture = noiseTex; }
void LeavesFog() { smoke = GameObject.Find ("Smoke"); smokeRenderer = smoke.GetComponent<Renderer> (); smokeRenderer.enabled = false; player.purityEnabled = false; }
/// <summary> /// /// </summary> void Awake() { m_Transform = transform; // the muzzleflash is meant to use the 'Particles/Additive' // (unity default) shader which has the 'TintColor' property m_Color = renderer.material.GetColor("_TintColor"); m_Color.a = 0.0f; m_ForceShow = false; // if a light is present in the prefab we will cache and use it m_Light = light; if (m_Light != null) { m_LightIntensity = m_Light.intensity; m_Light.intensity = 0.0f; } m_Renderer = renderer; if (m_Renderer != null) m_Material = renderer.material; }
// Use this for initialization void Start () { index = 0; _renderer = GetComponent<Renderer> (); //renderer.enabled=true; }
// Loop Function -------------------------------------------------------------------- void Start() { m_Renderer = GetComponent<Renderer>(); if (m_Renderer == null || m_Renderer.sharedMaterial == null || m_Renderer.sharedMaterial.mainTexture == null) { enabled = false; } else { GetComponent<Renderer>().material.mainTextureScale = new Vector2(m_fTilingX, m_fTilingY); // 0~1 value float offset; offset = m_fOffsetX + m_fTilingX; m_RepeatOffset.x = offset - (int)(offset); if (m_RepeatOffset.x < 0) m_RepeatOffset.x += 1; offset = m_fOffsetY + m_fTilingY; m_RepeatOffset.y = offset - (int)(offset); if (m_RepeatOffset.y < 0) m_RepeatOffset.y += 1; m_EndOffset.x = 1 - (m_fTilingX - (int)(m_fTilingX) + ((m_fTilingX - (int)(m_fTilingX)) < 0 ? 1:0)); m_EndOffset.y = 1 - (m_fTilingY - (int)(m_fTilingY) + ((m_fTilingY - (int)(m_fTilingY)) < 0 ? 1:0)); InitAnimationTimer(); } }
void EntersFog() { smoke = GameObject.Find ("Smoke"); smokeRenderer = smoke.GetComponent<Renderer> (); smokeRenderer.enabled = true; player.purityEnabled = true; }
private void Awake() { Instance = this; renderer = GetComponent<Renderer>(); targetMat = new Material(renderer.material); targetMat.color = Color.clear; renderer.sharedMaterial = targetMat; }
void Start() { rend = GetComponent<Renderer>(); rend.enabled = true; hookStartPos = this.transform.position; lineStartPos = line.transform.position; }
void Start() { player = GetComponent<Player>(); audioSource = GetComponent<AudioSource>(); quadRenderer = GetComponentInChildren<Renderer>(); startColor = quadRenderer.material.color; victoryText.text = ""; health = 100; if(winCount == null) { winCount = new int[2]; winCount[0] = 0; winCount[1] = 0; } deadNow = false; if (winCount[player.number] > 0) { winCountText.text = winCount[player.number].ToString(); winCountText.text += winCount[player.number] == 1 ? " WIN" : " WINS"; winCountText.gameObject.SetActive(true); } Debug.Log("Player " + player.number + "win count = " + winCount[player.number]); }
public static Bounds GetBounds(Renderer r) { if (r is SkinnedMeshRenderer) { SkinnedMeshRenderer smr = r as SkinnedMeshRenderer; Mesh mesh = smr.sharedMesh; Vector3[] vertices = mesh.vertices; if (vertices.Length <= 0) { return r.bounds; } int idx = 0; Vector3 min, max; min = max = r.transform.TransformPoint (vertices [idx++]); for (int i = idx; i < vertices.Length; i++) { Vector3 v = vertices [i]; Vector3 V = r.transform.TransformPoint (v); for (int n = 0; n < 3; n++) { if (V [n] > max [n]) max [n] = V [n]; if (V [n] < min [n]) min [n] = V [n]; } } Bounds b = new Bounds ();; b.SetMinMax (min, max); return b; } else { return r.bounds; } }
void Start() { instance = this; popRend = GameObject.Find ("ControlPadPop2").GetComponent<Renderer>(); //lev 1 if(LevelFinishedController.instance.getLevel() == FloorInstructions.instance.firstLightLevel) { transform.position = offScreen; popRend.material.mainTexture = Resources.Load("PopTextures/HighFivePop") as Texture; } /* //lev 2 else if(LevelFinishedController.instance.getLevel() == FloorInstructions.instance.firstTriggerLevel) { transform.position = triggerLev; popRend.material.mainTexture = Resources.Load("PopTextures/SwitchPop") as Texture; } //lev 3 else if(LevelFinishedController.instance.getLevel() == FloorInstructions.instance.firstZapLevel) { transform.position = zapLev; popRend.material.mainTexture = Resources.Load("PopTextures/ControlePadZap") as Texture; } //lev 4 else if(LevelFinishedController.instance.getLevel() == FloorInstructions.instance.firstDecoyLevel) { transform.position = decoyLev; popRend.material.mainTexture = Resources.Load("PopTextures/ControlePadDecoy") as Texture; } */ }
void Start() { rend = GetComponentInChildren<Renderer>(); //skammekrog = false; //mouse = GameObject.Find("CylinderMouse"); }
// Use this for initialization void Start() { if (null == target) { target = renderer; } Image = OpenNIContext.OpenNode(NodeType.Image) as ImageGenerator; inputSize = new Vector2(Image.MapOutputMode.XRes, Image.MapOutputMode.YRes); outputSize = (null != target) ? new Vector2(Mathf.NextPowerOfTwo((int)inputSize.x), Mathf.NextPowerOfTwo((int)inputSize.y)) : new Vector2(inputSize.x, inputSize.y); imageMapTexture = new Texture2D((int)outputSize.x, (int)outputSize.y, TextureFormat.RGB24, false); rawImageMap = new byte[Image.GetMetaData().BytesPerPixel * Image.MapOutputMode.XRes * Image.MapOutputMode.YRes]; imageMapPixels = new Color32[(int)(outputSize.x * outputSize.y)]; if (null != target) { float uScale = inputSize.x / outputSize.x; float vScale = inputSize.y / outputSize.y; target.material.SetTextureScale("_MainTex", new Vector2(uScale, -vScale)); target.material.SetTextureOffset("_MainTex", new Vector2(0.0f, vScale - 1.0f)); target.material.mainTexture = imageMapTexture; } openGl = SystemInfo.graphicsDeviceVersion.Contains("OpenGL"); if (openGl) { print("Running in OpenGL mode"); } }
// private Item m_item; private void Start() { m_sphereCollider = this.GetComponent<SphereCollider>(); m_renderer = this.GetComponent<Renderer>(); //m_item = new Item(itemName, itemDesc, itemID, itemType); }
// Use this for initialization void Start() { player = GameObject.FindWithTag("Player"); nooseChair = GameObject.FindWithTag("NooseChair"); chair = nooseChair.GetComponentInChildren<Renderer>(); womanWhisper = GameObject.Find("WhisperVoice"); }
// Use this for initialization void Start() { rend = GetComponent<Renderer>(); pl = GameObject.FindGameObjectWithTag("Player"); Physics2D.IgnoreCollision(GetComponent<Collider2D>(), pl.GetComponent<Collider2D>()); Physics2D.IgnoreCollision(GetComponent<Collider2D>(), pl.GetComponent<CircleCollider2D>()); }
// Use this for initialization protected virtual void Start() { m_Renderer = GetComponent<Renderer>(); m_Animator = GetComponent<Animator>(); m_HitSound = GetComponents<AudioSource>()[0]; m_DeathSound = GetComponents<AudioSource>()[1]; m_NameTag = transform.FindChild("NameTag"); m_HealthBar = transform.FindChild("HealthBar"); if (m_NameTag && m_HealthBar) { m_NameTagSpace = GameObject.Find("Name Space").transform; transform.SetParent(m_NameTagSpace); } if (!isServer && !isLocalPlayer) { m_Renderer.enabled = false; } else { m_Renderer.enabled = true; } foreach (RaycastHit2D hit in Physics2D.RaycastAll(transform.position, Vector3.zero, 1)) { VisitableObject room = hit.collider.transform.GetComponent<VisitableObject>(); if (room) { room.OnTriggerEnter2D(GetComponent<Collider2D>()); break; } } }
void Awake() { mytransform = transform; myrenderer = GetComponent<Renderer>(); size = Vector2.one * 0.25f; gameObject.active = false; }
void Start () { // Get the event from your particle system playgroundEvent = PlaygroundC.GetEvent (0, particles); // Subscribe to the event AddEventListener(); // Cache components of this GameObject (helps performance on low-end devices) thisTransform = transform; thisCollider = GetComponent<Collider>(); thisRenderer = GetComponent<Renderer>(); // Create materials to show if the event listener is active or not if (activeMaterial==null) { activeMaterial = new Material(Shader.Find ("Diffuse")); activeMaterial.color = Color.white; } if (inactiveMaterial==null) { inactiveMaterial = new Material(Shader.Find ("Diffuse")); inactiveMaterial.color = Color.black; } thisRenderer.sharedMaterial = activeMaterial; }
public override void Draw(Renderer renderer) { if (!isVisible) return; if (AnimatedTexture == null) { base.Draw(renderer); return; } Main.renderer.Draw(bg, new Rectangle((int)position.X, (int)position.Y, (int)Size.X, (int)Size.Y), Color.White * 0.95f * globalopacity); if (IsIn(InputEngine.curMouse.X,InputEngine.curMouse.Y) && !IsFading) { if (Utilities.Tools.IsRunningOnMono()) { Main.renderer.Draw(mono_fbo, new Rectangle(0, 0, Main.WindowWidth, Main.WindowHeight), Color.White); } else { DrawStencilView(); Main.renderer.BeginUnscaled(); } } else { Main.renderer.Draw(CurTexture, new Rectangle((int)position.X, (int)position.Y, (int)Size.X, (int)Size.Y), new Color(255, 255, 175) * textopacity * globalopacity); } }
void Awake() { s_moneycalc = money.GetComponent<moneycalc>(); renderer = gameObject.GetComponent<Renderer>(); go_GUI = GameObject.Find("GUI"); s_selecttower = go_GUI.GetComponent<selecttower>(); }
/// <summary> /// Constructs a new instance. /// </summary> /// <param name="width">The width of the backing store in pixels.</param> /// <param name="height">The height of the backing store in pixels.</param> /// <param name="renderer">GWEN renderer.</param> public TextRenderer(int width, int height, Renderer.OpenTK renderer) { if (width <= 0) throw new ArgumentOutOfRangeException("width"); if (height <= 0) throw new ArgumentOutOfRangeException("height"); if (GraphicsContext.CurrentContext == null) throw new InvalidOperationException("No GraphicsContext is current on the calling thread."); bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); gfx = Graphics.FromImage(bmp); // NOTE: TextRenderingHint.AntiAliasGridFit looks sharper and in most cases better // but it comes with a some problems. // // 1. Graphic.MeasureString and format.MeasureCharacterRanges // seem to return wrong values because of this. // // 2. While typing the kerning changes in random places in the sentence. // // Until 1st problem is fixed we should use TextRenderingHint.AntiAlias... :-( gfx.TextRenderingHint = TextRenderingHint.AntiAlias; gfx.Clear(Color.Transparent); texture = new Texture(renderer) {Width = width, Height = height}; }
protected VisualEffect(IServiceProvider services, string effectAsset, int effectLayerCount, IEnumerable<RenderTargetLayerType> requiredRenderTargets) { if (services == null) throw new ArgumentNullException("services"); if (effectAsset == null) throw new ArgumentNullException("effectAsset"); if (requiredRenderTargets == null) throw new ArgumentNullException("requiredRenderTargets"); if (effectLayerCount < 0) throw new ArgumentOutOfRangeException("affectedLayers", "Parameter should have non-negative value."); renderer = (Renderer)services.GetService(typeof(Renderer)); resourceManager = (ResourceManager)services.GetService(typeof(ResourceManager)); this.requiredRenderTargets = requiredRenderTargets; this.effectLayerCount = effectLayerCount > 0 ? effectLayerCount : renderer.KBufferManager.Configuration.LayerCount; effect = resourceManager.Load<Effect>(effectAsset); effectTechnique = effect.GetTechniqueByName(VisualEffectTechniqueName); if (!effectTechnique.IsValid) throw new ArgumentException( string.Format("Given effect asset '{0}' does not contain technique {1}.", effectAsset, VisualEffectTechniqueName), "effectAsset"); }
public void SetBright(Renderer[] brightItem,int brightIndex) { for (int i=0; i<7; i++) { ((Renderer)brightItem.GetValue (i)).material.color = new Color(((Renderer)brightItem.GetValue (i)).material.color.r,((Renderer)brightItem.GetValue (i)).material.color.g,((Renderer)brightItem.GetValue (i)).material.color.b,.5f); } ((Renderer)brightItem.GetValue (brightIndex-1)).material.color = new Color(((Renderer)brightItem.GetValue (brightIndex-1)).material.color.r,((Renderer)brightItem.GetValue (brightIndex-1)).material.color.g,((Renderer)brightItem.GetValue (brightIndex-1)).material.color.b,1f); }
//for moving object based on gaze coordinates from tracker //based on resolution of window //receives object, renderer, bounds script, and data script //returns vector3 position in world coordinates public Vector3 positionObjectWithRendererBoundsData(GameObject theObject, Renderer theRenderer, Bounds theBounds, GazeDataManager theData) { //verify the gaze data if (theData.gazeCoords != null) { //convert gaze coords to screen coords Point2D screenCoords = DataUtilities.gazePointToWindowPoint(theData.gazeCoords); //convert window coords to viewport coords Point2D viewCoords = DataUtilities.windowPointToViewPoint(screenCoords); Vector3 viewVector = new Vector3((float)viewCoords.X, (float)(viewCoords.Y), 0); //check bounds //use the object with the outermost bounds and a renderer to make the check Vector3 boundsVector = theBounds.checkBoundsForRenderer(theRenderer, viewVector); //convert viewport vector to world position vector Vector3 worldPos = Camera.main.ViewportToWorldPoint(boundsVector); worldPos.z = theObject.transform.position.z; //maintain z position for object //return new world position return worldPos; } //error else { //Debug.Log("[GazeMove] Null gaze data, " + theObject.name + " cannot be positioned"); return Vector3.zero; } } //end function
// Use this for initialization void Start() { rend = GetComponent<Renderer> (); clipRange = rend.material.GetFloat ("_ClipRange"); range = rend.material.GetVector ("_Range").x; }
// Use this for initialization void Start () { _renderer = GetComponent<Renderer>(); _renderer.material.shader = Shader.Find("MK/MKGlow/Transparent/DiffuseRim"); }
// Use this for initialization void Start() { quad = transform.Find("Quad"); quadRenderer = quad.renderer; UvProjector.ProjectUvs(new Transform[]{quad}, cameraAnchor, Camera.main); }
void Start() { rend = GetComponent <Renderer>(); _baseColor = rend.material.color; }
/// <summary> /// Calls GetComponent for all cached components if the currently cached instance is no longer valid. /// </summary> public void ResetCacheDestroyed() { if (!animation) { animation = GetComponent <Animation>(); } if (!audio) { audio = GetComponent <AudioSource>(); } if (!camera) { camera = GetComponent <Camera>(); } if (!collider) { collider = GetComponent <Collider>(); } if (!collider2D) { collider2D = GetComponent <Collider2D>(); } if (!constantForce) { constantForce = GetComponent <ConstantForce>(); } if (!guiText) { guiText = GetComponent <GUIText>(); } if (!guiTexture) { guiTexture = GetComponent <GUITexture>(); } if (!hingeJoint) { hingeJoint = GetComponent <HingeJoint>(); } if (!light) { light = GetComponent <Light>(); } if (!networkView) { networkView = GetComponent <NetworkView>(); } if (!particleEmitter) { particleEmitter = GetComponent <ParticleEmitter>(); } if (!particleSystem) { particleSystem = GetComponent <ParticleSystem>(); } if (!renderer) { renderer = GetComponent <Renderer>(); } if (!rigidbody) { rigidbody = GetComponent <Rigidbody>(); } if (!rigidbody2D) { rigidbody2D = GetComponent <Rigidbody2D>(); } if (!transform) { transform = GetComponent <Transform>(); } }
private void Start() { m_Renderer = GetComponent <Renderer>(); m_Renderer.material.SetTexture("_MainTex", m_MainTexture); m_Renderer.material.SetColor("_Color", m_color); }
void OnEnable() { GameMain.EvtInputKey += Handle_InputKey; BackStageSetting bsSetting = GameMain.Singleton.BSSetting; mEnterVal_GameDifficult = bsSetting.GameDifficult_.Val; mEnterVal_CoinTicketRatio_Coin = bsSetting.CoinTicketRatio_Coin.Val; mEnterVal_CoinTicketRatio_Ticket = bsSetting.CoinTicketRatio_Ticket.Val; mEnterVal_IsBulletCross = bsSetting.IsBulletCrossWhenScreenNet.Val; mEnterVal_ScoreChangeValue = bsSetting.ScoreChangeValue.Val; mEnterVal_Scoremax = bsSetting.ScoreMax.Val; mEnterVal_Scoremin = bsSetting.ScoreMin.Val; mEnterVal_OutBountyType = bsSetting.OutBountyType_.Val; mEnterVal_GunLayoutType = bsSetting.GunLayoutType_.Val; mEnterVal_Language = bsSetting.LaguageUsing.Val; Ctrl_GameDifficul.ViewIdx = (int)mEnterVal_GameDifficult; Ctrl_CoinTicketRatio_Coin.ViewTextFormat = "{0:d} " + BackstageMain.Singleton.Unit_Coin.CurrentText; Ctrl_CoinTicketRatio_Coin.NumViewing = mEnterVal_CoinTicketRatio_Coin; Ctrl_CoinTicketRatio_Ticket.ViewTextFormat = "{0:d} " + BackstageMain.Singleton.Unit_Ticket.CurrentText; Ctrl_CoinTicketRatio_Ticket.NumViewing = mEnterVal_CoinTicketRatio_Ticket; //Ctrl_IsBulletCross.ViewIdx Ctrl_IsBulletCross.ViewIdx = mEnterVal_IsBulletCross ? 1 : 0; Ctrl_ScoreChangeVal.ViewTextFormat = "{0:d} " + BackstageMain.Singleton.Unit_Score.CurrentText; Ctrl_ScoreChangeVal.NumViewing = mEnterVal_ScoreChangeValue; Ctrl_MaxScore.ViewTextFormat = "{0:d} " + BackstageMain.Singleton.Unit_Score.CurrentText; Ctrl_MaxScore.NumViewing = mEnterVal_Scoremax; Ctrl_MinScore.ViewTextFormat = "{0:d} " + BackstageMain.Singleton.Unit_Score.CurrentText; Ctrl_MinScore.NumViewing = mEnterVal_Scoremin; Ctrl_Language.ViewIdx = (int)mEnterVal_Language; if (!bsSetting.Dat_GameShowLanguageSetup.Val) { Renderer r = Ctrl_Language.GetComponentInChildren <Renderer>(); if (r != null) { r.enabled = false; } Transform ts = transform.Find("OptionText/OptionText8"); if (ts != null) { if (ts.GetComponent <Renderer>() != null) { ts.GetComponent <Renderer>().enabled = false; } } } else { Renderer r = Ctrl_Language.GetComponentInChildren <Renderer>(); if (r != null) { r.enabled = true; } Transform ts = transform.Find("OptionText/OptionText8"); if (ts != null) { if (ts.GetComponent <Renderer>() != null) { ts.GetComponent <Renderer>().enabled = true; } } } Ctrl_OutBountyType.ViewIdx = (int)mEnterVal_OutBountyType; Ctrl_GunLayouType.ViewIdx = (int)mEnterVal_GunLayoutType; if (CursorLocals != null && CursorLocals.Length != 0) { BackstageMain.Singleton.UpdateCursor(CursorLocals[mCurCursorIdx]); } //Spr_GunLayoutHint.renderer.enabled = false; Ctrl_GunLayouType.EvtAdvanceing += Handle_Ctrl_GunLayoutType; }
// Start is called before the first frame update void Start() { m_objectRenderer = GetComponent <Renderer>(); m_defaultMaterial = m_objectRenderer.material; }
public void GenerateMap() { currentMap = maps[mapIndex]; tileMap = new Transform[currentMap.mapSize.x, currentMap.mapSize.y]; System.Random prng = new System.Random(currentMap.seed); //Generating coords allTileCoords = new List <Coord> (); for (int x = 0; x < currentMap.mapSize.x; x++) { for (int y = 0; y < currentMap.mapSize.y; y++) { allTileCoords.Add(new Coord(x, y)); } } shuffledTileCoords = new Queue <Coord> (Utility.ShuffleArray(allTileCoords.ToArray(), currentMap.seed)); //Put under Generated map holder string holderName = "Generated Map"; if (transform.Find(holderName)) { DestroyImmediate(transform.Find(holderName).gameObject); } Transform mapHolder = new GameObject(holderName).transform; mapHolder.parent = transform; //Instantiate Tiles for (int x = 0; x < currentMap.mapSize.x; x++) { for (int y = 0; y < currentMap.mapSize.y; y++) { Vector3 tilePosition = CoordToPosition(x, y); Transform newTile = Instantiate(tilePrefab, tilePosition, Quaternion.Euler(Vector3.right * 90)) as Transform; newTile.localScale = Vector3.one * (1 - outlinePercent) * tileSize; newTile.parent = mapHolder; tileMap[x, y] = newTile; } } bool[,] obstacleMap = new bool[(int)currentMap.mapSize.x, (int)currentMap.mapSize.y]; //Instantiate Obstacles int obstacleCount = (int)(currentMap.mapSize.x * currentMap.mapSize.y * currentMap.obstaclePercent); int currentObstacleCount = 0; List <Coord> allOpenCoords = new List <Coord> (allTileCoords); //Copies allTileCoords for (int i = 0; i < obstacleCount; i++) { Coord randomCoord = GetRandomCoord(); obstacleMap[randomCoord.x, randomCoord.y] = true; currentObstacleCount++; if (randomCoord != currentMap.mapCenter && MapIsFullyAccessible(obstacleMap, currentObstacleCount)) { float obstacleHeight = Mathf.Lerp(currentMap.minObstacleHeight, currentMap.maxObstacleHeight, (float)prng.NextDouble()); Vector3 obstaclePosition = CoordToPosition(randomCoord.x, randomCoord.y); Transform newObstacle = Instantiate(obstaclePrefab, obstaclePosition + Vector3.up * (obstacleHeight / 2), Quaternion.identity) as Transform; newObstacle.parent = mapHolder; newObstacle.localScale = new Vector3((1 - outlinePercent) * tileSize, obstacleHeight, (1 - outlinePercent) * tileSize); Renderer obstacleRenderer = newObstacle.GetComponent <Renderer> (); Material obstaceMaterial = new Material(obstacleRenderer.sharedMaterial); float colorPercent = randomCoord.y / (float)currentMap.mapSize.y; obstaceMaterial.color = Color.Lerp(currentMap.foregroundColour, currentMap.backgroundColour, colorPercent); obstacleRenderer.sharedMaterial = obstaceMaterial; //Remove the coordinate from the allOpenCoord if there is an obstacle on it. allOpenCoords.Remove(randomCoord); } else { obstacleMap[randomCoord.x, randomCoord.y] = false; currentObstacleCount--; } } //Shuffle open tile coords shuffledOpenTileCoords = new Queue <Coord> (Utility.ShuffleArray(allOpenCoords.ToArray(), currentMap.seed)); //Place navmash blocker around the mep, so tha agents wont go around the map //Left Transform maskLeft = Instantiate(navmeshMaskPrefab, Vector3.left * ((currentMap.mapSize.x + maxMapSize.x) / 4f) * tileSize, Quaternion.identity) as Transform; maskLeft.parent = mapHolder; maskLeft.localScale = new Vector3((maxMapSize.x - currentMap.mapSize.x) / 2f, 1, currentMap.mapSize.y) * tileSize; //Right Transform maskRight = Instantiate(navmeshMaskPrefab, Vector3.right * ((currentMap.mapSize.x + maxMapSize.x) / 4f) * tileSize, Quaternion.identity) as Transform; maskRight.parent = mapHolder; maskRight.localScale = new Vector3((maxMapSize.x - currentMap.mapSize.x) / 2f, 1, currentMap.mapSize.y) * tileSize; //Top Transform maskTop = Instantiate(navmeshMaskPrefab, Vector3.forward * ((currentMap.mapSize.y + maxMapSize.y) / 4f) * tileSize, Quaternion.identity) as Transform; maskTop.parent = mapHolder; maskTop.localScale = new Vector3(maxMapSize.x, 1, (maxMapSize.y - currentMap.mapSize.y) / 2f) * tileSize; //Bottom Transform maskBot = Instantiate(navmeshMaskPrefab, Vector3.back * ((currentMap.mapSize.y + maxMapSize.y) / 4f) * tileSize, Quaternion.identity) as Transform; maskBot.parent = mapHolder; maskBot.localScale = new Vector3(maxMapSize.x, 1, (maxMapSize.y - currentMap.mapSize.y) / 2f) * tileSize; navmeshFloor.localScale = new Vector3(maxMapSize.x, maxMapSize.y) * tileSize; mapFloor.localScale = new Vector3(currentMap.mapSize.x * tileSize, currentMap.mapSize.y * tileSize); }
public void FindGOByTag() { if (!isProxyValid()) { return; } proxy.arrayList.Clear(); GameObject[] objtag = GameObject.FindGameObjectsWithTag(tag.Value); if (objtag.Length == 0) { Debug.LogWarning("No object with tag: " + tag.Value); return; } tempList.Clear(); Collider temp = colliderTarget.Value as Collider; Bounds colliderBounds = temp.bounds; if (layerFilterOn.Value == false) { for (int i = 0; i < objtag.Length; i++) { Renderer tempRen = objtag[i].GetComponent <Renderer>(); Bounds myObj = tempRen.bounds; bool insideCollider = colliderBounds.Intersects(myObj); if (insideCollider == true) { tempList.Add(objtag[i]); } } } if (layerFilterOn.Value == true) { for (int i = 0; i < objtag.Length; i++) { Renderer tempRen = objtag[i].GetComponent <Renderer>(); Bounds myObj = tempRen.bounds; bool insideCollider = colliderBounds.Intersects(myObj); if (insideCollider == true) { if (objtag[i].gameObject.layer == layer) { tempList.Add(objtag[i]); } } } } proxy.arrayList.InsertRange(0, tempList); }
void Start() { renderer = GetComponent <Renderer>(); }
public override void Tex(string contents) { Element.className += " loading"; Renderer.As <WorkerScoreRenderer>().Tex(contents); }
/// <summary> /// Caches the current Renderer attached to the object. /// </summary> public void ResetRendererCache() { renderer = GetComponent <Renderer>(); }
public ToolStripRenderer CreateToolStripRenderer() { return(Renderer.RenderToolStrip(GetResolvedPalette())); }
void Awake() { render = GetComponent <Renderer>(); _timeBorn = Time.time; }
public void Clear() { Renderer.Clear((uint)RendererBufferType.COLOR | (uint)RendererBufferType.DEPTH); }
public void Start() { _rend = GetComponent <Renderer>(); y = _rend.bounds.max.y; }
protected virtual void Start() { renderer = GetComponent <Renderer>(); collider = GetComponent <Collider>(); }
public void SetTitle(string title) { this.title = title + " | " + Application.GetApplication().GetBuildConfiguration() + " " + Application.GetApplication().GetPlatform() + " | Renderer: " + Renderer.GetTitle(); WinUser.SetWindowTextW(hWnd, this.title); }
public void RebuildMesh(Mesh mesh, Material[] materials, Renderer meshRenderer) { ((SkinnedMeshRenderer)meshRenderer).sharedMesh = mesh; meshRenderer.sharedMaterials = materials; }
protected override void OnAwoke() { _filter = GetComponent <MeshFilter>(); _renderer = GetComponent <Renderer>(); }
public static bool IsVisibleFrom(this Renderer renderer, Camera camera) { Plane[] planes = GeometryUtility.CalculateFrustumPlanes(camera); return GeometryUtility.TestPlanesAABB(planes, renderer.bounds); }
public ActionResult Save(ORDER_TASK_INFORMATION entity) { Common.ClientResult.OrderTaskGong result = new Common.ClientResult.OrderTaskGong(); try { Common.Account account = GetCurrentAccount(); if (string.IsNullOrWhiteSpace(entity.ID)) { List <COMPANY> companylist = m_BLL2.GetByParam(null, "asc", "ID", "COMPANYNAME&" + entity.INSPECTION_ENTERPRISE + ""); List <COMPANY> companylist2 = m_BLL2.GetByParam(null, "asc", "ID", "COMPANYNAME&" + entity.CERTIFICATE_ENTERPRISE + ""); foreach (var item in companylist) { if (item.COMPANY2 != null) { entity.INSPECTION_ENTERPRISEHELLD = item.COMPANY2.COMPANYNAME; break; } } foreach (var item in companylist2) { if (item.COMPANY2 != null) { entity.CERTIFICATE_ENTERPRISEHELLD = item.COMPANY2.COMPANYNAME; break; } else { entity.CERTIFICATE_ENTERPRISEHELLD = entity.CERTIFICATE_ENTERPRISE; break; } } string ORDER_NUMBER = m_BLL.GetORDER_NUMBER(ref validationErrors); var order = ORDER_NUMBER.Split('*');// DC2016001 * 1 * 2016 entity.ORDER_STATUS = Common.ORDER_STATUS_INFORMATION.保存.ToString(); var ms = new System.IO.MemoryStream(); entity.CREATETIME = DateTime.Now; entity.CREATEPERSON = account.PersonName; entity.ID = Result.GetNewId(); entity.ORDER_NUMBER = order[0].ToString(); entity.ORSERIALNUMBER = Convert.ToDecimal(order[1]); entity.ORYEARS = order[2].ToString(); entity.ORDER_STATUS = Common.ORDER_STATUS_INFORMATION.保存.ToString(); string path = Server.MapPath("~/up/ErWeiMa/"); foreach (var item in entity.APPLIANCE_DETAIL_INFORMATION) { item.ID = Result.GetNewId(); item.CREATETIME = DateTime.Now; item.CREATEPERSON = account.PersonName; string bianma = Regex.Replace(Guid.NewGuid().ToString().Replace("-", ""), "[a-z]", "", RegexOptions.IgnoreCase).Substring(0, 8); item.BAR_CODE_NUM = entity.ORSERIALNUMBER.ToString().PadLeft(4, '0') + bianma; //二维码生成 ErrorCorrectionLevel Ecl = ErrorCorrectionLevel.M; //误差校正水平 string Content = item.ID; //待编码内容 QuietZoneModules QuietZones = QuietZoneModules.Two; //空白区域 int ModuleSize = 3; //大小 var encoder = new QrEncoder(Ecl); QrCode qr; if (encoder.TryEncode(Content, out qr))//对内容进行编码,并保存生成的矩阵 { Renderer r = new Renderer(ModuleSize); r.QuietZoneModules = QuietZones; r.WriteToStream(qr.Matrix, ms, ImageFormat.Png); } //QRCodeHelper.GetQRCode(item.ID, ms); var pathErWeiMa = path + item.ID + ".png"; //System.IO.FileStream fs = new System.IO.FileStream(pathErWeiMa, System.IO.FileMode.OpenOrCreate); //System.IO.BinaryWriter w = new System.IO.BinaryWriter(fs); #region 二维码加字 System.IO.FileStream fss = new System.IO.FileStream(Server.MapPath("~/up/moban.png"), System.IO.FileMode.Open, FileAccess.Read, FileShare.ReadWrite); if (fss == null) { LogClassModels.WriteServiceLog("我是来测试的" + Server.MapPath("~/up/moban.png"), "委托单信息222" );//写入日志 } else { LogClassModels.WriteServiceLog("我是来测试的aaaa" + Server.MapPath("~/up/moban.png"), "委托单信息333" );//写入日志 } int filelength = 0; filelength = (int)fss.Length; //获得文件长度 Byte[] image = new Byte[filelength]; //建立一个字节数组 fss.Read(image, 0, filelength); //按字节流读取 System.Drawing.Image imag = System.Drawing.Image.FromStream(fss); //System.Drawing.Image Image = System.Drawing.Image.FromStream(ms); Graphics g = null; g = Graphics.FromImage(imag); string xinghao = item.BAR_CODE_NUM;//需要写入的字 //string xinghao = "123456789abcd";//需要写入的字 int w = imag.Width; int h = imag.Height; //entity.INSPECTION_ENTERPRISE StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Center; format.LineAlignment = StringAlignment.Center; DrawString(g, item.BAR_CODE_NUM, new Font("宋体", 14), new SolidBrush(Color.Black), new PointF(430, 200), format, -90f); var COMPANY = m_BLL2.GetAll(); var dw = COMPANY.Where(m => m.COMPANYNAME == entity.INSPECTION_ENTERPRISE).Select(s => s.POSTCODE).Single(); DrawString(g, dw, new Font("宋体", 14), new SolidBrush(Color.Black), new PointF(490, 200), format, -90f); //g.DrawString(item.BAR_CODE_NUM, new Font("宋体", 10), Brushes.Red, new PointF(350, 0));//x:值越大越靠右;y:值越小越靠上 //if (entity.INSPECTION_ENTERPRISE.Length>9) //{ // string zhi = entity.INSPECTION_ENTERPRISE.Substring(0, 9); // string zhi2= entity.INSPECTION_ENTERPRISE.Remove(0, 9); // g.DrawString(zhi, new Font("宋体", 14), Brushes.Red, new PointF(0, 320));//x:值越大越靠右;y:值越小越靠上 // g.DrawString(zhi2, new Font("宋体", 14), Brushes.Red, new PointF(0, 380));//x:值越大越靠右;y:值越小越靠上 //} //else //{ // g.DrawString(entity.INSPECTION_ENTERPRISE, new Font("宋体", 14), Brushes.Red, new PointF(0, 320));//x:值越大越靠右;y:值越小越靠上 //} System.Drawing.Image ig = CombinImage(imag, ms); //System.Drawing.Image ig = imag; fss.Close(); TuPanBaoCun(ig, pathErWeiMa); //生成pdf //图片 //Image image = Image.GetInstance(imagePath); //cell = new PdfPCell(image, true); //table.AddCell(cell); PDF.Create(path + item.ID); #endregion //w.Write(ms.ToArray()); //fs.Close(); //器具明细信息_承接实验室表添加数据 foreach (var it in item.UNDERTAKE_LABORATORYID.TrimEnd(',').Split(',')) { item.APPLIANCE_LABORATORY.Add(new APPLIANCE_LABORATORY() { ID = Result.GetNewId(), UNDERTAKE_LABORATORYID = it, ORDER_STATUS = Common.ORDER_STATUS.保存.ToString(), EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.保存.GetHashCode().ToString(), DISTRIBUTIONPERSON = account.PersonName, DISTRIBUTIONTIME = DateTime.Now, CREATEPERSON = account.PersonName, CREATETIME = DateTime.Now, ISRECEIVE = Common.ISRECEIVE.是.ToString(), RECYCLING = entity.RECYCLING }); } } ms.Close(); string returnValue = string.Empty; if (m_BLL.Create(ref validationErrors, entity)) { LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",委托单信息的信息的Id为" + entity.ID, "委托单信息" );//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.InsertSucceed; result.Id = entity.ID; return(Json(result)); //提示创建成功 } else { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return(true); }); } LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",委托单信息的信息," + returnValue, "委托单信息" );//写入日志 result.Code = Common.ClientCode.Fail; result.Message = Suggestion.InsertFail + returnValue; return(Json(result)); //提示插入失败 } } else { } result.Code = Common.ClientCode.FindNull; result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对 } catch (Exception lastError) { // fss.Close(); ExceptionsHander.WriteExceptions(lastError);//将异常写入数据库 } return(Json(result)); }
private void Start() { player = FindObjectOfType <PlayerMovement>().transform; rnd = GetComponent <Renderer>(); rnd.enabled = false; }
void Awake() { rend = GetComponent <Renderer>(); SetupHeatGradients(); }
public void Start() { rend = GetComponent <Renderer>(); agent = GetComponent <NavMeshAgent>(); gun = GetComponentInChildren <Gun>(); //? }
// Use this for initialization void Start() { rendX = xButton.GetComponent <Renderer>(); rendX.enabled = false; }
/// <summary> /// Simple check for the use of MRTK standard shader. /// </summary> /// <param name="rends"><see cref="Renderer[]"/> to check for the MRTK standard shader.</param> /// <returns>true when render is using the MRTK standard shader.</returns> private bool CheckForStandardShader(Renderer renderer) { return(StandardShaderUtility.IsUsingMrtkStandardShader(renderer.sharedMaterial) || renderer.sharedMaterial.shader == MRTKtmp); }
// Get the Rigidbody void Start() { //Creates checkpoints array and orders it by name checkPointArray = GameObject.FindGameObjectsWithTag("CheckPoint").OrderBy( go => go.name ).ToArray(); foreach (GameObject cp in checkPointArray) { respawnPointArray[checknum] = cp.transform; checknum++; } //Other initializations rb = GetComponent<Rigidbody>(); mass = rb.mass; currentLap = 1; gamePaused = false; //Skidmarks and Smoke Initialization trailEmitter_R = gameObject.transform.Find("Skidmarks_Emitters/skidR").gameObject; trailEmitter_L = gameObject.transform.Find("Skidmarks_Emitters/skidL").gameObject; trailEmitter_Pref = GameObject.Find("Skidmarks_Emitters"); trailEmitterTrans = trailEmitter_Pref.transform; skidding = false; alreadySkidding = false; smokeEmitter = gameObject.transform.FindChild("Smoke_Emitters").gameObject; //Set emitters to inactive trailEmitter_Pref.SetActive(false); //Set respawnpoint as start currentCheckpoint = 0; //Get text component of GUI timeTimer = GameObject.Find("TimeText").GetComponent<Text>(); bestTime = 0; //Get Blur Scripts which will be enabled when game is paused blurScripts = GetComponentsInChildren<Blur>(); //Set the normal emission texture as the current onee rend = GameObject.Find("rearRightLight").GetComponent<Renderer>(); rend2 = GameObject.Find("rearLeftLight").GetComponent<Renderer>(); normalEmission = rend.material.GetTexture("_EmissionMap"); /* foreach(Transform child in GameObject.Find("CheckPoints").transform) { Debug.Log(child); Debug.Log(checkpoints.Length); Debug.Log(checkPointArray); } */ //Other stuff for tests delete after. //rb.centerOfMass = new Vector3(rb.centerOfMass.x, rb.centerOfMass.y, rb.centerOfMass.z+1); //transform.position = new Vector3(438.05f, 1.09f, 99.79f); }
void Awake() { renderer = GetComponent <Renderer>(); originalMaterial = new Material(renderer.material); }
new void Start() { base.Start(); rend = this.gameObject.GetComponent <Renderer>(); col = this.gameObject.GetComponent <Collider>(); }
private void Awake() { characterRigidbody = character.GetComponent <Rigidbody2D>(); backgroundRenderer = GetComponent <MeshRenderer>(); }
void Start() { renderer = GetComponent <Renderer>(); InvokeRepeating("Switch", frequency, frequency); }