// Use this for initialization void Start() { shader1 = Shader.Find("Particles/Alpha Blended"); shader2 = Shader.Find("Particles/Alpha Blended Premultiply"); smoo = Camera.main.GetComponent<SmoothFollow>(); //cam = Camera.allCameras; int i = 0; int j = 0; while (i < stickLen[0]) { while (j< stickLen[1]){ clone = (GameObject)Instantiate(unit, new Vector3(i* 1.0F,j * 1.0F, 0), Quaternion.Euler (0, 180,0)); clone.transform.parent = this.transform; j++; } i++; j=0; } /* while (i < stickLen) { clone = (GameObject)Instantiate(unit, new Vector3(0,i * 1.0F, 0), Quaternion.Euler (0, 180,0)); clone.transform.parent = this.transform; i++; } */ //find the leds as topmost children FindLeaves (transform, objects); //calculate frustum at regular intervals InvokeRepeating ("calcFrustum", 0, .3f); }
/* * Initialisations */ public override void Start() { /* TEST ================= */ prefabDbgCube = (GameObject)Resources.Load("dbgCube"); prefabPlayer = (GameObject)Resources.Load("spaceshipOne"); crosshair = (Texture)Resources.Load("Textures/crosshair"); //======================================================TEMP /* ============================================================= */ spawnPoints = GameObject.Find("SpawnPoints"); /* * Instantiate the player and set his position to the first * spawn point. */ player = (GameObject)Network.Instantiate(prefabPlayer, spawnPoints.transform.GetChild(0).transform.position, spawnPoints.transform.GetChild(0).transform.rotation, 0 ); /* * Make the MainCamera the player's camera and make it follow the player * by using the SmoothFollow script */ playerCamera = GameObject.FindGameObjectWithTag("MainCamera").camera; playerCamera.gameObject.AddComponent <SmoothFollow>(); SmoothFollow smoothFollowScript = playerCamera.gameObject.GetComponent <SmoothFollow>(); smoothFollowScript.target = player.transform; smoothFollowScript.height = 3.0f; instantiateCubes(); }
public override void Use(CarProperty car, int level) { if(!smoothFollow) smoothFollow = Camera.main.GetComponent<SmoothFollow>(); base.Use(car, level); StartCoroutine(InvincibleCar(car)); }
private void Awake() { nBodySimManager = GetComponent <NBodySimManager>(); freeCamera = GetComponent <FreeCamera>(); autoRotate = GetComponent <AutoRotate>(); smoothFollow = GetComponent <SmoothFollow>(); }
// Start is called before the first frame update void Start() { aud = GetComponents <AudioSource>(); sf = GameObject.Find("Main Camera").GetComponent <SmoothFollow>(); debugging = true; for (int i = 0; i < 1; i++) { //spawn position for zombie spawnPosition = new Vector3(Random.Range(2, 48), 1, Random.Range(2, 73)); //make zombie zombies.Add(Instantiate(zCube, spawnPosition, Quaternion.Euler(270, 0, 180))); } for (int i = 0; i < 10; i++) { //spawn position for human spawnPosition = new Vector3(Random.Range(2, 48), 1, Random.Range(2, 73)); //make human humans.Add(Instantiate(humanCube, spawnPosition, Quaternion.Euler(270, 0, 180))); } for (int i = 0; i < 20; i++) { //spawn position for obstacle spawnPosition = new Vector3(Random.Range(2, 48), 1, Random.Range(2, 73)); //make obstacle obs.Add(Instantiate(treeCube, spawnPosition, Quaternion.identity)); } }
// Use this for initialization void Start() { if (!networkView.isMine) { return; } Camera.main.GetComponent <SmoothFollow> ().enabled = false; Camera.main.transform.parent = transform; Camera.main.transform.localPosition = Vector3.zero; Camera.main.transform.localRotation = Quaternion.identity; GlobalInfo.playerViewID = networkView.viewID; GlobalInfo.userInfo.playerViewID = networkView.viewID; GlobalInfo.myPlayer = gameObject; GlobalInfo.playerCamera = Camera.main; if (Network.isServer) { GlobalInfo.userInfoList[0].equipment = GlobalInfo.userInfo.equipment; GlobalInfo.userInfoList[0].isReady = true; GlobalInfo.userInfoList[0].destroyed = false; GlobalInfo.userInfoList[0].playerViewID = GlobalInfo.playerViewID; GlobalInfo.eventHandler.SendMessage("OnUpdateUserList", SendMessageOptions.DontRequireReceiver); } else { GlobalInfo.rpcControl.RPC("OnRegistUserEquipRPC", RPCMode.Server, GlobalInfo.userInfo.name, (int)GlobalInfo.userInfo.equipment, true, GlobalInfo.playerViewID); } Camera.main.gameObject.GetComponent <AudioListener>().enabled = true; aimCross = (Texture2D)Resources.Load("GUI/GunSights/GhostGunSight"); sm = GetComponent <SmoothFollow>(); }
private void Start() { waves = GameObject.Find("Waves").GetComponent <WaterPlane>(); waterShader = waves.material; micObject = GameObject.Find("Microphone"); gyroObject = GameObject.Find("Gyroscope"); windController = GameObject.Find("Wind").GetComponent <WindController>(); lightSensor = GameObject.Find("LightSensor").GetComponent <LightSensorInput>(); deployClouds = GameObject.Find("CloudManager").GetComponent <Deploy_Clouds>(); perl = transform.FindChild("black_perl"); boat = GetComponent <Rigidbody>(); direction = new Vector3(); development = false; transform.rotation = Quaternion.identity; //for some reason the boat spawns sideways... boatCamera = Camera.main.GetComponent <SmoothFollow>(); cameraDistanceInit = boatCamera.distance; cloudTransform = transform.FindChild("Cloud"); cloudSystem = cloudTransform.GetComponent <ParticleSystem>(); cloudSystem.enableEmission = false; //windZone = transform.FindChild("WindZone").GetComponent<WindZone>(); cylinder = transform.GetChild(7); }
private void Start() { GameObject smoothFollowObject = new GameObject(); smoothFollowObject.transform.position = lookAtTarget == null ? Vector3.zero : lookAtTarget.position; smoothFollow = smoothFollowObject.AddComponent <SmoothFollow>(); }
public void Start() { if (isServer) { serverName = "NULL"; score = 0; StartCoroutine(UpdatePlayer()); } if (isLocalPlayer) { PlayerData data = Handler.Instance.PlayerData; CmdSetPlayerData(data.Username, data.Score, data.LastServerID); // Create our camera object for the player. GameObject cameraObject = Instantiate(cameraPrefab, Vector3.zero, Quaternion.identity); // Force camera to follow player. SmoothFollow smoothFollow = cameraObject.GetComponent <SmoothFollow>(); smoothFollow.target = transform; // Assign movement vectors. movement = Vector2.zero; lastMovement = Vector2.zero; StartCoroutine(UpdateMovement()); } }
private void Start() { anim = GetComponent <Animator>(); player = GetComponent <Player>(); cameraControl = SmoothFollow.instance; }
private void Start() { smoothFollow = FindObjectOfType <SmoothFollow>(); smoothFollow.enabled = false; StartCoroutine(EnableCoroutine()); }
// Use this for initialization void Start() { _player = GameObject.FindGameObjectWithTag ("Player").transform; _enemies = GameObject.Find("Enemies").transform; _flyingEnemyScripts = new EnemyClass[]{}; cameraFollowScript = Camera.main.GetComponent<SmoothFollow>(); }
void Awake() { bossCtrl = FindObjectOfType <BossController>(); characterCtrl = FindObjectOfType <CharacterMovement>(); smoothFollow = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <SmoothFollow>(); anim = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <Animator>(); }
private void Awake() { _stateController = GetComponentInParent <PlayerStateController>(); playerMove = GetComponentInParent <PlayerMovement>(); player = GetComponentInParent <PlayerAttributes>(); cameraScript = FindObjectOfType <SmoothFollow>(); }
//private void Start() //{ // WeaponOff(); // Level = 1; // respawnPoint = GameObject.FindGameObjectWithTag("Respawn").GetComponent<Transform>(); //부활장소 // loading = FindObjectOfType<LoadingScript>(); //로딩창 // expBar = GameObject.Find("ExpBar").GetComponent<Image>(); // hpBar = GameObject.Find("Hp").GetComponent<Image>(); // expText = GameObject.Find("ExpText").GetComponent<Text>(); // playerName = GameObject.Find("PlayerNickName").GetComponent<Text>(); // smooth = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<SmoothFollow>(); private void Start() { Joystick = GameObject.Find("Joystick").GetComponent <UltimateJoystick>(); //WeaponOff(); // 전재현 추가 Level = 1; // 전재현 추가 respawnPoint = GameObject.FindGameObjectWithTag("Respawn").GetComponent <Transform>(); //부활장소 loading = FindObjectOfType <LoadingScript>(); //로딩창 expBar = GameObject.Find("ExpBar").GetComponent <Image>(); //경험치 바 hpBar = GameObject.Find("Hp").GetComponent <Image>(); //hp 바 expText = GameObject.Find("ExpText").GetComponent <Text>(); playerName = GameObject.Find("PlayerNickName").GetComponent <Text>(); smooth = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <SmoothFollow>(); // monster = GameObject.FindGameObjectWithTag("Enemy").GetComponent<Monster>(); CoolTime = GameObject.FindGameObjectsWithTag("skill"); for (int i = 0; i < 3; i++) { CoolTime[i].GetComponent <Image>().color = new Color(41f / 255f, 9f / 255f, 9f / 255f, 0f / 255f); } equipmentManager.WeaponSet(0); // 전재현 추가 colOnce = false; // 전재현 추가 playerName.text = PhotonNetwork.player.NickName; isPlayerMove = false; respawnBtn = GameObject.Find("RespawnBtn").GetComponent <Button>(); }
private void OnCollisionEnter2D(Collision2D collision) { //If other is enemy if (collision.gameObject.layer == 9 && !m_isInvincible) { m_currentHealth--; //update health ui m_healthMeter.fillAmount = (float)m_currentHealth / m_maxHealth; //knockback/invincibility frames if (m_currentHealth <= 0) { //Do some fancy particles and sounds gameObject.SetActive(false); SmoothFollow.Shake(0.8f); SFXManager.i.PlayerDie(); GameObject particle = ObjectPool.GetObjectFromPool("EnemyDieParticle"); particle.transform.position = transform.position; particle.SetActive(true); //DIE GameController.i.GameOver(); } else { StartCoroutine(IFrames(m_hitInvincibiltyTime)); SFXManager.i.PlayerHit(); SmoothFollow.Shake(0.4f); GameObject particle = ObjectPool.GetObjectFromPool("EnemyHitParticle"); particle.transform.position = transform.position; particle.SetActive(true); } } }
void Start() { //initiation and evaluation shield = 0; bedManager = managerObject.GetComponent <BedManager>(); collisionManager = managerObject.GetComponent <CollisionManager>(); snakeBody = new List <Vector4>(); body = new List <GameObject>(); headPosition = new Vector2(20, 20); headDirection = Constants.HEAD_DIRECTION_RIGHT; overallManagerHandle = managerObject.GetComponent <OverallTileManager>(); homeManager = managerObject.GetComponent <HomeManager>(); followerHandle = cameraObject.GetComponent <SmoothFollow>(); followerHandle.updateTargetPosition(headPosition); followerHandle.updateSize(5); head = Instantiate(overallManagerHandle.avaliableSpritePrefabs[Constants.TO_SPRITE_ID_OFFSET], headPosition, transform.rotation); //TEST: with body /* * addBody(Constants.SPRITE_WOOD); * addBody(Constants.SPRITE_WOOD); * addBody(Constants.SPRITE_WOOD); * addBody(Constants.SPRITE_STONE); * addBody(Constants.SPRITE_WOOD); * addBody(Constants.SPRITE_WOOD); * addBody(Constants.SPRITE_STONE); */ //endtest makeASweetHome(headPosition + new Vector2(-2, 3)); }
private void Start() { startRot = transform.rotation; smooth = FindObjectOfType <SmoothFollow>(); smoothStart = new Vector3(smooth.distance, smooth.height, Camera.main.fieldOfView); characterController = GetComponent <CharacterController>(); }
// Use this for initialization void Start() { cam = GetComponentInChildren<Camera>(); cam.tag = "Camera" + ruler; smoothFollow = cam.GetComponent<SmoothFollow>(); smoothFollow.height = minHeight; }
void Start() { ani = GetComponent <Animation>(); sf = Camera.main.GetComponent <SmoothFollow>(); cc = GetComponent <CharacterController>(); sf.ResetView(); }
void Awake() { MapMove = GameObject.Find("AcceptBtn").GetComponent <MoveChoice>(); num = 0; smoothFollow = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <SmoothFollow>(); monsterHp = 3000f; monsterCurHp = monsterHp; player = FindObjectOfType <PlayerManager>(); damageTxt.SetActive(false); animator = GetComponent <Animator>(); myAudio = GetComponent <AudioSource>(); nvAgent = GetComponent <NavMeshAgent>(); // 네트워크 추가w pv = GetComponent <PhotonView>(); pv.ObservedComponents[0] = this; pv.synchronization = ViewSynchronization.UnreliableOnChange; if (!PhotonNetwork.isMasterClient) //자신이 네트워크 객체가 아닐때 (마스터클라이언트가 아닐때) { } currPos = transform.position; currRot = transform.rotation; }
// Start is called before the first frame update void Start() { //joystickDir = GameObject.FindGameObjectWithTag("joyDir").GetComponent<Joystick>() as Joystick; distance = Vector2.zero; followCam = GameObject.Find("Main Camera").GetComponent <SmoothFollow>(); anim = this.gameObject.transform.GetChild(10).GetComponent <Animator>(); Time.timeScale = 1f; rbConstraints = RigidbodyConstraints.None; }
public override void Use(CarProperty car, int level) { base.Use(car, level); if(!smfCamera) smfCamera = Camera.main.GetComponent<SmoothFollow>(); selfCar = car; StartCoroutine(CPRSpeed()); }
void Start() { animator = GetComponent <Animator>(); sf = Camera.main.GetComponent <SmoothFollow>(); hasDes = false; UIGame = UnityEngine.GameObject.FindGameObjectWithTag("UIGame"); }
void Start() { inputSystem = GetComponent <InputSystem> (); car = GameObject.FindGameObjectWithTag("Car").transform; player = GameObject.FindGameObjectWithTag("Player").transform; cameraScript = GameObject.FindObjectOfType <SmoothFollow>(); inputType = GameObject.FindObjectOfType <InputSystem> ().inputType; }
private void Awake() { if (instance == null) { instance = this; } myCachedTransform = this.transform; }
private void Start() { bossController = GameObject.FindGameObjectWithTag("Boss").GetComponent <BossController>(); characterController = GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterMovement>(); playerAnimator = GameObject.FindGameObjectWithTag("Player").GetComponent <Animator>(); smoothFollow = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <SmoothFollow>(); audioManager = FindObjectOfType <AudioManager>(); }
// Use this for initialization void Start() { cam = Camera.main.GetComponent <SmoothFollow>(); angle = Camera.main.transform.rotation.eulerAngles.x; yOffset = cam.positionOffset.y; currentFOV = Camera.main.fieldOfView; visibleHeight = Mathf.Tan(Mathf.Deg2Rad * currentFOV / 2) * 2 * Mathf.Abs(cam.positionOffset.z); }
void Awake() { player = Vox.LoadModel("Assets/models/player_stand.vox", "object"); player.obj.transform.position = new Vector3(150, 11, 150); player.obj.name = "Player"; GameObject lightGameObject = new GameObject("LightAbovePlayer"); pLight = lightGameObject.AddComponent <Light>(); pLight.type = LightType.Point; pLight.color = Color.grey; pLight.range = 200; pLight.intensity = 1.0f; pLight.renderMode = LightRenderMode.ForceVertex; GameObject lightGameObject2 = new GameObject("LightBelowPlayer"); pUnder = lightGameObject2.AddComponent <Light>(); pUnder.type = LightType.Point; pUnder.color = Color.white; pUnder.range = 200; pUnder.intensity = 3.4f; pUnder.renderMode = LightRenderMode.ForceVertex; //player.obj.AddComponent<MeshCollider> (); player.obj.AddComponent <Rigidbody> (); player.obj.GetComponent <MeshCollider> ().convex = true; player.obj.GetComponent <Rigidbody> ().sleepThreshold = 1.0f; player.obj.GetComponent <Rigidbody> ().mass = 10; player.obj.GetComponent <Rigidbody> ().isKinematic = true; player.obj.GetComponent <Rigidbody> ().angularDrag = 0.09f; // Add player as target for the smoothfollow camera script. //SmoothFollow sf = Camera.main.GetComponent<SmoothFollow> (); //SmoothCamera sf = Camera.main.GetComponent<SmoothCamera>(); SmoothFollow script = Camera.main.GetComponent <SmoothFollow>(); script.target = player.obj.transform; //sf.target = player.obj.transform; //GameObject.Find("Camera").GetComponent("SmoothFollow").target = player.obj.transform; // playerJet1 = (GameObject)Instantiate(jet, player.obj.transform.position, Quaternion.identity); // playerJet1.transform.parent = player.obj.transform; // playerJet1.transform.localRotation = Quaternion.Euler (new Vector3(90, 0, 0)); // playerJet1.transform.localPosition = new Vector3 (0.5f, 1.89f, -0.7f); // playerJet1.GetComponent<ParticleSystem> ().loop = false; // playerJet1.GetComponent<ParticleSystem> ().startSize = 5; // playerJet1.GetComponent<ParticleSystem> ().Pause (); // // // playerJet2 = (GameObject)Instantiate(jet, player.obj.transform.position, Quaternion.identity); // playerJet2.transform.parent = player.obj.transform; // playerJet2.transform.localRotation = Quaternion.Euler (new Vector3(90, 0, 0)); // playerJet2.transform.localPosition = new Vector3 (2.5f, 1.89f, -0.7f); // playerJet2.GetComponent<ParticleSystem> ().loop = false; // playerJet2.GetComponent<ParticleSystem> ().startSize = 5; // playerJet2.GetComponent<ParticleSystem> ().Pause (); }
void Start() { // Set player position transform.position = new Vector2(3.0f, 3.0f); _script = (SmoothFollow)GameObject.Find("Camera") .GetComponent <SmoothFollow>(); _script.enabled = true; }
void Start() { if(speedAnimate) { animation[speedAnimate.name].wrapMode = WrapMode.Once; } smCamera = Camera.main.GetComponent<SmoothFollow>(); showSpeed *= showSpeed; }
public override void Use(CarProperty car, int level) { if(!smoothFollow) smoothFollow = Camera.main.GetComponent<SmoothFollow>(); if(!BigRushTurboAudio) BigRushTurboAudio = gameObject.AddComponent<AudioSource>(); BigRushTurboAudio.loop = true; BigRushTurboAudio.clip = BigRushTurboSound; BigRushTurboAudio.volume = BigRushTurboAudioVolume; BigRushTurboAudio.pitch = BigRushTurboPitch; BigRushTurboAudio.Play(); if(!BigRushGrowAudio) BigRushGrowAudio = gameObject.AddComponent<AudioSource>(); BigRushGrowAudio.loop = true; BigRushGrowAudio.clip = BigRushGrowSound; BigRushGrowAudio.volume = BigRushGrowoAudioVolume; BigRushGrowAudio.pitch = BigRushGrowPitch; BigRushGrowAudio.Play(); base.Use(car, level); if(colors == null || colors.Length == 0) { colors = new Color[materials.Length]; tempMaterials = new Material[materials.Length]; int index = 0; foreach(Material material in materials) { tempMaterials[index] = new Material(material); colors[index] = tempMaterials[index].color; index++; } // materials = tempMaterials; index = 0; foreach(Material material in tempMaterials) { // materials[index] = material; if(index == 0) { foreach(Renderer render in rendererTC01) { render.materials[0] = material; } } else if(index == 1) { foreach(Renderer render in rendererTC02) { render.materials[0] = material; } } index++; } } StartCoroutine(BiggerRush(car)); }
void Start() { //player = GameObject.Find("Player"); mainCam = Camera.main; camFollow = mainCam.GetComponent <SmoothFollow>(); jsInitPos = rect_JS.position; radius = rect_BG.rect.width * 0.5f; verticalSpeed = 0.2f; }
// Use this for initialization void Start() { _defaultTimeScale = 1f; _camera = transform; _defaultCameraRotation = _camera.eulerAngles; _cameraRotY = _defaultCameraRotation.y; _smoothFollow = GetComponent <SmoothFollow>(); _defaultHeight = _smoothFollow.height; _defaultDistance = _smoothFollow.distance; }
public void SetCars() { cars = FindObjectsOfType(typeof(CarB)) as CarB[]; if(!SFCamera) { SFCamera = Camera.main.GetComponent<SmoothFollow>(); } SFCamera.SetCars(); // Debug.Log("MiniMap SetCars cars.Length : " + cars.Length); }
void Awake() { _smoothFollow = GetComponent<SmoothFollow>(); TouchManager.Instance.playerController = this; EventManager.GameOverEvent += Stop; EventManager.GameStartEvent += Start; //if mat == null : get mat }
// public Texture selfTexture; // public Texture miniMapTexture; // private Vector2 scale; void Start() { cars = FindObjectsOfType(typeof(CarB)) as CarB[]; // Debug.Log("MiniMap Start cars.Length : " + cars.Length); SFCamera = Camera.main.GetComponent<SmoothFollow>(); Vector2 size = new Vector2(); size.x = Screen.width / 1024.0f; size.y = Screen.height / 768.0f; textureRect = new Rect(otherCarTexture.width * 0.5f * size.x, otherCarTexture.height * 0.5f * size.y, otherCarTexture.width * size.x, otherCarTexture.height * size.y); // scale = new Vector2(Screen.width / 1024.0f, Screen.height / 768.0f); }
void OnEnable() { if(Follower == null) Follower = GetComponent<SmoothFollow>(); Follower.MyTransform = this.transform; Follower.TargetTransform = RightT; StartCoroutine("GoLeftRight"); }
void OnEnable() { if (Follower == null) { Follower = GetComponent <SmoothFollow>(); } Follower.MyTransform = this.transform; Follower.TargetTransform = RightT; StartCoroutine("GoLeftRight"); }
void Awake() { _smoothFollow = GetComponent <SmoothFollow>(); TouchManager.Instance.playerController = this; EventManager.GameOverEvent += Stop; EventManager.GameStartEvent += Start; //if mat == null : get mat }
void Start() { m_smoothFollow = GetComponent<SmoothFollow>(); m_MinY = MinZoom + 18; m_MaxY = MaxZoom + 26; if (Application.loadedLevelName == "Overworld") { player = GameObject.Find("Player").transform; } else { player = GameObject.Find("PlayerBattle").transform; } }
//-------------------------------------------------------------------------------- public override void Use(CarProperty car, int level) { base.Use(car, level); if(!smfCamera) smfCamera = Camera.main.GetComponent<SmoothFollow>(); if(cars == null || cars.Length == 0) { cars = FindObjectsOfType(typeof(CarProperty)) as CarProperty[]; } if(!selfCar) { selfCar = car; } StartCoroutine(speedLimit(car)); }
void Start() { animator = GetComponent<Animator>(); sf = Camera.main.GetComponent<SmoothFollow>(); hasDes = false; UIGame = UnityEngine.GameObject.FindGameObjectWithTag("UIGame"); }
void Start() { smoothFollow = Camera.main.transform.GetComponent<SmoothFollow> (); smoothFollow.target = emptyTrans; }
void Start() { switchCamera = GetComponent<SwitchableCamera>(); follow = GetComponent<SmoothFollow>(); // damping = follow.rotationDamping; }
IEnumerator Start() { StartEngine(); SetBackgroundMusic(true); oldPosition = transform.position; while(!Camera.main.transform.GetComponent<SmoothFollow>().target) { yield return null; } MyCamera = Camera.main; IsPlayer = (MyCamera.transform.GetComponent<SmoothFollow>().target == this.transform); BrakeLight.gameObject.SetActiveRecursively(false); NowTurnRatio = TurnRatio; MySmoothFollow = Camera.main.GetComponent<SmoothFollow>(); MyTransform = transform; //OriginalCameraHeight = MySmoothFollow.height; }
void Start() { car = GetComponent<DriftCar>(); carB = GetComponent<CarB>(); carAI = GetComponent<CarAI>(); SMCamera = Camera.main.GetComponent<SmoothFollow>(); // if(networkView.enabled) // { // MatchArenaState mas = FindObjectOfType(typeof(MatchArenaState)) as MatchArenaState; // tvcMatchRoom = mas.GetTvCMatchRoom(); // } if(!rank) { rank = FindObjectOfType(typeof(RankManager)) as RankManager; } defaultScale = transform.localScale; if(car) oriGrip = car.handlingTendency; if(rearWheels.Length > 0) { stickWheels = new StickData[rearWheels.Length]; int i = 0; foreach(Transform wheel in rearWheels) { stickWheels[i] = new StickData(wheel); i++; } } /*SkillIcon[0] = levelTwo.GetIcon()[0]; SkillIcon = levelTwo.GetIcon()[1]; SkillIcon[2][0] = levelThree.GetIcon()[0]; SkillIcon[2][1] = levelThree.GetIcon()[1];*/ // while(true) // { // AddEnergy(energyRate); // yield return new WaitForSeconds(1); // } skillProbabilitys = new SkillProbability[4]; for(int i = 0; i < 4; i++) { skillProbabilitys[i] = new SkillProbability(); // skillProbabilitys[i].AddProbability(levelOne.Probability(i)); // skillProbabilitys[i].AddProbability(levelTwo.Probability(i)); // skillProbabilitys[i].AddProbability(levelThree.Probability(i)); foreach(Skill skill in skills) { skillProbabilitys[i].AddProbability(skill.Probability(i)); } } // skillRect = new Rect((Screen.width - (levelOne.SkillIcon.width * resolutionScale.x)) * 0.5f, levelOne.SkillIcon.height * resolutionScale.y, levelOne.SkillIcon.width * resolutionScale.x, levelOne.SkillIcon.height * resolutionScale.y); skillRect = new Rect((Screen.width - (skills[0].SkillIcon.width * resolutionScale.x)) * 0.5f, skills[0].SkillIcon.height * resolutionScale.y, skills[0].SkillIcon.width * resolutionScale.x, skills[0].SkillIcon.height * resolutionScale.y); }
void Awake() { instance = this; }
// PRIVATE STATIC //-------------------------------------- // Methods //-------------------------------------- ///<summary> /// Use this for initialization ///</summary> void Start () { //SETUP AUDIO carFlipped_audiosource = GetComponent<AudioSource>(); carFlipped_audiosource.clip = carFlipped_audioclip; // isGravityRelative = false; // _front_axleComponent = frontAxle_gameobject.GetComponent<AxleComponent>(); //STORE CAMERA REFERENCE TO UPDATE PROPERTIES AS NEEDED _smoothFollow_monobehavior = Camera.main.GetComponent<SmoothFollow>(); //START CAR IN ORIGINAL POSITION doResetCar(); }
// Use this for initialization void Start() { checkpoint = transform.position; controls = FindObjectOfType(typeof(Controls)) as Controls; smooth_follow = FindObjectOfType(typeof(SmoothFollow)) as SmoothFollow; timer = FindObjectOfType(typeof(Timer)) as Timer; powerup_tween = FindObjectOfType(typeof(PowerupTween)) as PowerupTween; level_complete_text = GameObject.Find("Complete Text"); level_complete_text.SetActive(false); }
void Start() { //Destroy existing rigidbody, we don't want anyone to mess with it. if(rigidbody) Destroy(rigidbody); //setup rigidbody gameObject.AddComponent<Rigidbody>(); rigidbody.mass = mass; rigidbody.drag = drag; rigidbody.angularDrag = 0.05f; rigidbody.centerOfMass = new Vector3(rigidbody.centerOfMass.x, cogY, rigidbody.centerOfMass.z); rigidbody.interpolation = RigidbodyInterpolation.Interpolate; // rigidbody.constraints = RigidbodyConstraints.FreezeRotationZ; //start engine noise audio.loop = true; audio.Play(); SMCamera = Camera.main.GetComponent<SmoothFollow>(); //setup wheels wheels=new WheelData[4 + otherWheels.Length]; for(int i=0;i<4 + otherWheels.Length;i++) wheels[i] = new WheelData(); wheels[0].graphic = wheelFL; wheels[1].graphic = wheelFR; wheels[2].graphic = wheelBL; wheels[3].graphic = wheelBR; for(int i=0;i < otherWheels.Length;i++) { wheels[i + 4].graphic = otherWheels[i]; } wheels[0].maxSteerAngle = 30.0f; wheels[1].maxSteerAngle = 30.0f; wheels[2].powered = true; wheels[3].powered = true; wheels[2].handbraked = true; wheels[3].handbraked = true; foreach(WheelData w in wheels) { if(w.graphic == null) Debug.Log("You need to assign all four wheels for the car script!"); if(!w.graphic.transform.IsChildOf(transform)) Debug.Log("Wheels need to be children of the Object with the car script"); w.originalRotation = w.graphic.localRotation; //create collider GameObject colliderObject = new GameObject("WheelCollider"); colliderObject.transform.parent = transform; colliderObject.transform.localPosition = w.graphic.localPosition; colliderObject.transform.localRotation = w.graphic.localRotation; w.coll = colliderObject.AddComponent<WheelCollider>(); w.coll.suspensionDistance = suspensionDistance; JointSpring js = new JointSpring(); js.spring = springs; js.damper = dampers; // w.coll.suspensionSpring.spring = springs; // w.coll.suspensionSpring.damper = dampers; w.coll.suspensionSpring = js; //no grip, as we simulate handling ourselves WheelFrictionCurve forwardwfc = new WheelFrictionCurve(); forwardwfc.stiffness = 0; WheelFrictionCurve sidewaywfc = new WheelFrictionCurve(); sidewaywfc.stiffness = 0; // w.coll.forwardFriction.stiffness = 0; // w.coll.sidewaysFriction.stiffness = 0; w.coll.forwardFriction = forwardwfc; w.coll.sidewaysFriction = sidewaywfc; w.coll.radius = wheelRadius; } //get wheel height (height forces are applied on) // wheelY = wheels[0].graphic.localPosition.y; //find skidmark object skidmarks = FindObjectOfType(typeof(Skidmarks)) as Skidmarks; //shift to first gear = 1; defaultMaxRPM = maxRPM; defaultMaxTorque = maxTorque; carAI = GetComponent<CarAI>(); }
void Start() { follower = (SmoothFollow)Camera.main.gameObject.GetComponent("SmoothFollow"); }
void Start() { smoothFollow = GameObject.Find("Main Camera").GetComponent<SmoothFollow>(); soundEffect = GameObject.Find("SoundController").GetComponent<SoundEffect>(); SpawnPlayer(); }
/// <summary> /// Set up the player materials and camera. Transition to NOTSTARTED mode /// </summary> private void Start() { _playerMaterials = _playerRender.materials; _followScript = _followCamera.GetComponent<SmoothFollow>(); _showUI = false; //set up the camera for our logo shot if (_defenderCameraMount != null) { _followScript.target = _defenderCameraMount.transform; _followScript.distance = 6f; _followScript.height = 12f; _followScript.heightDamping = 2.0f; _followScript.rotationDamping = 3.0f; } else { //simulate first person _followScript.distance = 0.1f; _followScript.height = 0f; _followScript.heightDamping = 100f; _followScript.rotationDamping = 100f; _followScript.target = _fpsCameraMount.transform; _followScript.lookAt = _fpsAim.transform; _playerRender.materials = new Material[] { }; } }