private void Start() { _camera = FindObjectOfType <CustomCamera>(); _reduxTime = _time + Random.Range(_redaxMinTime, _redaxMaxTime); _playerTransform = FindObjectOfType <Player>().transform; StartCoroutine(Generate()); }
public DroidCameraPreview(SurfaceView a_surfaceView, Context a_Context, CustomCamera a_CustomCamera) { m_surfaceView = a_surfaceView; m_CustomCamera = a_CustomCamera; m_Context = a_Context; Initialize(); }
void Start() { monsterHealth = monster.GetComponent <Health>(); theCamera = Camera.main.GetComponent <CustomCamera>(); StartCoroutine(stepStory()); fixedDeltaTime = Time.fixedDeltaTime; }
void Start() { mainCamera = FindObjectOfType <CustomCamera>(); TheOrganismFactory.Instance.onOrganismBirth += Target; TheOrganismFactory.Instance.onOrganismDeath += TargetAsteroid; TargetAsteroid(); }
private void Awake() { instance = this; eventManager = new EventManager(); rumble = new Rumble(); myCamera = Camera.main.GetComponent <CustomCamera>(); }
private void Awake() { _rectTransform = GetComponent <RectTransform>(); _camera = FindObjectOfType <CustomCamera>(); _canvas = FindObjectOfType <Canvas>(); _rectTransform.anchorMax = Vector2.one / 2; _rectTransform.anchorMin = Vector2.one / 2; _canvasRect = _canvas.GetComponent <RectTransform>(); SetParent(_canvasRect); }
private bool isWithinCameraView() { CustomCamera cam = GameObject.FindObjectOfType <CustomCamera>(); return(cam.IsWithinView( this.transform, spriteRend.bounds.size.x, spriteRend.bounds.size.y )); }
void Start() { _player = FindObjectOfType <Player>(); _camera = FindObjectOfType <CustomCamera>(); _length = GetComponent <SpriteRenderer>().bounds.size.x; _position = transform.position; _maxDistanceToCamera = _length + _camera.Width / 2; _lastFrameCameraPosition = _camera.transform.position; _backgroundsCount++; }
void LockCamera() { GameObject cameraObj = GameObject.Find("Custom_Camera"); cameraObj.GetComponent <AudioSource>().PlayOneShot(quakeClip); CustomCamera cameraScript = cameraObj.GetComponent <CustomCamera>(); cameraScript.sources.target = this.transform; cameraScript.config.cameraActive = true; cameraScript.config.cameraLocked = true; }
private void SetInstance() { if (Instance == null) { Instance = this; } else { Destroy(this); } }
public PlayerRobotSimulator(CustomCamera camera, IWorldLocator worldLocator, PrototypeObjectsFactory prototypeObjectsFactory, LocalPlayer localPlayer, RobotInventoryTextView view) { this.localPlayer = localPlayer; this.view = view; Camera = camera; WorldLocator = worldLocator; PrototypeObjectsFactory = prototypeObjectsFactory; setupRobot(); robot = localPlayer.RobotPlayerPart; }
private void Start() { SetInstance(); if (GetComponent <Rigidbody2D>() != null) { _rigidbody = GetComponent <Rigidbody2D>(); } else { _rigidbody = gameObject.AddComponent <Rigidbody2D>(); } RunDirection = Vector3.zero; _lastFramePosition = transform.position; _camera = FindObjectOfType <CustomCamera>(); }
/// <summary> /// What happens when player gets hit by an enemy /// </summary> public void Hit() { if (invincibilityCoolDown <= 0f && poweredUp) { AudioManager.Instance.PlaySFX(Constants.POWER_DOWN_SFX); poweredUp = false; invincibilityCoolDown = invincibilityFrame; StartCoroutine(playPowerDownAnim()); } else if (invincibilityCoolDown <= 0f) { // get camera to stop following player CustomCamera cam = GameObject.FindObjectOfType <CustomCamera>(); cam.StopFollowingPlayer(); Destroy(myRigidBody); isAlive = false; } }
private void Start() { lifesystem = new CharLifeSystem(life, life) .ADD_EVENT_OnGainLife(OnGainLife) .ADD_EVENT_OnLoseLife(OnLoseLife) .ADD_EVENT_Death(OnDeath) .ADD_EVENT_OnChangeValue(OnChangeLife); charanim = new CharacterAnimator(anim_base); customCam = FindObjectOfType <CustomCamera>(); move = new CharacterMovement(GetComponent <Rigidbody>(), rot, charanim) .SetSpeed(speed) .SetTimerDash(dashTiming).SetDashSpeed(dashSpeed) .SetDashCD(dashCD) .SetRollDeceleration(dashDeceleration); InDash += move.IsDash; ChildrensUpdates += move.OnUpdate; move.SetCallbacks(OnBeginRoll, OnEndRoll); charBlock = new CharacterBlock(_timerOfParry, blockAngle, _timeOfBlock, maxBlockCharges, timeToRecuperateCharges, chargesUI, charanim, GetSM, inParryParticles); charBlock.OnParry += () => charanim.Parry(true); charBlock.EndBlock += EVENT_UpBlocking; ChildrensUpdates += charBlock.OnUpdate; dmg = dmg_normal; charAttack = new CharacterAttack(attackRange, attackAngle, timeToHeavyAttack, charanim, rot, ReleaseInNormal, ReleaseInHeavy, feedbackHeavy, dmg, slash); charAttack.FirstAttackReady(true); charAnimEvent.Add_Callback("CheckAttackType", CheckAttackType); charAnimEvent.Add_Callback("DealAttack", DealAttack); charAnimEvent.Add_Callback("EndAttack", EndAttack); charAnimEvent.Add_Callback("RompeCoco", RompeCoco); charAnimEvent.Add_Callback("BeginBlock", charBlock.OnBlockSuccessful); charAnimEvent.Add_Callback("Dash", move.RollForAnim); SetStates(); rb = GetComponent <Rigidbody>(); StartDebug(); }
/// <summary> /// Move the player /// </summary> private void handleMovement() { if (!isAlive && deathWaitTime < Constants.DEATH_WAIT_TIME) { // died so move player to left side of the screen deathWaitTime += Time.deltaTime; this.transform.position = this.transform.position + (Vector3.left * 0.25f); } else if (!EndStage.Instance.HasStageFinished()) { // if game is still continuing if (canMove) { float moveX = Input.GetAxisRaw("Horizontal"); myRigidBody.velocity = new Vector2(moveX * MoveSpeed, myRigidBody.velocity.y); } else { // freeze the player in the current position they are in myRigidBody.velocity = Vector2.zero; } } else { // stage has been finished if (isGrounded()) { // if the player is grounded anim.SetBool("isMoving", false); anim.SetBool("isJumping", false); // play animation CustomCamera cam = GameObject.FindObjectOfType <CustomCamera>(); EndStage.Instance.PlayEndAnimation(poweredUp); cam.StopFollowingPlayer(); Destroy(this.gameObject); } } }
void Start() { CustomCamera = GameObject.FindObjectOfType<CustomCamera>(); Radar.Player = CustomCamera.Target; m_hActors = new List<Actor>(LobbyManager.Instance.GetActors()); if (m_hActors != null) { m_hActors.ForEach(hA => { if (!scores.ContainsKey(hA)) scores.Add(hA, 0); }); } LobbyManager.Instance.Created += Instance_Created; //ToDo: Rendere victory condition generica m_hVictoryCondition = new DeathMatchWinCondition(ScoreToWin); Cursor.SetCursor(InGameMouseCursor, new Vector2(16, 16), CursorMode.Auto); }
public void Start() { StartPosition = transform.position; _camera = FindObjectOfType <CustomCamera>(); }
public void BuildReflectMap(Camera mCamera, RenderDelegate renderDelegate) { DepthStencilBuffer oldDS = game.GraphicsDevice.DepthStencilBuffer; game.GraphicsDevice.DepthStencilBuffer = DepthBuffer; /*------------------------------------------------------------------------------------------ * Render to the Reflection Map */ //mGDevice.SetRenderState( RenderStates.ClipPlaneEnable, true ); mGDevice.RenderState.CullMode = CullMode.CullClockwiseFace; // Cull.Clockwise; mGDevice.SetRenderTarget(0, mReflectMap); //ReflectMap.BeginScene(); //ColorValue color = new ColorValue( 0, 0, 0, 0 ); mGDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, new Color((int)(255 * .13f), (int)(255 * .19f), (int)(255 * .22f)), 1.0f, 0); //mGDevice.Clear( ClearFlags.Target | ClearFlags.ZBuffer, Color.FromArgb( (int)( 255 * .13f ), (int)( 255 * .19f ), (int)( 255 * .22f ) ), 1.0f, 0 ); //reflection plane in local space //Plane waterPlaneL = new Plane( 0.0f, -1.0f, 0.0f, 2.7f * 1.5f ); Plane waterPlaneL = new Plane(0.0f, -1.0f, 0.0f, 1f * 1.5f); Matrix wInvTrans = Matrix.Invert(WorldMatrix); wInvTrans = Matrix.Transpose(wInvTrans); //reflection plane in world space Plane waterPlaneW = Plane.Transform(waterPlaneL, wInvTrans); Matrix wvpInvTrans = Matrix.Invert(WorldMatrix * mCamera.ViewProj); wvpInvTrans = Matrix.Transpose(wvpInvTrans); //reflection plane in homogeneous space Plane waterPlaneH = Plane.Transform(waterPlaneL, wvpInvTrans); mGDevice.ClipPlanes[0].IsEnabled = true; //no clue why to use this //mGDevice.ClipPlanes[ 0 ].Plane = waterPlaneH; mGDevice.ClipPlanes[0].Plane = Plane.Transform(waterPlaneL, WorldMatrix * mCamera.ViewProj); Matrix reflMatrix = Matrix.Identity; reflMatrix = Matrix.CreateReflection(waterPlaneW); //mTerrain.ReflectionPass = true; ICamera oldCam = game.Camera; CustomCamera cam = new CustomCamera(game); cam.SetViewProjectionMatrix(reflMatrix * mCamera.View, mCamera.Projection); game.SetCamera(cam); //render scene objects renderDelegate(game); game.SetCamera(oldCam); /*mSkyModel.Render( mGDevice, mCamera, waterPlaneW ); * drawTerrain( false, waterPlaneW ); * * mWater.ReflectMap.EndScene();*/ mGDevice.ClipPlanes.DisableAll(); //mGDevice.SetRenderState( RenderStates.ClipPlaneEnable, false ); //mGDevice.RenderState.CullMode = Cull.CounterClockwise; mGDevice.RenderState.CullMode = CullMode.CullCounterClockwiseFace; // Cull.Clockwise; game.GraphicsDevice.SetRenderTarget(0, null); game.GraphicsDevice.DepthStencilBuffer = oldDS; }
public PointLightRenderer(DX11Game game, GBuffer gBuffer) { this.game = game; this.gBuffer = gBuffer; var device = game.Device; context = device.ImmediateContext; reloadShader(game); quad = new FullScreenQuad(device); layout = FullScreenQuad.CreateInputLayout(device, noShadowsShader.GetCurrentPass(0)); LightPosition = new Vector3(0, 6, 0); LightRadius = 6; LightIntensity = 1; Color = new Vector3(1, 1, 0.9f); //var rasterizerInside = RasterizerState.FromDescription(device, new RasterizerStateDescription // { // CullMode = CullMode.Front // }); //var rasterizerOutside = RasterizerState.FromDescription(device, new RasterizerStateDescription //{ // CullMode = CullMode.Back //}); var shadowCubeMap = new Texture2D(device, new Texture2DDescription { ArraySize = 6, BindFlags = BindFlags.DepthStencil | BindFlags.ShaderResource, CpuAccessFlags = CpuAccessFlags.None, Format = global::SlimDX.DXGI.Format.R32_Typeless, Height = shadowMapSize, Width = shadowMapSize, MipLevels = 1, OptionFlags = ResourceOptionFlags.TextureCube, SampleDescription = new global::SlimDX.DXGI.SampleDescription(1, 0), Usage = ResourceUsage.Default }); depthStencilViewFaces = new DepthStencilView[6]; shadowCubeMapRVs = new ShaderResourceView[6]; LightCameras = new CustomCamera[6]; for (int i = 0; i < 6; i++) { depthStencilViewFaces[i] = new DepthStencilView(device, shadowCubeMap, new DepthStencilViewDescription { Dimension = DepthStencilViewDimension .Texture2DArray, ArraySize = 1, FirstArraySlice = i, Flags = DepthStencilViewFlags .None, Format = global::SlimDX.DXGI.Format. D32_Float, MipSlice = 0 }); //ShadowCubeMapRVs[i] = new ShaderResourceView(device, shadowCubeMap, new ShaderResourceViewDescription //{ // Dimension = ShaderResourceViewDimension.Texture2D, // ArraySize = 1, // FirstArraySlice = i, // Format = SlimDX.DXGI.Format.R32_Float, // MipLevels = 1, // MostDetailedMip = 0 //}); LightCameras[i] = new CustomCamera(); } ShadowCubeMapRv = new ShaderResourceView(device, shadowCubeMap, new ShaderResourceViewDescription { Dimension = ShaderResourceViewDimension.TextureCube, MostDetailedMip = 0, MipLevels = 1, Format = global::SlimDX.DXGI.Format.R32_Float }); }
public UICameraPreview(CustomCamera camera) { m_CustomCamera = camera; Initialize(); }
void Awake() { carCameras = GetComponent <CustomCamera>(); }
//VOID START void Start() { animator = GetComponent <Animator>(); playerStScript = GetComponent <PlayerStats>(); //FIND THE InputFieldGameChat Object and get the InputField COMPONENT inputFieldGameChat = GameObject.Find("InputFieldGameChat").GetComponent <InputField>(); //FIND GAMEMAGER AND ACCESS THE DMGDATABASE SCRIPT GameManager = GameObject.Find("GameManager_mn"); dmgScript = GameManager.GetComponent <DmgDatabase>(); particleScript = GameManager.GetComponent <ParticleManager>(); particleScript.CreateSpawnParticle(this.transform); teleportParticle = particleScript.teleportParticle; if (uLink.Network.isServer) { playerSpellScript = transform.GetComponent <PlayerSpells>(); agent = GetComponentInChildren <NavMeshAgent>(); agent.updateRotation = false; agent.updatePosition = true; initialRotation = transform.rotation; initialPos = transform.position; } if (networkView.isOwner == true) { mainPortrait = GameObject.Find("CharPortrait").GetComponent <Image>(); mainPortrait.sprite = playerStScript.stats.charPortrait; //StartCoroutine(RecallBaseRPC()); GameManager.GetComponent <GameEvents>().PlayGreetingsAudio(); //SEND A REFERENCE OF THE PLAYERSTATS SCRIPT TO THE GAMEEVENTS SCRIPT ATTACHED TO GAME MANAGER OBJ GameManager.GetComponent <GameEvents>().playerStScript = playerStScript; GameObject.Find("LeftPanel").GetComponent <LeftPanelUi>(); playerSpellScript = transform.GetComponent <PlayerSpells>(); //FIND LeftPanel GAMEOBJECT AND GET LeftPanelUi COMPONENT leftPanelScript = GameObject.Find("LeftPanel").GetComponent <LeftPanelUi>(); //FIND QcdUi GAMEOBJECT AND GET CDRUi COMPONENT cdrUiScript = GameObject.Find("CdUi").GetComponent <CDRUi>(); //FIND Qcdr GAMEOBJECT AND GET SHOWCDR COMPONENT cdrUiQScript = GameObject.Find("Qcdr").GetComponent <ShowCDR>(); //FIND Wcdr GAMEOBJECT AND GET SHOWCDR COMPONENT cdrUiWScript = GameObject.Find("Wcdr").GetComponent <ShowCDR>(); //FIND Ecdr GAMEOBJECT AND GET SHOWCDR COMPONENT cdrUiEScript = GameObject.Find("Ecdr").GetComponent <ShowCDR>(); //FIND Rcdr GAMEOBJECT AND GET SHOWCDR COMPONENT cdrUiRScript = GameObject.Find("Rcdr").GetComponent <ShowCDR>(); //FIND EACH ELEMENT OF THE UI TO SHOW HEALTH, MANA AND SPELL LEVELS healthCdImage = GameObject.Find("HpBar").GetComponent <Image>(); manaCdImage = GameObject.Find("ManaBar").GetComponent <Image>(); spellLvlScript = GameObject.Find("SpellsLvl").GetComponent <SpellLvlScript>(); //gameEventScript = gameManager.GetComponent<GameEvents>(); //SET THE CAMERA ACTIVE TO THIS TARGET PLAYER cam = Camera.main; cameraObj = GameObject.Find("Custom_Camera"); cameraScript = cameraObj.GetComponent <CustomCamera>(); cameraScript.sources.target = this.transform; cameraScript.config.cameraActive = true; cameraScript.config.cameraLocked = true; } //playerStScript.stats = playerStScript.stats; }
void Update() { if (CustomCamera == null) { CustomCamera = GameObject.FindObjectOfType<CustomCamera>(); Radar.Player = CustomCamera.Target; } ScoreText.text = scores.ToList().Where(hP => hP.Key.isLocalPlayer).FirstOrDefault().Value.ToString(); }
//void Awake () { // //Application.targetFrameRate = 30; //} void Start() { if (carCamerasController == null) { carCamerasController = Camera.main.GetComponent <CarCamerasController_legacy>(); } settingsMenu = GetComponent <SettingsMenu>(); carCameras = Camera.main.GetComponent <CustomCamera>(); if (mapCameraController == null) { if (GameObject.FindWithTag("MapCamera")) { mapCameraController = GameObject.FindWithTag("MapCamera").GetComponent <CarCamerasController_legacy>(); } else if (GameObject.Find("MapCamera")) { mapCameraController = GameObject.Find("MapCamera").GetComponent <CarCamerasController_legacy>(); } } object[] obj = GameObject.FindObjectsOfType(typeof(GameObject)); foreach (object o in obj) { GameObject g = (GameObject)o; if (g.GetComponent <Light>() != null) { mlight = g.GetComponent <Light>(); } } Time.fixedDeltaTime = fixedTimeStep; if (cars.Count == 0) { cars = GameObject.FindGameObjectsWithTag("Car").ToList(); } foreach (GameObject car in cars) { if (car != null) { car.SetActiveRecursively(true); if (car.transform.GetComponent <CarDebug>() != null) { car.transform.GetComponent <CarDebug>().enabled = false; } if (car.transform.GetComponent <Setup>() != null) { car.transform.GetComponent <Setup>().enabled = false; } if (car.transform.GetComponent <CarDynamics>().skidmarks == null) { Skidmarks skidclone; if (skidmarks) { skidclone = Instantiate(skidmarks, Vector3.zero, Quaternion.identity) as Skidmarks; car.transform.GetComponent <CarDynamics>().skidmarks = skidclone; } } } } foreach (GameObject car in cars) { if (car != null) { DisableObject(car); } } if (cars.Count != 0 && cars[0] != null) { lastIndex = -1; selectedCar = ChangeCar(0, lastIndex); } }
public SpotLightRenderer(DX11Game game, GBuffer gBuffer) { this.game = game; this.gBuffer = gBuffer; var device = game.Device; context = device.ImmediateContext; reloadShader(game); quad = new FullScreenQuad(device); layout = FullScreenQuad.CreateInputLayout(device, noShadowsShader.GetCurrentPass(0)); LightPosition = new Vector3(0, 6, 0); LightRadius = 6; LightIntensity = 1; SpotDirection = MathHelper.Down; SpotLightAngle = MathHelper.ToRadians(30); SpotDecayExponent = 1; Color = new Vector3(1, 1, 0.9f); shadowMap = new Texture2D(device, new Texture2DDescription { ArraySize = 1, BindFlags = BindFlags.DepthStencil | BindFlags.ShaderResource, CpuAccessFlags = CpuAccessFlags.None, Format = global::SlimDX.DXGI.Format.R32_Typeless, Width = shadowMapSize, Height = shadowMapSize, MipLevels = 1, Usage = ResourceUsage.Default, SampleDescription = new global::SlimDX.DXGI.SampleDescription(1, 0) }); shadowMapRV = new ShaderResourceView(device, shadowMap, new ShaderResourceViewDescription { Dimension = ShaderResourceViewDimension.Texture2D, Format = global::SlimDX.DXGI.Format.R32_Float, MipLevels = 1, MostDetailedMip = 0 }); shadowMapDSV = new DepthStencilView(device, shadowMap, new DepthStencilViewDescription { Dimension = DepthStencilViewDimension.Texture2D, Format = global::SlimDX.DXGI.Format.D32_Float }); LightCamera = new CustomCamera(); //var rasterizerInside = RasterizerState.FromDescription(device, new RasterizerStateDescription // { // CullMode = CullMode.Front // }); //var rasterizerOutside = RasterizerState.FromDescription(device, new RasterizerStateDescription //{ // CullMode = CullMode.Back //}); }