// move the inner level into the 'ring' of outer level // NOTE: called when the player enters the inner level public void changeRing() { if(camObject == null) camObject = GameObject.Find("Menu Camera").GetComponent<CameraScript>(); else if(!plyr.rigidbody2D.isKinematic) camObject.jiggle = true; if (outer == null) { // there should be one and only one ring now outer = GameObject.Find("Platform"); Platform plat = outer.GetComponent<Platform>(); plat.ratio = platformRatio; outerPlatform = plat; } else { levelCount++; //if(levelCount%5==0) plyr.IncreaseJumps(levelCount); levelText.setValue (levelCount); Platform plat=outer.GetComponent<Platform>(); plat.die(); outer = inner; inner = null; outerPlatform = outer.GetComponent<Platform>(); } }
// Use this for initialization void Awake() { if (instance == null) instance = this; else if (instance != null) Destroy(this); }
void Start() { leftCamera = Globals.cameraLeft; rightCamera = Globals.cameraRight; leftPlayer = Globals.playerLeft; rightPlayer = Globals.playerRight; }
// Use this for initialization void Start() { anim = GetComponent<Animator> (); cameraObj = GameObject.FindGameObjectWithTag("MainCamera"); cameraScript = cameraObj.GetComponent<CameraScript>(); anim.SetBool ("is2DMode", false); }
public static CameraShakeAction Create(CameraScript cam, float duration, Utils.VoidDelegate callback) { CameraShakeAction a = Utils.CreateScript<CameraShakeAction>(); a.cameraScript = cam; a.duration = duration; a.AddDelegate(callback); return a; }
// Use this for initialization void Start() { shipController = ShooterShip.GetComponent<ShipController>(); lockWheel = LockWheel.GetComponent<MusicManager>(); cameraScript = camera.GetComponent<CameraScript>(); angle = 0; radius = lockWheel.radius; }
void Awake() { anim = GetComponentInChildren<Animator> (); playerInCollider = false; cameraScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraScript>(); clipSize = maxClipSize; curReloadTime = 0.0f; }
// Use this for initialization void Start() { m_Camera = Camera.main; m_CameraScript = m_Camera.GetComponent<CameraScript> (); m_FogPool = new PoolGameObject (m_BaseFog, 11, this.transform); m_FogsInScene = new List<GameObject>(); m_fTimeLastSpawn = Time.time; }
private void Start() { _cameraScript = Camera.main.gameObject.GetComponent<CameraScript>(); _cameraScript.transform.position = firstCameraController.transform.position; _cameraScript.transform.rotation = firstCameraController.cameraTransformNode.transform.rotation; firstCameraController.ActivateObject(this); }
public static CameraPanTransitionAction Create(CameraScript c, Vector2 dest, float speed, Utils.VoidDelegate d) { CameraPanTransitionAction a = Utils.CreateScript<CameraPanTransitionAction>(); a.cameraScript = c; a.transitionDest = dest; a.transitionSpeed = speed; a.AddDelegate(d); return a; }
//Transform shotSpawn; // Use this for initialization void Start() { anim = GetComponent<Animator> (); //shotSpawn = transform.GetChild (0); cameraObj = GameObject.FindGameObjectWithTag("MainCamera"); cameraScript = cameraObj.GetComponent<CameraScript>(); player = GameObject.FindGameObjectWithTag ("Player"); anim.SetBool ("is2DMode", false); //anim.SetBool ("isRight", false); }
/// <summary> /// Start function to initialize variables /// Is called once before the first Update /// </summary> public virtual void Start() { //Cache variables _transform = GetComponent<Transform>(); _rigidbody = GetComponent<Rigidbody>(); //Set Line renderer variables / Definit les variables du Line renderer line = GameObject.Find("Renderer").GetComponent<LineRendererScript>(); //Get camera / Ttrouver la caméra other = (Camera)FindObjectOfType(typeof(Camera)); cam = other.GetComponent<CameraScript>(); dot = other.GetComponent<DotScript>(); GameManager.ball = 2; force = 500; SetStart(); }
// Use this for initialization void Awake() { if (!camera) { camera = GameObject.FindGameObjectWithTag("MainCamera"); } cameraScript = camera.GetComponent<CameraScript>(); if (player1) { cameraScript.target = player1; } else if (player2) { cameraScript.target = player2; } pm1 = player1.GetComponent<PlayerMovement>(); pm2 = player2.GetComponent<PlayerMovement>(); }
void Start() { // Get trigger so we can disable it after it happens trigger = GetComponent<BoxCollider2D>(); // Grab player info player = GameObject.FindGameObjectWithTag("Player"); playerScript = player.GetComponent<PlayerScript>(); // Grab camera info mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); cameraScript = mainCamera.GetComponent<CameraScript>(); // Grab boss info boss = GameObject.Find ("Enemies_Dabossman"); bossCollider = boss.GetComponent<BoxCollider2D>(); bossMoveScript = boss.GetComponent<MoveScript>(); // Get rockslide info rockSlideScript = GetComponent<RockSlideScript>(); }
void Start() { mRaycastHits = new RaycastHit[NumberOfRaycastHits]; mMap = GetComponentInChildren <Environment>(); Character.setCharacterType(1); //Setting up gameobjects paddockProfile = GameObject.Find("PaddockStats"); actionSprite = GameObject.Find("Sprite"); profile = GameObject.Find("DogStats"); deletionScreen = GameObject.Find("PaddockDeletion"); //Setting up gameobjects with the appropriate scripts paddockHandle = GameObject.Find("PaddockHandler").GetComponent <PaddockHandler>(); dog = GameObject.Find("DogHandler").GetComponent <DogHandler>(); environment = GameObject.Find("Environment").GetComponent <Environment>(); cam = GameObject.Find("MainCamera").GetComponent <CameraScript>(); currency = GameObject.Find("Currency").GetComponent <PlayerCurrency>(); park = GameObject.Find("ParkHandler").GetComponent <Park>(); vis = GameObject.Find("VisitorHandler").GetComponent <VisitorHandler>(); decorations = GameObject.Find("Decoration").GetComponent <Decorations>(); events = GameObject.Find("Event").GetComponent <Events>(); level = GameObject.Find("Levelling").GetComponent <LevelExp>(); //Set up the paddock colour - darker green than the tiles paddockColor = new Color32(60, 107, 62, 1); actionSprite.SetActive(false); //Three seperate colours for grass - used for when deleting paths grassColours.Add(new Color32(98, 214, 164, 1)); grassColours.Add(new Color32(122, 221, 159, 1)); grassColours.Add(new Color32(105, 229, 140, 1)); pauseScreen.SetActive(false); tutorialScreen.SetActive(false); deletionScreen.SetActive(false); ShowMenu(true); }
// Use this for initialization void Start() { endScoreBG.SetActive(false); endScoreTextPosition = endScoreText.rectTransform.localPosition; endCoinScorePosition = endCoinText.rectTransform.localPosition; endScoreText.rectTransform.localPosition = new Vector3(300, 300, 5); endCoinText.rectTransform.localPosition = new Vector3(300, 300, 5); isTheGameStartedFromBegining = true; animator = GetComponent <Animator> (); // getting the animator reference boundaries = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)); // getting player boundaries countTouches = 0; fadeScript = fader.GetComponent <GamePlayFadeScript> (); // fader script reference adScript = GameObject.FindGameObjectWithTag("Ads").GetComponent <AdsScript> (); cameraScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraScript> (); // camera script reference lastPosition = transform.position; // getting the players position easyDifficulty = GamePreferences.GetEasyDifficultyState(); mediumDifficulty = GamePreferences.GetMediumDifficultyState(); hardDifficulty = GamePreferences.GetHardDifficultyState(); // check if the game was started from main manu to set initial values IsTheGameStartedFromMainMenu(); // check if the game was resumed after player died to continue the game IsTheGameResumedAfterPlayerDied(); Time.timeScale = 0.0f; }
IEnumerator alpha() { float alpha = 1.0f; isAnimationProcessing = true; checkRare(); bool done = false; bool checkonce = true; while (!done) { alpha -= alphaSpeed; BackCard backCard = GetComponentInChildren <BackCard>(); SpriteRenderer sprite = backCard.GetComponent <SpriteRenderer>(); sprite.color = new Vector4(1f, 1f, 1f, alpha); if ((sprite.color.a < 0.5f) && (checkonce)) { //checkRare(); checkonce = false; } if (sprite.color.a < 0.01f) { done = true; } yield return(new WaitForSeconds(waitTime)); } CameraScript manager = GameObject.FindWithTag("Manager").GetComponent <CameraScript>(); manager.cardCounter(); isFaceUp = true; isAnimationProcessing = false; Gameback.disableObject(); if (randomCard.rare) { ripple.ripple(); } }
override public void OnInspectorGUI() { //target is the object under inspection CameraScript cameraScript = target as CameraScript; cameraScript.speed = EditorGUILayout.Slider("Speed", cameraScript.speed, 0, 1); cameraScript.xPosMultiplier = EditorGUILayout.Slider("X Pos Multiplier", cameraScript.xPosMultiplier, -50, 50); cameraScript.yPosMultiplier = EditorGUILayout.Slider("Y Pos Multiplier", cameraScript.yPosMultiplier, -50, 50); cameraScript.shakeEnabled = EditorGUILayout.Toggle("ShakeEnabled", cameraScript.shakeEnabled); if (cameraScript.shakeEnabled) { cameraScript.shakeAmount = EditorGUILayout.Slider("Shake Amount", cameraScript.shakeAmount, 0, 2); cameraScript.shakeDamping = EditorGUILayout.Slider("Shake Damping", cameraScript.shakeDamping, 0, 2); cameraScript.shakeSmoothness = EditorGUILayout.Slider("Shake Smoothness", cameraScript.shakeSmoothness, 0, 1); if (GUILayout.Button("Shake")) { cameraScript.ShakeCamera(cameraScript.shakeAmount, cameraScript.shakeDamping, cameraScript.shakeSmoothness); } } cameraScript.focusEnabled = EditorGUILayout.Toggle("Focus Enabled", cameraScript.focusEnabled); if (cameraScript.focusEnabled) { cameraScript.focusPosition = EditorGUILayout.Vector3Field("Focus Position", cameraScript.focusPosition); cameraScript.focusSpeed = EditorGUILayout.Slider("Focus Speed", cameraScript.focusSpeed, 1, 10); cameraScript.focusDuration = EditorGUILayout.Slider("Focus Duration", cameraScript.focusDuration, 0, 10); if (GUILayout.Button("Focus")) { cameraScript.FocusCameraAt(cameraScript.focusPosition, cameraScript.focusSpeed, cameraScript.focusDuration); } } cameraScript.boundariesContainer = EditorGUILayout.ObjectField("Boundary Container", cameraScript.boundariesContainer, typeof(UnityEngine.GameObject), false) as UnityEngine.GameObject; }
private void Awake() { speeds = new float[6]; cameraScript = Camera.main.GetComponent <CameraScript>(); player = GetComponent <Player>(); audioFilter = GetComponent <AudioLowPassFilter>(); cutoffTarget = audioFilter.cutoffFrequency; engineLight = GetComponentsInChildren <Light>(); anim = GetComponent <Animator>(); rB = GetComponent <Rigidbody2D>(); if (targetFinder == null) { targetFinder = GetComponent <MissileTargetFinder>(); } if (machineGun == null) { machineGun = GetComponent <Gun>(); } if (shield == null) { shield = transform.Find("Shield")?.gameObject; } if (shieldScript == null) { shieldScript = shield.GetComponent <Shield>(); } Assert.IsNotNull(anim, "Animator not found"); Assert.IsNotNull(player, "Player script not found"); Assert.IsNotNull(rB, "Rigidbody not found on player"); Assert.IsNotNull(leftEngine, "Left engine transform not found"); Assert.IsNotNull(rightEngine, "Right engine transform not found"); Assert.IsNotNull(magData, "MagnetData script not found"); Assert.IsNotNull(targetFinder, "MissileTargetFinder script not found"); Assert.IsNotNull(shield, "Could not find shield"); Assert.IsNotNull(shieldScript, "Shieldscript not found"); }
void Start() { win = GameObject.FindGameObjectWithTag("Win").GetComponent <Text>(); isDead = false; isChasing = false; player1 = GameObject.FindGameObjectWithTag("Player"); player2 = GameObject.FindGameObjectWithTag("Player2"); if (player1 != null) { player1Transform = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); } if (player2 != null) { player2Transform = GameObject.FindGameObjectWithTag("Player2").GetComponent <Transform>(); } enemyRigidbody2D = GetComponent <Rigidbody2D>(); bloodParticleSystem = GetComponent <ParticleSystem>(); hitSound = GetComponents <AudioSource>()[0]; laserSound = GetComponents <AudioSource>()[1]; gameControllerScript = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControllerScript>(); rendererComponents = GetComponentsInChildren <Renderer>(); RestoreColor(); hitPoints = startingHitPoints; healthBarUI = GameObject.FindGameObjectWithTag("Boss Slider"); healthBar = healthBarUI.GetComponent <Slider>(); healthBarUI.SetActive(false); cameraScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraScript>(); var childTransforms = GetComponentsInChildren <Transform>(); foreach (var childTransform in childTransforms) { if (childTransform.tag == "Bullet Spawn Right") { bulletSpawnRight = childTransform.transform; } } }
private void Start() { cs = Camera.main.GetComponent <CameraScript>(); multiplier = ((float)distanceFromCamera / 100); Debug.Log("Parallaxer Multiplier: " + multiplier); //set the position of the parallaxer object straight ahead of the camera gameObject.transform.position = gameObject.transform.position + Camera.main.transform.forward * distanceFromCamera; //Instantiate at the camera view cameraBounds = GameManager.Instance.cameraBounds; float currentX = cameraBounds[1].x; float currentY = gameObject.transform.position.y; Debug.Log("bounds: " + cameraBounds[1]); Debug.Log("bounds: " + cameraBounds[2]); while (currentX < cameraBounds[2].x) { SpriteRenderer r = GetRandomSpriteRendererFromList(); if (r != null) { Debug.Log("currentX: " + currentX); r = InstantiateSprite(r, new Vector3(currentX, currentY, transform.position.z), Quaternion.identity, this.transform); activeRenderers.Add(r); //Update the currentX currentX += r.bounds.size.x; Debug.Log("bounds x: " + r.bounds.size.x); } else { Debug.Log("No sprites provided.....Breaking up"); break; } } }
public void Confirm_course() { Ship_Movement shipscript = ship.GetComponent <Ship_Movement>(); if (shipscript.get_target_port() != current_location) { CameraScript camscript = cam.GetComponent <CameraScript>(); camscript.Look_at_Location(current_location); //chart_course_button.SetActive(true); //set_sail_button.SetActive(true); //enter_market_button.SetActive(true); //enter_tavern_button.SetActive(true); //confirm_course_button.SetActive(false); //reset_course_button.SetActive(false); uiScript.ChartUI(false); uiScript.TownUI(true); courseCharter.GetComponent <Charting_a_Course>().enabled = false; } else { uiScript.ErrorDisp("You're already there you fool!"); } }
public void InitializeThirdRoomEnemyFight() { // PlayerMovement movscript = GameObject.Find("Player").GetComponent<PlayerMovement>(); GameObject btl = (GameObject)Instantiate(Resources.Load("Prefabs/BattlePrefab")); btl.transform.position = new Vector3(1000, 1000, 0); CameraScript cs = GameObject.Find("Main Camera").GetComponent <CameraScript>(); cs.sub = CameraSubject.battle; cs.Battle = btl; movscript.battle = btl; BattleMasterScript bm; bm = GameObject.Find("BattleMaster").GetComponent <BattleMasterScript>(); bm.InitializeBattle(EnemyFactory.EnemyType.vroomer); bm.SetBattleEndCallback(EndThirdRoomEnemyEvent); //Destroy(ThirdRoomEnemy); thirdEnemyActive = false; ThirdRoomEnemy.SetActive(thirdEnemyActive); movscript.LockMovement(); bm.songloc = "Sounds/Music/Fight_Mood"; mps.PlaySong("Sounds/Music/Fight_Mood", 2, true); }
public override void Start() { IsTemporary = true; Prepare(); Initialize(); CanBePaused = true; UpdateHelpInfo(); base.Start(); // If not skipped if (Phases.CurrentSubPhase == this) { CameraScript.RestoreCamera(); IsReadyForCommands = true; IsLocked = false; Roster.GetPlayer(RequiredPlayer).SelectShipForAbility(); } }
// Use this for initialization protected void Awake() { mainCamera = GameObject.FindGameObjectsWithTag("MainCamera")[0].GetComponent<CameraScript>(); background = GameObject.FindGameObjectsWithTag("background")[0]; playerColl = this.gameObject.GetComponent<Collider2D>(); spriteManager = this.gameObject.GetComponent<PlayerSpriteManager>(); movementManager = this.gameObject.GetComponent<PlayerMovementManager>(); audioManager = AudioManager.GetInstance(); interruptMeditationFrames = 0; /* Detect which playform the user is playing on string[] desktopPlatforms = {"OSXEditor", "OSXPlayer", "WindowsPlayer", "OSXWebPlayer", "OSXDashboardPlayer", "WindowsWebPlayer", "WindowsEditor"}; if (System.Array.IndexOf(desktopPlatforms, Application.platform) == -1) { onMobile = false; } else{ onMobile = true; }*/ }
// Use this for initialization void Awake() { camera = Camera.main.GetComponent <CameraScript>(); redHealth = startingHealth; blueHealth = startingHealth; redPlayer.setup(false, this, PlayerPrefs.GetString("RED_AI")); bluePlayer.setup(true, this, PlayerPrefs.GetString("BLUE_AI")); redHealthIndicator.setup(startingHealth); blueHealthIndicator.setup(startingHealth); GUIEditor.setText(PlayerPrefs.GetString("BLUE_AI"), PlayerPrefs.GetString("RED_AI")); for (int i = 0; i < belts.Length; i++) { belts[i].setup(this); belts[i].redButton.setup(buttonCooldown); belts[i].blueButton.setup(buttonCooldown); belts[i].bomb.setup(initialBombSpeed, bombAcceleration); } }
// Start is called before the first frame update void Start() { anim = GetComponent <Animator>(); currentState = BossState.Intro; currIntroTime = introDuration; currIdleTime = idleDuration; currPatrolIntroTime = patrolIntroDuration; currPatrolTime = patrolDuration; currentDestination = patrolSpots[0]; currJumpIntroTime = jumpIntroDuration; jumpsLeft = totalJumps; originalHeight = transform.position.y; myPos = transform.position; playerPos = player.transform.position; isJumping = false; rb2d = GetComponent <Rigidbody2D>(); sr2d = GetComponent <SpriteRenderer>(); cam = GameObject.FindGameObjectWithTag("Camera").GetComponent <CameraScript>(); health = totalHealth; elapsedInvulnerablTime = 0.0f; }
private void PerformAction(object sender, System.EventArgs e) { selectedShip = Selection.ThisShip; selectedShip.OnCombatCheckExtraAttack += StartBonusAttack; Roster.HighlightPlayer(HostShip.Owner.PlayerNo); Selection.ChangeActiveShip(HostShip); performedRegularAttack = HostShip.IsAttackPerformed; List <GenericAction> actions = Selection.ThisShip.GetAvailableActions(); CameraScript.RestoreCamera(); HostShip.AskPerformFreeAction( actions, delegate { Roster.HighlightPlayer(selectedShip.Owner.PlayerNo); Selection.ChangeActiveShip(selectedShip); Triggers.FinishTrigger(); }, HostShip.PilotInfo.PilotName, "After a friendly ship at range 0-3 is destroyed, you may perform an action", HostShip ); }
/// <summary> /// Updater for the particles in the field, wraps them around if necessary /// </summary> /// <param name="particles">array of particles in the field</param> private void ParticleUpdate(ParticleSystem.Particle[] particles) { var oldZ = Camera.main.transform.position.z; Camera.main.transform.position = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, -CameraScript.GetMaxZoomLevel()); for (int i = 0; i < particles.Length; i++) // update all particles { if (!timesByParticle.ContainsKey(i)) { timesByParticle.Add(i, 0); } else { timesByParticle[i] -= Time.deltaTime; } ParticleWrapper(ref particles[i], 0, i); // call particle wrapper for both dimensions ParticleWrapper(ref particles[i], 1, i); } Camera.main.transform.position = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, oldZ); }
void Start() { playerLife = PLAYER_LIFE_MAX; bullets = BULLETS_MAX; cableScript = cable.GetComponent <Cable>(); gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>(); pointer.enabled = false; cameraScript = cameraObject.transform.parent.GetComponent <CameraScript>(); speed = TPS_SPEED; animator = GetComponent <Animator>(); rigidbody = GetComponent <Rigidbody>(); lifeRect = Life.GetComponent <RectTransform>(); lifeRect.sizeDelta = new Vector2(1465 * playerLife, 1249); bulletRect = Bullet.GetComponent <RectTransform>(); bulletRect.sizeDelta = new Vector2(250 * bullets, 1095); lostLifeRect = LostLife.GetComponent <RectTransform>(); lostLifeRect.sizeDelta = new Vector2(1465 * (PLAYER_LIFE_MAX - playerLife), 1249); emptyBulletRect = EmptyBullet.GetComponent <RectTransform>(); emptyBulletRect.sizeDelta = new Vector2(250 * (BULLETS_MAX - bullets), 1095); xBox = gameController.GetComponent <XBox>(); }
void Start() { GameObject camera_Obj = GameObject.FindGameObjectWithTag("MainCamera"); if (camera_Obj != null) { cameraScript = (CameraScript)camera_Obj.GetComponentInParent <CameraScript> (); } else { Debug.Log("CAMERA OBJECT NOT FOUND !"); } GameObject manager_Obj = GameObject.FindGameObjectWithTag("GameManager"); if (manager_Obj != null) { gameManager = (GameManager)manager_Obj.GetComponent <GameManager> (); } else { Debug.Log("MANAGER OBJECT NOT FOUND !"); } }
// move the inner level into the 'ring' of outer level // NOTE: called when the player enters the inner level public void changeRing() { if (camObject == null) { camObject = GameObject.Find("Menu Camera").GetComponent <CameraScript>(); } else if (!plyr.rigidbody2D.isKinematic) { camObject.jiggle = true; } if (outer == null) { // there should be one and only one ring now outer = GameObject.Find("Platform"); Platform plat = outer.GetComponent <Platform>(); plat.ratio = platformRatio; outerPlatform = plat; } else { levelCount++; //if(levelCount%5==0) plyr.IncreaseJumps(levelCount); levelText.setValue(levelCount); Platform plat = outer.GetComponent <Platform>(); plat.die(); outer = inner; inner = null; outerPlatform = outer.GetComponent <Platform>(); } }
// Extra Attacks public static void StartSelectAttackTarget ( GenericShip ship, Action callback, Func <GenericShip, IShipWeapon, bool, bool> extraAttackFilter = null, string abilityName = null, string description = null, IImageHolder imageSource = null, bool showSkipButton = true, Action <Action> payAttackCost = null ) { Selection.ChangeActiveShip("ShipId:" + ship.ShipId); Phases.CurrentSubPhase.RequiredPlayer = ship.Owner.PlayerNo; ExtraAttackFilter = extraAttackFilter; PayExtraAttackCost = payAttackCost; SelectTargetForAttackSubPhase newAttackSubphase = (SelectTargetForAttackSubPhase)Phases.StartTemporarySubPhaseNew( "Second attack", typeof(SelectTargetForAttackSubPhase), delegate { ship.CallAfterAttackWindow(); Phases.FinishSubPhase(typeof(SelectTargetForAttackSubPhase)); CameraScript.RestoreCamera(); callback(); } ); newAttackSubphase.DescriptionShort = abilityName; newAttackSubphase.DescriptionLong = description; newAttackSubphase.ImageSource = imageSource; newAttackSubphase.ShowSkipButton = showSkipButton; newAttackSubphase.Start(); }
public void ReadObjectState(BinaryReader binaryReader) { CameraScript manager = GameObject.Find("_Manager").GetComponent <CameraScript>(); //Get the subObjects count int simpleSubCount = binaryReader.ReadInt32(); for (int subCount = 0; subCount < simpleSubCount; subCount++) { GameObject simpleSub = new GameObject(); SimpleSubObject simpleSubScript = simpleSub.AddComponent <SimpleSubObject>(); simpleSubScript.ReadObjectState(binaryReader); simpleSub.transform.parent = this.transform; } this.aStringObject = binaryReader.ReadString(); this.aFloatValue = binaryReader.ReadSingle(); int bankAmount = binaryReader.ReadInt32(); List <int> received = new List <int>(); string cards = binaryReader.ReadString(); foreach (string card in cards.Split(',')) { int num; if (int.TryParse(card, out num)) { received.Add(num); } } SaveCards(received); this.bankAmount = bankAmount; manager.SetBankText(bankAmount); this.gameObject.name = binaryReader.ReadString(); }
void Start() { planetInfoScreen = GameObject.Find("PlanetInfoUI").GetComponent <UIDocument>().rootVisualElement; swipeTutorial = GameObject.Find("SwipesTutorial").GetComponent <TutorialSwipes>(); tappingTutorial = GameObject.Find("TappingTutorial").GetComponent <TapOnObjectTutorial>(); zoomTutorial = GameObject.Find("ZoomTutorial").GetComponent <TutorialZoom>(); rotationTutorial = GameObject.Find("RotationTutorial").GetComponent <RotationTutorial>(); doubleTapTutorial = GameObject.Find("DoubleTapTutorial").GetComponent <TutorialDoubleTap>(); saveManager = GameObject.FindGameObjectWithTag("LoadSceneTag").GetComponent <SaveManager>(); tutorialCompleteText = GameObject.Find("TutorialCompleteText"); tappingTarget = GameObject.Find("Settings"); sovleButton = GameObject.Find("SolveButton"); sovleButton.SetActive(false); mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraScript>(); var color = Color.white; color.a = 0; tutorialCompleteText.GetComponent <TextMeshProUGUI>().color = color; tutorialCompleteText.SetActive(false); eventOnClick = ev => { StartNextStep(); }; }
public void GetLow() { if (facingRight) { transform.localScale -= new Vector3(0.01f, 0.01f, 0f); } if (!facingRight) { transform.localScale -= new Vector3((0.01f * -1), 0.01f, 0f); } maxSpeed -= 1f; jumpForce -= 10f; Goo -= 1; CameraScript camScript = PlayerCam.gameObject.GetComponent <CameraScript>(); camScript.startTime = ScaleTime + Time.time; camScript.startValue -= 0.4f; camScript.endValue -= 0.4f; camScript.ZoomIn(); }
// Use this for initialization void Awake() { SetPlayerColours(); scoreBar = FindObjectOfType <ScoreBar>(); camera_script = FindObjectOfType <CameraScript>(); GameObject settings_object = GameObject.Find("GameSettings"); GameSettings settings = null; if (settings_object) { settings = settings_object.GetComponent <GameSettings>(); } if (settings) { SetGame(settings.m_minutes, settings.m_seconds, settings.m_players); } else { SetGame(); } event_manager = GetComponent <EventsManager>(); DontDestroyOnLoad(this.gameObject); has_ended = false; //Uses C#'s version of Getters and Setters - REQUIRED }
void Start() { cam = GameObject.FindWithTag("MainCamera").GetComponent <CameraScript>(); myBoxCollider = GetComponent <BoxCollider2D>(); if (newPlayerPos.x != 0) { myBoxCollider.size = new Vector2(0.5f, myBoxCollider.size.y); } if (newPlayerPos.y != 0) { myBoxCollider.size = new Vector2(myBoxCollider.size.x, 0.5f); } if (newPlayerPos.x < 0) { myBoxCollider.offset = new Vector2(-0.5f * myBoxCollider.size.x, 0); } if (newPlayerPos.x > 0) { myBoxCollider.offset = new Vector2(0.5f * myBoxCollider.size.x, 0); } if (newPlayerPos.y > 0) { myBoxCollider.offset = new Vector2(0, 0.5f * myBoxCollider.size.y); } if (newPlayerPos.y < 0) { myBoxCollider.offset = new Vector2(0, -0.5f * myBoxCollider.size.y); } }
public void SetCamera(CameraScript cs) { cScript = cs; }
// Init private void Start() { stateManager = StateManager.Instance; cameraScript = Camera.main.GetComponent <CameraScript>(); setAnims(); }
// Use this for initialization void Start() { statScript = gameObject.GetComponent<StatsScript>(); bSSPscript = GameObject.Find ("BattleSkillsCanvas").GetComponent<BattleSkillSelectPanelScript>(); bSSPscript.Fade (); knightBattleSkillScript = GameObject.Find ("KnightBattleSkillsCanvas").GetComponent<BattleSkillSelectPanelScript>(); knightBattleSkillScript.Fade (); mBMscript = GameObject.Find ("MainBattleMenuCanvas").GetComponent<MainBattleMenuScript>(); mBMscript.Fade (); mSSMscript = GameObject.Find ("MagicSkillMenuCanvas").GetComponent<MagicSkillSelectMenuScript>(); mSSMscript.Fade (); techScript = GameObject.Find ("SwordTechniqueMenuCanvas").GetComponent<MagicSkillSelectMenuScript>(); techScript.Fade (); cScript = mainCamera.GetComponent<CameraScript>(); musicPlayed = false; hero = new List<PlayerScript>(); enemy = new List<EnemyScript>(); if (Application.loadedLevelName == "GrasslandsBattle") { PlayerScript playerSc1 = (PlayerScript) GameObject.Find("Zebulon (Clone)").GetComponent<PlayerScript>(); EnemyScript enemySc1 = (EnemyScript) GameObject.Find("Green Spider").GetComponent<EnemyScript>(); PlayerScript playerSc2 = (PlayerScript) GameObject.Find("Zebulon").GetComponent<PlayerScript>(); EnemyScript enemySc2 = (EnemyScript) GameObject.Find("Dark Troll").GetComponent<EnemyScript>(); //PlayerScript playerSc3 = (PlayerScript) GameObject.Find("Dalton").GetComponent<PlayerScript>(); hero.Add(playerSc1); hero.Add (playerSc2); //hero.Add (playerSc3); enemy.Add(enemySc1); enemy.Add (enemySc2); } else if (Application.loadedLevelName == "snowScene") { PlayerScript playerSc1 = (PlayerScript) GameObject.Find("Zebulon (Clone)").GetComponent<PlayerScript>(); PlayerScript playerSc2 = (PlayerScript) GameObject.Find("Zebulon").GetComponent<PlayerScript>(); EnemyScript enemySc1 = (EnemyScript) GameObject.Find("skeletonMage").GetComponent<EnemyScript>(); EnemyScript enemySc2 = (EnemyScript) GameObject.Find("skeletonSpearman").GetComponent<EnemyScript>(); hero.Add(playerSc1); hero.Add (playerSc2); enemy.Add (enemySc1); enemy.Add (enemySc2); } state = "PlayerSelect"; //Change the length of options later to accommodate more menu options options = new string[1]; options[0] = "Attack"; //Add more menu options here later as string elements of the options array pointerIndex = 0; //current menu option to point at attackOrder = new Queue<GameObject>(); selectCircle = GameObject.Find ("SelectionCircle").GetComponent<CircleActivationScript>(); selectCircle.Fade (); }
// Use this for initialization void Awake() { instance = this; MainCamScript = Camera.main.GetComponent<CameraScript>(); MainCamera = Camera.main.GetComponent<Camera>(); if(MainCamScript == null || MainCamera == null){ Debug.LogWarning("No Camera found"); Debug.Break(); } }
void Start() { controller = GetComponent <UIController>(); world = FindObjectOfType <World>(); camera = FindObjectOfType <CameraScript>(); }
// Use this for initialization void Awake() { plyrMan = this.GetComponent<PlayerManager> (); camScript = mainCam.GetComponent<CameraScript> (); XMLtoQuestions(); }
void Awake() { cameraScript = Camera.main.GetComponent <CameraScript> (); }
// Use this for initialization void Start() { singleton = this; standardPos = transform.position; }
// Use this for initialization void Start() { motor = GetComponent<CharacterMotor>(); cameraScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraScript>(); //Add Sword this.gameObject.AddComponent<Sword>(); swordClass = GetComponent<Sword>(); //Add Bomb this.gameObject.AddComponent<Bomb>(); bombClass = GetComponent<Bomb>(); //Add Acid this.gameObject.AddComponent<Acid>(); acidClass = GetComponent<Acid>(); }
void Start() { controller = GetComponent<CharacterController>(); playerCameraScript = GameObject.FindWithTag("MainCamera").GetComponent<CameraScript>(); facingVec = Vector3.left; pstat = GetComponent<PlayerStats>(); }
// Use this for initialization void Start() { SetFont (); UpdateScore (); cameraScript = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<CameraScript> (); }
void Start() { if (gameObject.name == "Player1") { transform.position = new Vector3(UFE.config.roundOptions.p1XPosition, .009f, 0); opponent = GameObject.Find("Player2"); if (UFE.config.player1Character == null) Debug.LogError("Player 1 character not found! Make sure you have set the characters correctly in the Global Editor"); myInfo = (CharacterInfo) Instantiate(UFE.config.player1Character); UFE.config.player1Character = myInfo; debugger = UFE.debugger1; mirror = -1; playerNum = 1; inputController = UFE.GetPlayer1Controller(); debugInfo = UFE.config.debugOptions.p1DebugInfo; }else{ transform.position = new Vector3(UFE.config.roundOptions.p2XPosition, .009f, 0); opponent = GameObject.Find("Player1"); if (UFE.config.player2Character == null) Debug.LogError("Player 2 character not found! Make sure you have set the characters correctly in the Global Editor"); myInfo = (CharacterInfo) Instantiate(UFE.config.player2Character); UFE.config.player2Character = myInfo; debugger = UFE.debugger2; mirror = 1; playerNum = 2; inputController = UFE.GetPlayer2Controller(); debugInfo = UFE.config.debugOptions.p2DebugInfo; } myInfo.currentLifePoints = (float)myInfo.lifePoints; if (myInfo.characterPrefab == null) Debug.LogError("Character prefab for "+ gameObject.name +" not found. Make sure you have selected a prefab character in the Character Editor"); character = (GameObject) Instantiate(myInfo.characterPrefab); character.transform.parent = transform; character.AddComponent<MoveSetScript>(); standardYRotation = character.transform.rotation.eulerAngles.y; myPhysicsScript = GetComponent<PhysicsScript>(); myMoveSetScript = character.GetComponent<MoveSetScript>(); myHitBoxesScript = character.GetComponent<HitBoxesScript>(); cameraScript = transform.parent.GetComponent<CameraScript>(); myHitBoxesScript.controlsScript = this; if (myInfo.headLook.enabled){ character.AddComponent<HeadLookScript>(); headLookScript = character.GetComponent<HeadLookScript>(); headLookScript.segments = myInfo.headLook.segments; headLookScript.nonAffectedJoints = myInfo.headLook.nonAffectedJoints; headLookScript.effect = myInfo.headLook.effect; headLookScript.overrideAnimation = !myInfo.headLook.overrideAnimation; foreach(BendingSegment segment in headLookScript.segments) { segment.firstTransform = myHitBoxesScript.GetTransform(segment.bodyPart).parent.transform; segment.lastTransform = myHitBoxesScript.GetTransform(segment.bodyPart); } foreach(NonAffectedJoints nonAffectedJoint in headLookScript.nonAffectedJoints) nonAffectedJoint.joint = myHitBoxesScript.GetTransform(nonAffectedJoint.bodyPart); } if (gameObject.name == "Player2") { testCharacterRotation(100, true); UFE.FireGameBegins(); } if (UFE.config.roundOptions.allowMovement) { UFE.config.lockMovements = false; }else{ UFE.config.lockMovements = true; } }
// Use this for initialization void Start() { waitTime = 1.0f / fps; rotateDegreePerSecond = 1000f; originalRotationValue = transform.rotation; cw = true; alphaSpeed = 0.03f; isReady = false; manager = GameObject.Find("_Manager").GetComponent<CameraScript>(); rareCard = GetComponentInChildren<RareCard>(); randomCard = GetComponentInChildren<RandomCard>(); rareCard.disableRare(); ripple = GetComponentInChildren<rippleSharp>(); ripple.disableObject(); Gameback = GetComponentInChildren<BackCard>(); cheat = false; }
void Start() { camera = GameObject.Find("Main Camera").GetComponent<CameraScript>(); kingFace = GameObject.Find("King").GetComponent<Transform>(); }
// Use this for initialization void Start() { gameObject.tag = "Boosterpack"; pieces = new List<GameObject>(); //canvas = GameObject.Find("Canvas").GetComponent<CanvasManager>(); manager = GameObject.Find("_Manager").GetComponent<CameraScript>(); packButtons = GameObject.FindGameObjectsWithTag("Packselection"); packs = GameObject.Find("Packs").GetComponent<Packs>(); }
// Use this for initialization void Start() { anim = GetComponentInChildren<Animator> (); playerInCollider = false; cameraScript = cameraObject.GetComponent<CameraScript>(); }
// Start is called before the first frame update void Start() { cam = Camera.main.GetComponent <CameraScript>(); }
private void OnEnable() { SetEditorState(EditorState.Enabled); this.mainCamera = Camera.main; this.cameraScript = this.mainCamera.transform.parent.gameObject.GetComponent <CameraScript>(); }
// Use this for initialization void Start() { Resources.UnloadUnusedAssets(); StartCoroutine(viewStart()); //使用中のキャラ取得 SqliteDatabase sqlDB = new SqliteDatabase("UserStatus.db"); string selectQuery = "select * from Character where select_flg = 1"; DataTable characterTable = sqlDB.ExecuteQuery(selectQuery); if (characterTable.Rows.Count >= 1) { charaNumber = (int) characterTable.Rows[0]["id"]; GameObject selectCharaPrefab = Resources.Load <GameObject> ("Prefab/Chara/Character" + charaNumber); chara = GameObject.Instantiate(selectCharaPrefab) as GameObject; chara.transform.localPosition = new Vector3(-2.24f, 11.56f, -1.0f); chara.name = "Character"; //スキル設定 skillNumber = (int) characterTable.Rows[0]["skill_number"]; skillName = (string) characterTable.Rows[0]["skill_name"]; skillType = (int) characterTable.Rows[0]["skill_type"]; skillLevel = (int) characterTable.Rows[0]["get_count"]; addSkillCount(); //キャラを落ちないように設定 chara.GetComponent<Rigidbody2D>().isKinematic = true; sr = chara.GetComponent<SpriteRenderer>(); charaDefaultPositionX = chara.transform.localPosition.x; StartCoroutine(gameStart()); } boosterEffect = (GameObject)Resources.Load("Effect/Booster"); //CameraScriptを取得 cameraScript = (CameraScript) cameraObject.GetComponent<CameraScript>(); }
void Start() { ds = GameObject.FindObjectOfType <DragonSoundPlayer> (); Scene currentScene = SceneManager.GetActiveScene(); if (currentScene.name != "end_game") { cs = GameObject.FindObjectOfType <CameraScript> (); ms = GameObject.FindObjectOfType <MovementScript> (); player = GameObject.FindGameObjectWithTag("Player"); /* Resolutions Dropdown Initialization */ resolutionsDropdown = GameObject.FindGameObjectWithTag("ResolutionsDropdown").GetComponent <TMP_Dropdown>(); resolutionsDropdown.ClearOptions(); resolutions = Screen.resolutions; List <string> options = new List <string> (); int currentResolutionValue = 0; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions [i].width + " x " + resolutions [i].height; options.Add(option); if (resolutions [i].width == Screen.currentResolution.width && resolutions [i].height == Screen.currentResolution.height) { currentResolutionValue = i; } } resolutionsDropdown.AddOptions(options); resolutionsDropdown.value = currentResolutionValue; resolutionsDropdown.RefreshShownValue(); /* Quality Dropdown Initialization */ qualityDropdown = GameObject.FindGameObjectWithTag("QualityDropdown").GetComponent <TMP_Dropdown>(); qualityDropdown.value = QualitySettings.GetQualityLevel(); qualityDropdown.RefreshShownValue(); fullscreenToggle = GameObject.FindGameObjectWithTag("FullscreenToggle").GetComponent <Toggle>(); fullscreenToggle.isOn = Screen.fullScreen; float volume = 0; FMODUnity.RuntimeManager.GetBus("bus:/").getVolume(out volume, out volume); volumeSlider = GameObject.FindGameObjectWithTag("VolumeSlider").GetComponent <Slider>(); volumeSlider.value = volume; /* Hides Pause and Setting Menus */ pauseMenu = GameObject.FindGameObjectWithTag("Pause"); settingsMenu = GameObject.FindGameObjectWithTag("Settings"); if (currentScene.name != "main_menu_scene") { pauseMenu.SetActive(false); } settingsMenu.SetActive(false); if (currentScene.name == "main_menu_scene" && !File.Exists(Application.persistentDataPath + "/playerInfo.dat")) { GameObject.FindGameObjectWithTag("ResumeButton").GetComponent <Button>().interactable = false; } } }
// Use this for initialization // public GameItem gameItem; void Start() { //gameItem = (GameItem)GetComponent(typeof(GameItem)); lockedOn = false; cameraScript = camera.GetComponent<CameraScript>(); shooterScript = this.GetComponent<Shooter>(); map = this.GetComponentInChildren<Map>(); invX = 1; invY = 1; if(invertX) { invX = -1; } if(invertY) { invY = -1; } }
void Awake() { Instance = this; }