// Use this for initialization public override void Initialize() { gameObject.tag = "Boss"; followClass = GetComponent <FollowPlayer>(); distanseClass = GetComponent <DistansePlayer>(); distanseClass.keepDistanse = farlength; dashClass = GetComponent <Dash>(); dashClass.dashInterval = 0f; razerClass = GetComponent <RazerShooter>(); bulletClass = GetComponent <CircleBulletShooter>(); spawner = GetComponent <EnemySpawner>(); shootPoints = new GameObject[0]; stanDelay = stanTime; state = State.move; spawner.enemyRange = enemyBulletClass.bulletCount; enemySetCount = enemySetTime; enemyNum = 0; point = new GameObject(); point.tag = "Barrier"; isEnemyShoot = false; isEnemyShootSet = false; }
// Use this for initialization void Start() { followai = GetComponent <FollowPlayer> (); movt = GetComponent <Movement> (); inRange = false; base.init(); }
//bool firstKnockDown; void Awake() { myETD = gameObject.GetComponent <EnemyTakeDamage>(); fp = gameObject.GetComponent <FollowPlayer>(); myAnim = gameObject.GetComponent <tk2dSpriteAnimator>(); myAnim.AnimationEventTriggered = AnimationEventCallback; }
public IEnumerator RecordMacro() { currentMacro += 1; Vector3 spawnPos = Camera.main.GetComponent <Camera>().transform.position; spawnPos.x -= 2.0f; spawnPos.y += 2.5f; spawnPos.z = -2.3f; //Instantiate(teacher, spawnPos, Quaternion.identity); yield return(new WaitForSeconds(1.0f)); recording = true; yield return(new WaitForSeconds(8.0f)); recording = false; if (currentMacro < 2) { StartCoroutine(FindObjectOfType <GameManager>().ZoomOutSelection()); } else if (currentMacro == 2) { Camera.main.transform.position = new Vector3(studentInitpos.position.x + 7.2f, studentInitpos.position.y, Camera.main.transform.position.z); GameObject st = Instantiate(student, studentInitpos.position, student.transform.rotation).gameObject; currentMacro++; FollowPlayer fp = Camera.main.gameObject.AddComponent <FollowPlayer>(); fp.lookAtObject = st.transform; } }
private void Start () { if (Instance == null) Instance = this; else Destroy(this); // if (cam == null) // cam = Camera.main.GetComponent<TestCam>(); simpleRpgCam = Camera.main.GetComponent<PhatRobit.SimpleRpgCamera>(); charState = GameObject.FindObjectOfType<RomanCharState> (); //camScript = GameObject.FindObjectOfType<RomanCameraController> (); climbDetector = GameObject.FindObjectOfType<ClimbDetector> (); follow = GameObject.FindObjectOfType<FollowPlayer>(); vineClimbCollider = GameObject.FindObjectOfType<VineClimbController2>(); charController = GameObject.FindObjectOfType<RomanCharController>(); tunnelObserver = GameObject.FindObjectOfType<TunnelObserver>(); antiWallSlideController = GameObject.FindObjectOfType<SloapDetector>(); //cam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<TestCam>(); // Get the character that is selected if (charController != null) currentChar = charController.transform; }
protected override void OnUpdate() { if (m_playerData.Length <= 0) { return; } Vector3 playerPosition = m_playerData.Rigidbody[0].position; for (int i = 0; i < m_followerData.Length; i++) { m_followerData.Position[i].Value = playerPosition + m_transformData.FollowPlayer[i].OffsetPosition; } // Directly update transform position for (int i = 0; i < m_transformData.Length; i++) { FollowPlayer followPlayer = m_transformData.FollowPlayer[i]; Transform transform = m_transformData.Transform[i]; if (!followPlayer.Initialized && followPlayer.UseInitialTransformAsOffset) { followPlayer.OffsetPosition = transform.position; followPlayer.OffsetRotation = transform.rotation; followPlayer.Initialized = true; } transform.position = m_transformData.Position[i].Value; } }
// Update is called once per frame void Update() { if (Input.GetButtonDown("Reset")) { foreach (FriendController f in FindObjectsOfType <FriendController>()) { Destroy(f.gameObject); } Destroy(PC.gameObject); FollowPlayer fp = Camera.main.GetComponent <FollowPlayer>(); fp.shouldFit = true; fp.player = null; didSpawnPlayer = false; StatusText.text = "Building..."; Generator.ResetGeneration(); } if (Generator.isDone && !didSpawnPlayer) { didSpawnPlayer = true; Generator.GetComponent <LineRenderer>().enabled = false; StartCoroutine(InitPlayer()); InitItems(); PlayerUI.SetActive(true); } }
void Start() { followPlayer = camera.GetComponent <FollowPlayer>(); zoomOut = GetComponent <ZoomOut>(); shake = GetComponent <Shake>(); zoomIn = camera.GetComponent <ZoomIn>(); }
void Awake() { if (Instance != null && Instance != this) { Destroy(gameObject); } else { Instance = this; } enemySpawner = FindObjectOfType <EnemySpawner>(); // each World has one EntityManager; store a reference to it entityManager = World.DefaultGameObjectInjectionWorld.EntityManager; blobAssetStore = new BlobAssetStore(); // settings used to convert GameObject prefab var settings = GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, blobAssetStore); // convert the GameObject prefab into an Entity prefab and store it Entity playerEntityPrefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(playerPreFab, settings); playerEntity = entityManager.Instantiate(playerEntityPrefab); FollowPlayer followPlayer = playerFollower.GetComponent <FollowPlayer>(); followPlayer.playerEntity = playerEntity; PlayerManager = playerFollower.GetComponent <PlayerManager>(); gameState = GameState.Ready; }
// Start is called before the first frame update void Start() { originalSpeed = speed; slowSpeed = speed / 2; defaultRotationClamp = rotationClamp; game = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControllerScript>(); camScript = Camera.main.GetComponent <FollowPlayer>(); SlowdownEnd(); lockIntoLanes = isLaneInput; totalLanes = game.lanePositions.Length; rbody = GetComponent <Rigidbody>(); bulletsLeft = bulletMaxCapacity; ammoCounterText.text = bulletsLeft.ToString(); reloadProgressImgOnCar.enabled = false; reloadProgressImgOnButton.enabled = false; damageIndicator.enabled = false; reloadGrayOut.enabled = false; audio = GetComponent <AudioSource>(); StartCoroutine(DisplayHealthAndShield()); //SetMobileInput(); }
// Use this for initialization private void Start() { rb2d = this.gameObject.GetComponent <Rigidbody2D>(); flashLight = GetComponent <FlashLight>(); playerParty = GetComponent <PlayerParty>(); followPlayer = FindObjectOfType <FollowPlayer>(); }
// Use this for initialization void Awake() { //cache relevante GO´er _GM = GameManager.SharedInstance; _Mojo = GameObject.FindWithTag("Player"); _Spawner = GameObject.Find("SpawnLevel"); _DeathWall = GameObject.Find("DeathWall2D"); _pc = GameManager.FindObjectOfType<PlayerControl>(); _followScript = GameObject.FindObjectOfType<FollowPlayer> (); //Få fingre i ui elementer //_backgroundImage = GameObject.Find("BackgroundImage"); //_overlayButton = GameObject.Find("CutsceneOverlay"); //Tilmeld events OnPickUp.OnCollected += PickupType; CollidedWithOther.hit += PlayerDead; DeathOf2DObjects.hit += PlayerDead; PlayerControl.death += PlayerDead; lerpTest.done += IntroFinished; OnJumper.OnLaunched += LaunchMojo; OnExplode.Exploded += KilledObject; OnVortex.OnVortexEnter += VortexEnter; //load baggrund Application.LoadLevelAdditive("western"); //Init properties IsLaunching = false; IsSpeedBoosted = false; }
/// <summary> /// Initializes the Finite state machine. /// </summary> protected virtual void MakeFSM() { // Follow behaviour FollowPlayer follow = new FollowPlayer(attackRange, playerAttackLayer, this); follow.AddTransition(Transition.InPlayerAttackRange, StateID.AttackPlayer); follow.AddTransition(Transition.ReachedDestination, StateID.Idle); // Attack behaviour AttackPlayer attack = new AttackPlayer(attackRange, playerAttackLayer, attackInterval, pushAwayForce, this); attack.AddTransition(Transition.LostPlayerAttackRange, StateID.FollowPlayer); attack.AddTransition(Transition.ReachedDestination, StateID.Idle); // Idle behaviour IdleEnemy idle = new IdleEnemy(); idle.AddTransition(Transition.SawPlayer, StateID.FollowPlayer); fsm = new FSMSystem(); fsm.AddState(follow); fsm.AddState(attack); fsm.AddState(idle); }
protected override bool ShouldTrigger(FollowPlayer follow) { // Only jump if the enemy is following the player and if the player is actually above the enemy bool playerAboveEnemy = follow.playerPosition.y > (follow.enemyPosition.y + heightOfPlatformAbove); return(follow.isFollowing && playerAboveEnemy); }
public void SpawnEnemy() { GameObject enemyObj = GameObject.Instantiate(enemyPrefabs[_index++], this.transform.position, Quaternion.identity); _spawned.Add(enemyObj); _timeGivenUp.Add(0); AttackPlayer ap = enemyObj.GetComponent <AttackPlayer>(); FollowPlayer fp = enemyObj.GetComponent <FollowPlayer>(); _spawnedFollow.Add(fp); if (Game.Instance.playerShip != null) { if (fp != null) { fp.trackThisObject = Game.Instance.playerShip.gameObject; } if (ap != null) { ap.attackThis = Game.Instance.playerShip.gameObject; } } enemySpawned?.Invoke(this, enemyObj); }
private void OnEnable() { _controls = GetComponentInParent <Controls>(); _controls.enabled = false; player.GetComponent <Controls>().enabled = true; FollowPlayer.SetFollow(player.transform); }
IEnumerator InitPlayer() { StatusText.text = "Done!"; yield return(new WaitForSeconds(2.0f)); PC = Instantiate(PlayerCharacter).GetComponent <PlayerController>(); PC.GetComponent <PlayerController>().map = Generator; List <int> usedPositions = new List <int>(); foreach (FriendController FriendCharacter in Friends) { int len = Generator.IslandStart.Length; FriendController FC = Instantiate(FriendCharacter).GetComponent <FriendController>(); int randIdx = UnityEngine.Random.Range(0, len); while (usedPositions.Contains(randIdx)) { randIdx = UnityEngine.Random.Range(0, len); } usedPositions.Add(randIdx); FC.transform.position = Generator.IslandStart[randIdx]; } FollowPlayer fp = Camera.main.GetComponent <FollowPlayer>(); fp.shouldFit = false; fp.player = PC.transform; fp.UpdatePosition(new Vector3(-8.05f, 14.53f, -7.85f)); }
void Start() { m_Player = GameObject.FindObjectOfType <PlayerMove>().gameObject; m_FollowPlayer = GameObject.FindObjectOfType <FollowPlayer>().gameObject.GetComponent <FollowPlayer>(); //TODO Later on, this should add the current level of the game, so that when you go to the next level in the game, it will create a new level. Random.InitState(m_Seed + LevelManager.instance.GetLevelNumber()); SetupLevel(); //TODO find all the Gameobjects with the tag "Hole" and add them to our list m_Holes.AddRange(GameObject.FindGameObjectsWithTag("Hole")); if (GameManager.instance.GetLastHoleName() != null) { m_Player.GetComponent <PlayerMove>().ReturnLastPos(); for (int i = 0; i < m_Holes.Count; i++) { if (m_Holes[i].name == GameManager.instance.GetLastHoleName()) { GameObject currentListGameObject = m_Holes[i]; m_Player.transform.position = new Vector3(currentListGameObject.transform.position.x - 1, currentListGameObject.transform.position.y, 0f); //send the player's transform to the resetCameraPos function, to use the player transform to help reset the camera's position. m_FollowPlayer.ResetCameraPos(m_Player.transform.position); } } } }
private void SpawnPlayers() { for (int f = 1; f <= NUMBER_OF_PLAYERS; ++f) { // Get spawn position Vector2 spawnPointPos = mySpawnPoints[f - 1].position; var spawnPointPos3 = new Vector3(spawnPointPos.x, spawnPointPos.y, 1); // Instantiate the player GameObject playerInstance = Instantiate(playerPrefabs[f - 1], spawnPointPos3, Quaternion.identity); // Initialize a player and give it its index var playerHandler = playerInstance .GetComponent <PlayerHandler>(); playerHandler.InitializeHandler(f); playerHandler.OnAttack += HandlePlayerAttack; playerHandler.OnKnockbackUpdate += RequestToRerenderStatHud; playerHandler.OnGameOver += HandleGameOver; FollowPlayer.SetPlayer(f - 1, playerInstance); // Append it to the list of players allPlayers.Add(playerHandler); } }
// Use this for initialization void OnMazeDone() { GameObject go = GameObject.FindGameObjectWithTag("Player"); if (go == null) { go = (GameObject)Instantiate(playerPrefab, spawnPosition, Quaternion.identity); } if (Camera.main.GetComponent <FollowPlayer>() == null) { Camera.main.gameObject.AddComponent <FollowPlayer>(); } if (Camera.main.GetComponent <TimeSlider>() == null) { Camera.main.gameObject.AddComponent <TimeSlider>(); } FollowPlayer fp = Camera.main.GetComponent <FollowPlayer>(); fp.target = go.transform; fp.anyGuy = go.GetComponent <SneakerPlayer>(); TimeSlider ts = Camera.main.GetComponent <TimeSlider>(); ts.defaultTimeScale = defaultTime; ts.newTimeScale = ts.defaultTimeScale; }
void Start() { hostileBrainAlive = true; StartCoroutine(CalcIfMoved()); isMoving = false; anim = this.GetComponent <Animator>(); followPlayer = this.GetComponentInParent <FollowPlayer>(); }
// Use this for initialization void Start() { if (newPapa) { papaFollow = newPapa.GetComponent <FollowPlayer>(); papaFollow.SwitchState(AIState.stop); } }
private FollowPlayer followClass; //プレイヤー追従クラス(プレイヤーの方向に向かせる用) /// <summary> /// 初期化 /// </summary> public override void Initialize() { razerClass = GetComponent <RazerShooter>(); spawner = GetComponent <EnemySpawner>(); Transform child = transform.GetChild(0); followClass = child.Find("Muzzle").GetComponent <FollowPlayer>(); }
private void MoveCamera() { Main.orthographicSize = 8.4f; FollowPlayer CameraController = Main.GetComponent <FollowPlayer>(); CameraController.isFollowY = true; CameraController.m_player = target; CameraController.m_smooth = 0.04f; }
void Awake() { if (GameObject.FindGameObjectWithTag("MainCamera") != null) { mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); followPlayer = mainCamera.GetComponent <FollowPlayer> (); inputState = gameObject.GetComponent <InputState> (); } }
public void RegitsterEnemyOutsidePlayer(FollowPlayer enemy) { enemies.Remove(enemy); if (enemies.Count == 0) { FlickerOutWorld(); } }
void Start() { //Считываем сколько у игрока монет coin = PlayerPrefs.GetInt("Coin"); coinText.text = coin.ToString(); camera = cameraObject.GetComponent <FollowPlayer>(); gameObject.SetActive(true); }
public override void CloneData(StateTemplate _reference) { FollowPlayer controller = _reference as FollowPlayer; this.rotationSpeed = controller.GetRotationSpeed(); this.minDistance = controller.GetMinDistance(); this.parentSpeedOnEnter = controller.GetParentSpeedOnEnter(); this.parentSpeedOnExit = controller.GetParentSpeedOnExit(); }
void Awake() { // Setting up references. //groundCheck = transform.Find("groundCheck"); anim = GetComponent <Animator>(); healthFollowPlayer = GameObject.FindObjectOfType <FollowPlayer>(); cameraFollow = FindObjectOfType <CameraFollow>(); rigidbody = GetComponent <Rigidbody2D>(); }
void Start() { cam = Camera.main; cameraDelay = Time.deltaTime * 2; player = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); instance = this; }
void Start() { timer = GetComponent <Timer>(); currentPlayer = GetComponent <CurrentPlayer>(); followPlayer = GameObject.Find("Main Camera").GetComponent <FollowPlayer>(); selectInput = GetComponent <SelectInput>(); inventoryInput = GetComponent <InventoryInput>(); go = true; }
public void Open(float animationTime) { FollowPlayer followPlayer = FindObjectOfType <FollowPlayer>(); followPlayer.FocusOnSomethingElse(transform, 1f); ScreenShake.Shake(shakeStrength); doorSoundEmitter.Play(); StartCoroutine(OpenDoorCoroutine(animationTime)); }
void Start() { ariaMovement = aria.GetComponent<PlayerMovement>(); brioMovement = brio.GetComponent<FollowPlayer>(); cadenceMovement = cadence.GetComponent<FollowPlayer>(); combatController.enabled = false; waitTime = Random.Range(battleWaitMin,battleWaitMax); }
void Start() { _transform = GetComponent<Transform>(); bullets = new Bullet[numBullets]; for(int i=0; i<numBullets; i++) { var bullet = Instantiate(bulletPrefab, hiddenSpot, Quaternion.identity) as GameObject; bullets[i] = bullet.GetComponent<Bullet>(); } camController = Camera.main.GetComponent<FollowPlayer>(); }
void Start(){ spawnPart.Play(); followScript = follow.GetComponent<FollowPlayer>(); followScript.gameObject.SetActive(true); // Don't initially spawn two players in the same place. // This loop won't be infinite if we have more spawn points than players. // This check also presumes sequential rather than parallel execution. while (true) { var spawn = Respawns.instance.RandomSpawn(); if (!usedSpawns.Contains(spawn)) { transform.position = spawn.transform.position; usedSpawns.Add(spawn); break; } } Invoke("TurnOffInd", 3f); }
private void Awake() { EventManager.onCharEvent = null; EventManager.onInputEvent = null; EventManager.onDetectEvent = null; if (Instance == null) Instance = this; else Destroy(this); charState = GameObject.FindObjectOfType<RomanCharState> (); //camScript = GameObject.FindObjectOfType<RomanCameraController> (); climbDetector = GameObject.FindObjectOfType<ClimbDetector> (); follow = GameObject.FindObjectOfType<FollowPlayer>(); vineClimbCollider = GameObject.FindObjectOfType<VineClimbController2>(); charController = GameObject.FindObjectOfType<RomanCharController>(); }
void Start() { movement = GetComponent<Movement>(); animator = GetComponent<Animator>(); health = GetComponent<Health>(); follow = GetComponent<FollowPlayer>(); animator.SetBool(GameConstants.RunState, true); float startPosition = transform.position.x; float endPosition = startFacingRight ? startPosition + unitsToMove : startPosition - unitsToMove; // The rightmost limit gets to be the right wall rightWall = Mathf.Max(startPosition, endPosition); leftWall = Mathf.Min(startPosition, endPosition); if (!startFacingRight) movement.Flip(); // Get the sprite facing the correct way initially }
private void Awake() { if (Instance == null) Instance = this; else Destroy (this); player = GameObject.FindGameObjectWithTag("Player"); if (GameObject.FindGameObjectWithTag("Follow") != null) follow = GameObject.FindGameObjectWithTag("Follow"); playerCollider = player.GetComponent<SphereCollider>(); if (follow != null) { followCollider = follow.GetComponent<SphereCollider>(); followPlayer = follow.GetComponent<FollowPlayer>(); } }
protected override bool ShouldTrigger(FollowPlayer follow) { // Only jump if the enemy is following the player return follow.isFollowing; }
protected override bool ShouldTrigger(FollowPlayer follow) { // Only jump if the enemy is following the player and if the player is actually above the enemy bool playerAboveEnemy = follow.playerPosition.y > (follow.enemyPosition.y + heightOfPlatformAbove); return follow.isFollowing && playerAboveEnemy; }
// Use this for initialization void Start() { int maxParticles = GlobalVariables.Instance.SPAWN_COLLISON_MAX_PARTICLES; Transform parent = InGame.Instance.transform.Find("ParticlesGoesHere").transform; mPickupTextManager.Load(maxParticles, parent); mBoltParticleManager.Load(maxParticles, parent); mAS = WorldGen.Instance.BaseSpawner(); mfp = InGameCamera.Instance.GetComponent<FollowPlayer>(); mAS = WorldGen.Instance.BaseSpawner(); Reset(); }
// Use this for initialization private void Start() { state = CamState.Reset; if (follow == null) follow = GameObject.FindGameObjectWithTag("Follow").transform; followScript = follow.GetComponent<FollowPlayer>(); if (player == null) player = GameObject.FindGameObjectWithTag("Player").transform; initialAngle = follow.forward; }
// Check conditions for triggering here. Should be overridden in subclasses. protected virtual bool ShouldTrigger(FollowPlayer follow) { return true; }
protected override bool ShouldTrigger(FollowPlayer follow) { // Turn off these walls when the enemy is following the player return !follow.enabled || !follow.isFollowing; }
void Awake() { followPlayer = GameObject.Find("Main Camera").GetComponent<FollowPlayer>(); }