private void Start() { swordTimestamp = -_swordPowerDuration; arena.localScale = new Vector3(arenaSize * 2, arenaSize * 2, 1); int count = controllers.Count; for (int i = count - 1; i >= 0; i--) { Quaternion quaternion = Quaternion.AngleAxis(i * 360 / count, Vector3.forward); Player player = PoolManager.Instance.Instantiate(playerConfig).GetComponent <Player>(); targetGroup.AddMember(player.transform, playerWeight, playerRadius); player.transform.position = quaternion * new Vector2(arenaSize * playerStartPosition, 0); player.controller = controllers[i]; controllers[i].Init(); players.Add(player); } DropSword(Vector2.zero); }
private void Start() { _gameOver = false; _players = new List <GameObject>(); Debug.Log(CharactersList.PlayerCount); for (int i = 0; i < CharactersList.PlayerCount; i++) { PlayerInfo info = CharactersList.GetInfo(i); GameObject aux = GameObject.Instantiate(info.Prefab); aux.GetComponent <PlayerInputManeger>().ChangePlayer(info.PlayerId); aux.transform.position = _spawns[i].position; _targetGroup.AddMember(aux.transform, 1, 2.5f); _players.Add(aux); } foreach (Transform spawn in _spawns) { _targetGroup.RemoveMember(spawn); } _winner = null; }
void onPlayerJoined(PlayerInput playerInput) { // Creating an empty GameObject that will follow the player (for camera framing purposes) GameObject followGO = new GameObject("FollowTargetGroupElement"); followGO.AddComponent <FollowTargetGroupElements>(); followGO.GetComponent <FollowTargetGroupElements>().objectToFollow = playerInput.gameObject; followGO.GetComponent <FollowTargetGroupElements>().boundSize = new Vector2(40, 20); followGO.GetComponent <FollowTargetGroupElements>().weight = targetGroupWeight; // Add it to the camera's target group targetGroup.AddMember(followGO.transform, 1, targetGroupWeight); // Change the players overhead arrow color playerInput.GetComponentInChildren <SpriteShapeRenderer>().color = playerColors[playerInput.playerIndex]; // Add the Players Percentage UI if it doesn't exist if (playerInput.playerIndex + 1 > ingameCanvas.transform.GetChild(0).childCount) { Instantiate(percentage, ingameCanvas.transform.GetChild(0)).GetComponent <Image>().color = playerColors[playerInput.playerIndex]; } // Default percentage to zero UpdatePercentage(playerInput.playerIndex, 0); }
public void OnPlayerJoined(PlayerInput playerInput) { if (instance != this) { return; } if (Testing) { Debug.Log("Add"); playerInput.transform.root.GetComponent <PlayerIdentity>().PlayerInputEnable(); // playerInput.SwitchCurrentActionMap("GamePlay"); // Destroy(playerInput.transform.root.GetComponentInChildren<PlayerCreating>()); players.Add((playerInput.transform.root.gameObject)); if (targetGroup != null) { targetGroup.AddMember(playerInput.transform, 1, 0); } if (OnPlayerJoin != null) { OnPlayerJoin(playerInput.gameObject, players.Count - 1); } LoadTestScene(); // playerInput.transform.root.GetComponent<PlayerIdentity>().SetRagData(); } else { if (CreatingTest) { return; } Debug.Log("Add"); DontDestroyOnLoad(playerInput.transform.root.gameObject); players.Add((playerInput.transform.root.gameObject)); GameObject g = Instantiate(PlayerCraftUI); StageInfoTransform stageInfo = GameObject.FindGameObjectWithTag("StageInfoTransform").GetComponent <StageInfoTransform>(); Vector3 v = stageInfo.transforms[players.Count - 1].position; v += new Vector3(2.25f, 2.5f, 0); g.GetComponent <Transform>().position = v; players[players.Count - 1].GetComponentInChildren <PlayerCreating>().profileChooseUI = g.GetComponent <ProfileChooseUI>(); playerInput.SwitchCurrentActionMap("Creating(UI)"); OnBattleScene += players[players.Count - 1].GetComponent <PlayerIdentity>().OnTest; players[players.Count - 1].GetComponent <PlayerIdentity>().SetToTransform(); if (targetGroup != null) { targetGroup.AddMember(playerInput.transform, 1, 0); } PlayerCraftUIList.Add(g); if (OnPlayerJoin != null) { OnPlayerJoin(playerInput.gameObject, players.Count - 1); } // LoadTestScene(); } }
void Start() { iKThrowController = GetComponent <IKThrowController>(); animator = GetComponent <Animator>(); Transform neckTransform = animator.GetBoneTransform(HumanBodyBones.Neck); aimingCameraTargetGroup.AddMember(neckTransform, 1, 3); }
private void SetTargetGroup() { m_Player = GameObject.FindGameObjectWithTag("Player"); m_Portal = GameObject.FindGameObjectWithTag("Portal"); m_TargetGroup.AddMember(m_Player.transform, m_PlayerWeight, m_PlayerRadius); m_TargetGroup.AddMember(m_Portal.transform, m_PortalWeight, m_PortalRadius); m_VirtualCamera.GetCinemachineComponent <CinemachineGroupComposer>().m_MinimumOrthoSize = m_MinCamera; m_VirtualCamera.GetCinemachineComponent <CinemachineGroupComposer>().m_MaximumOrthoSize = m_MaxCamera; }
/// <summary> /// Spawns a bus at a random station /// </summary> public void SpawBus(PlayerId playerId, int station, int points) { Bus bus = Instantiate(GetBusPrefab(playerId), homeStations[station].busSpawnPoint.position, homeStations[station].OutRotation.rotation).GetComponent <Bus>(); inGameVehicles.Add(bus.gameObject); bus.SetPoints(points); // Add to follow goup cinemachineTargetGroup.AddMember(bus.transform, 1, 0); }
public void PopulateMainSkyCamTargetGroup() { for (int i = 0; i < redTeamParent.childCount; i++) { skyCamTg.AddMember(redTeamParent.GetChild(i), 0, 0); } for (int i = 0; i < blueTeamParent.childCount; i++) { skyCamTg.AddMember(blueTeamParent.GetChild(i), 0, 0); } }
void Start() { var p1 = PlayerInput.Instantiate(m_PlayerPrefabs[0], controlScheme: "Arrows", pairWithDevice: Keyboard.current); p1.transform.SetPositionAndRotation(m_PlayerSpawns[0].position, m_PlayerSpawns[0].rotation); var p2 = PlayerInput.Instantiate(m_PlayerPrefabs[1], controlScheme: "WASD", pairWithDevice: Keyboard.current); p2.transform.SetPositionAndRotation(m_PlayerSpawns[1].position, m_PlayerSpawns[1].rotation); m_TargetGroup.AddMember(p1.transform, 1f, 1f); m_TargetGroup.AddMember(p2.transform, 1f, 1f); }
/// <summary> /// 敵をロックオンする /// </summary> public void LockOnEnemy(TargetController target) { Debug.Log("Lock on Enemy"); if (m_target == target) { return; } m_target = target; if (m_target) { Vector3 lookAtTarget = target.transform.position; lookAtTarget.y = m_player.transform.position.y; m_player.transform.LookAt(lookAtTarget); } if (m_targetGroup) { m_targetGroup.AddMember(m_target.transform, m_weight, m_radius); } if (!IsLock) { if (m_targetCamera) { m_targetCamera.Follow = m_followTemp; m_targetCamera.Priority = m_priority; } /*フリールックのfollowとlookAtを空にしないとtransformを操作できない*/ if (m_fcum) { m_fcum.Follow = null; m_fcum.LookAt = null; } } IsLock = true; }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { //TODO Should be initialized elsewhere GameObject player = new GameObject(PlayerObjectName); GameObject cursor = new GameObject(CursorObjectName); GameVariables.Player.Transform = player.transform; GameVariables.MouseToTransform = cursor.transform; cinemachineTargetGroup.AddMember(GameVariables.Player.Transform, 2, 0); cinemachineTargetGroup.AddMember(GameVariables.MouseToTransform, 1, 0); GameVariables.MainCamera = MainCam; GameVariables.CamNoiseProfile = ShakeCam.GetCinemachineComponent <Cinemachine.CinemachineBasicMultiChannelPerlin>(); }
void RunSpawnItem() { float range = 0; for (int i = 0; i < spawnEvents.Count; i++) { range += spawnEvents[i].Weights; } float rand = Random.Range(0, range); float top = 0; for (int i = 0; i < spawnEvents.Count; i++) { top += spawnEvents[i].Weights; if (rand < top) { int r = Random.Range(0, spawnEvents[i].positoin.Length); Debug.Log(r); GameObject g = Instantiate(spawnEvents[i].Item, spawnEvents[i].positoin[r], Quaternion.Euler(spawnEvents[i].rotation[r])); SpawnItem.Add(g); CinemachineTargetGroup targetGroup = GameObject.FindGameObjectWithTag("CineGroup").GetComponent <CinemachineTargetGroup>(); targetGroup.AddMember(g.transform, 0.2f, 0); return; } } }
private void DropCrate() { Vector3 pos = getHitPoint(); GameObject go = Instantiate(prefab, pos, dropTarget.transform.rotation, transform); cmtg.AddMember(go.transform, 1f, 3f); }
public void PopulateBlueTeamTargetGroups() { for (int i = 0; i < blueTeamParent.childCount; i++) { blueTeamTg.AddMember(blueTeamParent.GetChild(i), 0, 0); } }
public void PopulateRedTeamTargetGroups() { for (int i = 0; i < redTeamParent.childCount; i++) { redTeamTg.AddMember(redTeamParent.GetChild(i), 0, 0); } }
public void AddElementToCrowd(CrowdElement ce) { //ce.AssignNewTarget(followPoint); ce.currentlyInCrowd = true; if (!crowd.Contains(ce)) { crowd.Add(ce); ce.onNewElementInCrowd?.Invoke(); } if (!followingCrowd.Contains(ce)) { followingCrowd.Add(ce); } bool inGroup = false; foreach (CinemachineTargetGroup.Target t in ctg.m_Targets) { if (t.target.transform == ce.transform) { inGroup = true; break; } } if (!inGroup) { ctg.AddMember(ce.transform, 1, 0); } }
void FixedUpdate() { transform.position = offset + target.position; if (DialogueComponent.currentActiveDialogue != null) { if (!grouped) { grouped = true; var characters = DialogueComponent.currentActiveDialogue.m_dialogueAsset.m_characterData.Values; group.m_Targets = new CinemachineTargetGroup.Target[0]; // reset members foreach (var c in characters) { group.AddMember(c.transform, 1.0f / characters.Count, c.cameraRadius); } } } else { if (grouped) { grouped = false; } } }
public void UpdateTargetGroup(Player[] players) { foreach (var player in players) { cinemachineGroup.RemoveMember(player.transform); if (player.Prey) { cinemachineGroup.AddMember(player.transform, preyWeight, preyRadius); } else { cinemachineGroup.AddMember(player.transform, hunterWeight, hunterRadius); } } }
public void AddToGroup() { for (int i = 0; i < _targetObjects.Count; i++) { _targetGroup.AddMember(_targetObjects[i].transform, 1, 3); } }
public void TutorialStart() { num = 0; CineGroup.AddMember(Teacher.transform, 0.2f, 0); DialogueBubble.transform.DOScale(new Vector3(1, 1, 1), 0.5f); textMesh.ReadText("Come here!"); }
private void PlayerSetUp(GameObject playerGameObject, int playerNo) { group.AddMember(playerGameObject.transform, 1, 0); Player player = playerGameObject.GetComponent <Player>(); player.SetPlayerNo(playerNo); player.SetSkin(playerNo); players.Add(player); // Adding skills to players AddBasicSkills(player); if (playerNo == 1) { player.AddSkill(selectedSkills[SkillSelectionController.GetPlayerOneSkill()]); playerOneCooldownUi.player = player.GetComponent <Player>(); var playerOneChargeControllers = playerOneCooldownUi.GetComponentsInChildren <ChargeController>(); SetCharge(player, playerOneChargeControllers); playerOneHealthBar.entity = player.GetComponent <IHealthBar>(); } else { player.AddSkill(selectedSkills[SkillSelectionController.GetPlayerTwoSkill()]); playerTwoCooldownUi.player = player.GetComponent <Player>(); var playerTwoChargeControllers = playerTwoCooldownUi.GetComponentsInChildren <ChargeController>(); SetCharge(player, playerTwoChargeControllers); playerTwoHealthBar.entity = player.GetComponent <IHealthBar>(); } }
//This will clear the list and re-add everything if the amount of players changes suddenly during a round. //Im getting a gameobject instead of a transform for no real reason, i guess it just might give slightly more options on how to affect the object. public void RemoveTargetGroupMember(GameObject removeThis) { cinemachineTargetGroup.RemoveMember(removeThis.transform); for (int i = 0; i < FindObjectsOfType <Erin_UI_PlayerHealth>().Length; i++) { cinemachineTargetGroup.AddMember(GameObject.FindObjectsOfType <Erin_UI_PlayerHealth>()[i].transform, 1f, 1f); } }
public static void SetCloseUpCamera(int i) { targetGroup = GameObject.FindGameObjectWithTag("CineGroup").GetComponent <CinemachineTargetGroup>(); targetGroup.m_Targets = null; targetGroup.AddMember(players[i].GetComponent <PlayerHitten>().Hips, 1, 0); virtualCamera.GetCinemachineComponent <CinemachineFramingTransposer>().m_CameraDistance = 5; // virtualCamera.transform.eulerAngles = players[i].GetComponentInChildren<PlayerInput>().transform.eulerAngles * -1; }
/** * Given a player prefab instance which has just been spawned, assign it to the camera target group and * ensure it is respawned at the position of this spawner. */ private void RegisterSpawnedInstance(PlayerController player) { if (targetGroup != null) { targetGroup.AddMember(player.transform, 1, CameraSettings.Instance.PlayerInclusionRadius); } OnSpawn(player); }
void Start() { if (targetGroup.IsEmpty) { targetGroup.AddMember(transform, 1, surfaceRadius); } Debug.Assert(targetGroup.m_Targets.Length == 1 && targetGroup.m_Targets[0].target == transform); }
public void AddToCloseUpTargetGroup(CharacterControl unit) { Transform spine = unit.GetSpine(); if (closeUpTargetGroup.FindMember(spine) == -1) { closeUpTargetGroup.AddMember(spine, unit.CharacterData.TargetGroupWeight, unit.CharacterData.TargetGroupRadius); } }
void Start() { if (targetFollowGroup == null) { targetFollowGroup = GameObject.Find("TargetGroup").GetComponent <CinemachineTargetGroup>(); } targetFollowGroup.AddMember(transform, 1, 6); }
void Start() { _targetGroup = this.GetComponent <CinemachineTargetGroup>(); if (PlayerManager.CurrentPlayer) { var followTarget = PlayerManager.CurrentPlayer.transform; _targetGroup.AddMember(followTarget, 1.0f, 1.0f); } }
public void AddToTargetGroup(CharacterControl unit) { Transform spine = unit.GetSpine(); //Debug.Log (spine); if (targetGroup.FindMember(spine) == -1) { targetGroup.AddMember(spine, unit.CharacterData.TargetGroupWeight, unit.CharacterData.TargetGroupRadius); } }
private void SpawnManager_OnWaveChange(bool started) { //Respawn dead and move all characters to the respawn points if (!started) { for (int i = 0; i < characters.Count; i++) { Vector3 pos = playerInformation.playerRespawnPoints[Random.Range(0, playerInformation.playerRespawnPoints.Count)].position; if (characters[i].IsDead) { characters[i].Respawn(pos); targetGroup.AddMember(characters[i].transform, weight, radius); } else { characters[i].transform.position = pos; } } } }