public void Awake() { // Class SetUps canDrop = false; SlctdLant = LanternType.Regular; // Set key code: key = KeyCode.Mouse1; // Component Getters avatarController = GetComponent<AvatarController>(); // Initialization SlctdLant = LanternType.Regular; spawnDistance = 1.0f; maxLanternCount = UseCount; // ToolTip text ToolTip.Description = "Places a Latern down.\nLimited amount."; ToolTip.FirstLabel = "Duration:"; ToolTip.FirstAttribute = "8 sec"; ToolTip.SecondLabel = "Cooldown:"; ToolTip.SecondAttribute = Cooldown.ToString() + " sec"; ToolTip.ThirdLabel = ""; ToolTip.ThirdAttribute = ""; }
public void Awake() { canDrop = false; SlctdTrap = TrapType.Glue; spawnDistance = 1.0f; // Set key code: key = KeyCode.LeftControl; avatarController = GetComponent<AvatarController>(); // ToolTip text ToolTip.Description = "Places a Glue trap.\nSlows down enemies."; ToolTip.FirstLabel = "Slow Rate:"; ToolTip.FirstAttribute = " 30%"; ToolTip.SecondLabel = "Duration:"; ToolTip.SecondAttribute = "5 sec"; ToolTip.ThirdLabel = ""; ToolTip.ThirdAttribute = ""; }
void Awake() { _layer = 1 << 12 | 1 << 13; _distance = 5F; _onCollision = false; _controller = GetComponent<AvatarController>(); }
public void Awake() { canDrop = false; blockCollector = GameObject.Find("BlocksCollector"); avatarController = GetComponent<AvatarController>(); key = KeyCode.Space; }
public void Awake() { canDrop = false; avatarController = GetComponent<AvatarController>(); avatarNetwork = GetComponent<AvatarNetworkBehavior>(); animator = GetComponent<RpcNetworkAnimator>(); key = KeyCode.M; }
void OnEnable() { if (_avatar == null) { _avatar = GameObject.FindGameObjectWithTag("Player").transform; _avatarController = _avatar.GetComponent<AvatarController>(); } _avatarController.LateFixedUpdate += Replace; }
public void AttachAvatar(GameObject avatarObj) { TargetObj = avatarObj.transform; // Init Controller.. TargetController = TargetObj.GetComponent<AvatarController>(); if (TargetController == null) { Debug.LogError("Target Object does not contain an avatar controller."); return; } }
void OnEnable() { m_CameraSwitcher = GetComponent<CameraSwitcher>(); // Ensure uniqueness if (AvatarController.g) { Destroy(gameObject); } else { AvatarController.g = this; } }
/* void OnEnable () { GameObject[] playerObjects = GameObject.FindGameObjectsWithTag("Player"); if (playerObjects.Length != 1) { Debug.LogError("There should be exactly one Player-tagged object in the scene, but there are " + playerObjects.Length + "."); } else { m_Avatar = playerObjects[0].GetComponent<AvatarController>(); if (!m_Avatar.m_NextNode) { m_Avatar.m_NextNode = gameObject.GetComponent<Node>(); } } } */ void Start() { CameraFade.StartAlphaFade(Color.white, isFadeIn: true, fadeDuration: 2f, fadeDelay: 0f); m_Avatar = AvatarController.g; if (!m_Avatar.m_NextNode) { m_Avatar.m_NextNode = gameObject.GetComponent<Node>(); // Sketchy! m_Avatar.transform.position = gameObject.transform.position; } }
public void Awake() { // ISkill SetUps canDrop = false; key = KeyCode.E; // Get ToggleLightBox object. if (ToggleLightBox == null) { ToggleLightBox = transform.FindChild("AvatarRotation").FindChild("LightHitBox").gameObject; } LightMask = 1 << LayerMask.NameToLayer("LightSwitch"); avatarController = GetComponent<AvatarController>(); }
bool isGrasping(Contact contact) { AvatarController avatarController = model.part.body.avatar.controller; int totalPartsTouching = contact.bonesTouching.ConvertAll(bc => bc.bone.part).Distinct().Count(); if (totalPartsTouching >= 2 && contact.specialPartsTouchingCount > 1 && contact.specialPartsTouchingCount != totalPartsTouching) { return(true); } else { return(false); } }
private void LoadModel(string modelDir) { string modelPath = "Clothing/" + modelDir + "/model"; UnityEngine.Object modelPrefab = Resources.Load(modelPath, typeof(GameObject)); if (modelPrefab == null) { return; } if (selModel != null) { GameObject.Destroy(selModel); } selModel = (GameObject)GameObject.Instantiate(modelPrefab); selModel.name = "Model" + modelDir; selModel.transform.position = Vector3.zero; selModel.transform.rotation = Quaternion.Euler(0, 180f, 0); AvatarController ac = selModel.AddComponent <AvatarController>(); ac.posRelativeToCamera = modelRelativeToCamera; ac.mirroredMovement = true; ac.verticalMovement = true; ac.smoothFactor = 0f; KinectManager km = KinectManager.Instance; ac.Awake(); if (km.IsUserDetected()) { ac.SuccessfulCalibration(km.GetPrimaryUserID()); } km.avatarControllers.Clear(); // = new List<AvatarController>(); km.avatarControllers.Add(ac); AvatarScaler scaler = selModel.AddComponent <AvatarScaler>(); scaler.mirroredAvatar = true; scaler.continuousScaling = true; scaler.Start(); }
/// <summary> /// Destroy clothes model based on player index /// </summary> private void DestroySelectedModel() { if (app.model.modelClothes.listClothes[app.model.modelData.playerIndex]) { AvatarController ac = app.model.modelClothes.listClothes[app.model.modelData.playerIndex].GetComponent <AvatarController>(); KinectManager km = KinectManager.Instance; if (ac != null && km != null) { km.avatarControllers.Remove(ac); } GameObject.Destroy(app.model.modelClothes.listClothes[app.model.modelData.playerIndex]); //app.model.modelClothes.selModel = null; //prevSelected = -1; } }
/// <summary> /// Destroys the currently selected model. /// </summary> public void DestroySelectedModel() { if (selModel) { AvatarController ac = selModel.GetComponent <AvatarController>(); KinectManager km = KinectManager.Instance; if (ac != null && km != null) { km.avatarControllers.Remove(ac); } GameObject.Destroy(selModel); selModel = null; prevSelected = -1; } }
public override void RenderUpdate(Timestep timestep, Entity entity, AvatarController avatarController, EntityUniverseFacade facade, int updateSteps) { var logic = entity.TileStateEntityLogic as CenterTileStateEntityLogic; int lastNum = _numberToDraw; if (logic == null || logic.RoundStartedTimestep == Timestep.Null || logic.RoundStartedTimestep + 6 * Constants.TimestepsPerSecond < timestep) { _numberToDraw = -1; return; } if (logic.RoundStartedTimestep + 1 * Constants.TimestepsPerSecond > timestep) { _numberToDraw = 5; } else if (logic.RoundStartedTimestep + 2 * Constants.TimestepsPerSecond > timestep) { _numberToDraw = 4; } else if (logic.RoundStartedTimestep + 3 * Constants.TimestepsPerSecond > timestep) { _numberToDraw = 3; } else if (logic.RoundStartedTimestep + 4 * Constants.TimestepsPerSecond > timestep) { _numberToDraw = 2; } else if (logic.RoundStartedTimestep + 5 * Constants.TimestepsPerSecond > timestep) { _numberToDraw = 1; } else if (logic.RoundStartedTimestep + 6 * Constants.TimestepsPerSecond > timestep) { _numberToDraw = 0; } if (lastNum != _numberToDraw && _numberToDraw == 0) { _playStartRound = true; } else if (lastNum != _numberToDraw && _numberToDraw > 0) { _playTick = true; } }
void UpdateEquipments(GameObject previewModal) { // refresh data. List <GameObject> EquipInstances = new List <GameObject>(); if (!_self) { //OLD_PlayerInfo playerInfo = TownPlayerManager.Singleton.ActivedPlayerInfo; //PlayerProfile.GetOtherEquipmentInstanceWithIds(EquipInstances, playerInfo._equipIds, playerInfo._class); } else { int role = (int)PlayerInfo.Instance.Role; PlayerInfo.Instance.GetSelfEquipmentInstance(EquipInstances); } List <FCEquipmentsBase> equipments = new List <FCEquipmentsBase>(); // get equipment data array foreach (GameObject g in EquipInstances) { FCEquipmentsBase [] es = g.GetComponentsInChildren <FCEquipmentsBase>(); equipments.AddRange(es); // destroy ai game object GameObject.Destroy(g); } // equip models. AvatarController avatar = previewModal.GetComponent <AvatarController>(); avatar.RemoveWeapons(); foreach (FCEquipmentsBase eeb in equipments) { EquipmentAssembler.Singleton.Assemble(eeb, avatar); } Renderer [] renderers = _previewModel.GetComponentsInChildren <Renderer>(); foreach (Renderer r in renderers) { if (r.gameObject.layer != LayerMask.NameToLayer("TransparentFX")) { r.gameObject.layer = LayerMask.NameToLayer("2DUI"); } } }
public override void Update(Universe universe, Vector2 origin, AvatarController avatar, List<ScanCode> input, bool ctrl, bool shift, IReadOnlyList<InterfaceLogicalButton> inputPressed, Vector2 mouseLocation, bool click, bool clickHold) { var size = GetSize(); var range = origin + size; if (_isEnabled) { if (Helpers.VectorContains(origin, range, mouseLocation)) { if (click && !clickHold && Window?.CallUpdates != false && Window?.Visible != false) { _pressed = true; } if (_pressed) { if (!click) { _pressed = false; OnClick?.Invoke(); } } if (clickHold && Window?.CallUpdates != false && Window?.Visible != false) { if (_update) { HoldTimer(); OnHold?.Invoke(); } } foreach (var element in Elements) { if (element is UiTextBlock textElement) { textElement.SetColor(_activeTextColor); } } } else { _pressed = false; foreach (var element in Elements) { if (element is UiTextBlock textElement) { textElement.SetColor(_textColor); } } } } else { _pressed = false; foreach (var element in Elements) { if (element is UiTextBlock textElement) { textElement.SetColor(_disabledTextColor); } } } }
private static void Draw(DeviceContext graphics, ref Matrix4F matrix, Entity avatar, Universe universe, AvatarController avatarController) { InitializeContentManager(graphics); var mouseState = ClientContext.InputSource.GetMouseState(); try { foreach (var window in FoxUIHook.Instance.Windows) { if (window.Visible && !window.AlwaysOnTop && !window.IsDisposed) { window.Draw(graphics, ref matrix, avatar, universe, avatarController, mouseState.Vector2()); } } } catch (InvalidOperationException) { // stop enumeration bugs } }
private void SetUsers() { //first scale down our items, only scale up if we exist foreach (AvatarController avatar in AvatarList) { avatar.gameObject.transform.localScale = Vector3.zero; } for (int i = 0; i < _UserCount; i++) { if (i <= 2) { AvatarController newAvatar = AvatarList[i]; Vector3 curAvatarScale = AvatarScale[i]; newAvatar.gameObject.transform.localScale = curAvatarScale; } } }
bool ReverceMode; //если true, значит идём по контрольным точкам в обратном направлении private void Start() { Agent = GetComponentInChildren <UnityEngine.AI.NavMeshAgent>(); Avatar = GetComponent <AvatarController>(); Agent.updateRotation = false; Agent.updatePosition = true; if (CurrentPatrolPath != null && CurrentPatrolPath.PathPointList != null && CurrentPatrolPath.PathPointList.Length > 0) { SetTarget(CurrentPatrolPath.PathPointList[0]); Agent.SetDestination(currentTarget.position); } else { Debug.LogWarning("No any PatrolPath for Bot: " + this.name); } }
private bool GetModelBoneLength(AvatarController avatarController, KinectInterop.JointType baseJoint, KinectInterop.JointType endJoint, ref float length) { length = 0f; if (avatarController) { Transform joint1 = avatarController.GetBoneTransform(avatarController.GetBoneIndexByJoint(baseJoint, false)); Transform joint2 = avatarController.GetBoneTransform(avatarController.GetBoneIndexByJoint(endJoint, false)); if (joint1 && joint2) { length = (joint2.position - joint1.position).magnitude; return(true); } } return(false); }
public void Controller_Avatar_Update_Post_InValid_Should_Return_Error_Page() { /// <summary> /// This Test calls the Update, but passes null data /// The controller will return a redirect to the error home page /// So the test needs to cast the return to a redirect, and then check that it got to the home error page /// </summary> // Arrange AvatarController controller = new AvatarController(); // Act var result = (RedirectToRouteResult)controller.Update((AvatarModel)null); // Assert Assert.AreEqual("Error", result.RouteValues["action"], TestContext.TestName); Assert.AreEqual("Home", result.RouteValues["route"], TestContext.TestName); }
public void SetTargetAvatar(AvatarController avatar) { if (avatar == null) { return; } //拷贝新的Avatar var clone = this.AddGameObject(avatar.gameObject, true); if (clone != null) { m_Avatar = clone.GetComponentInChildren <AvatarController>(); //var euler = m_Avatar.transform.eulerAngles; //euler.y = 180; //m_Avatar.transform.eulerAngles = euler; m_Animator = clone.GetComponentInChildren <Animator>(); } }
public void Start() { if (interactUI == null) { var ui = transform.FindChild("InteractUI"); if (ui) { interactUI = ui.gameObject; } } playerOnTrigger = 0; if (Type == InteractableObject.Player) { Debug.Log("interact " + name); ac = GetComponentInParent<AvatarController>(); } }
void Update() { KinectManager kinectManager = KinectManager.Instance; AvatarController avatarCtrl = avatarModel ? avatarModel.gameObject.GetComponent <AvatarController>() : null; if (/*AvatarMain.activePlayerIndex == -1 &&*/ kinectManager != null && kinectManager.IsInitialized() && avatarModel != null && avatarCtrl && kinectManager.IsUserTracked(avatarCtrl.playerId)) { // get mirrored state bool isMirrored = avatarCtrl.mirroredMovement; // get the difference string sDiffDetails = string.Empty; fMatchPercent = 1f - GetPoseDifference(isMirrored, true, ref sDiffDetails); bPoseMatched = (fMatchPercent >= matchThreshold); //string sPoseMessage = string.Format("Pose match: {0:F0}% {1}", fMatchPercent * 100f, (bPoseMatched ? "- Matched" : "")); //Debug.Log(sPoseMessage); if (infoText != null) { string sPoseMessage = string.Format("Pose match: {0:F0}% {1}", fMatchPercent * 100f, (bPoseMatched ? "- Matched" : "")); infoText.text = sPoseMessage + "\n\n" + sDiffDetails; } //if (IsPoseMatched()) //{ // avatarMain.pointing = true; //} //else //{ // avatarMain.pointing = false; //} } else { // no user found if (infoText != null) { infoText.text = "Try to match the pose on the left."; } } GetMatchPercent(); }
protected void CreateUI() { try { _mainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First(); _mainMenuViewController.didFinishEvent += (sender, result) => { Logger.Debug($"finish \"{result}\""); if (result == MainMenuViewController.MenuButton.Party) { try { _mockPartyViewController = new MockPartyViewController(); } catch (Exception e) { Logger.Error(e); } } }; _mainMenuRectTransform = _mainMenuViewController.transform as RectTransform; if (Config.Instance.AutoStartLobby) { SteamAPI.CreateLobby(!Config.Instance.IsPublic); } try { AvatarController.LoadAvatars(); } catch (Exception e) { Logger.Error($"Unable to load avatars! Exception: {e}"); } SongListUtils.Initialize(); MultiplayerListing.Init(); MultiplayerLobby.Init(); WaitingMenu.Init(); CreateSettingsMenu(); CreateMainMenuButton(); } catch (Exception e) { Logger.Error($"Unable to create UI! Exception: {e}"); } }
public override void Render(DeviceContext graphics, ref Matrix4F matrix, Vector3D renderOrigin, Entity entity, AvatarController avatarController, Timestep renderTimestep, RenderMode renderMode) { if (!_botTileCode.IsNullOrEmpty()) { if (entity.Logic is BotEntityLogic logic) { var pos = entity.Physics.Position.ToVector3F(); if (pos.Y + _add >= pos.Y + 0.125) { _up = false; } if (pos.Y + _add <= pos.Y + 0) { _up = true; } _add = _up ? _add + 0.0015F : _add - 0.0015F; pos.Y += _add; var botMatrix = Matrix.CreateFromYawPitchRoll(MathHelper.ToRadians(logic.Rotation), 0, 0).ToMatrix4F(); botMatrix = Matrix4F.Multiply(botMatrix.Translate(pos.X - (float)renderOrigin.X, pos.Y - (float)renderOrigin.Y, pos.Z - (float)renderOrigin.Z), matrix); _bot.Render(graphics, ref botMatrix); var bladeMatrix = Matrix .CreateFromYawPitchRoll( (float)((DateTime.UtcNow - _created).TotalMilliseconds * 0.003 % (2 * Math.PI)), 0, 0) .ToMatrix4F(); for (var i = 0; i < logic.BotComponent.BladeLocations.Count; i++) { var currentPosition = pos + logic.BotComponent.BladeLocations[i].Item1.ToVector3F(); var currentBladeMatrix = Matrix4F.Multiply(bladeMatrix.Translate( currentPosition.X - (float)renderOrigin.X, currentPosition.Y - (float)renderOrigin.Y, currentPosition.Z - (float)renderOrigin.Z), matrix); _bladeTile.Configuration.Icon.Matrix().Scale(logic.BotComponent.BladeLocations[i].Item2).Render(graphics, ref currentBladeMatrix); } } } }
void Update() { KinectManager kinectManager = KinectManager.Instance; AvatarController avatarCtrl = avatarModel ? avatarModel.gameObject.GetComponent <AvatarController>() : null; if (kinectManager != null && kinectManager.IsInitialized() && avatarModel != null && avatarCtrl && kinectManager.IsUserTracked(avatarCtrl.playerId)) { // get mirrored state bool isMirrored = avatarCtrl.mirroredMovement; // get the difference string sDiffDetails = string.Empty; fMatchPercent = 1f - GetPoseDifference(isMirrored, true, ref sDiffDetails); bPoseMatched = (fMatchPercent >= matchThreshold); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////making sure that the pose has finished moving, and reached the pose matech percentage before the next pose starts ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (bPoseMatched == true && nextStep == true) { step = step + 1; nextStep = false; } string sPoseMessage = string.Format("Pose match: {0:F0}% {1}", fMatchPercent * 100f, (bPoseMatched ? "- Matched" : "")); if (infoText != null) { infoText.text = sPoseMessage + "\n\n" + sDiffDetails; } } else { // no user found if (infoText != null) { infoText.text = "Try to match the pose on the left."; } } }
void Update() { if (activeSelector && selected >= 0 && selected < modelNames.Length && prevSelected != selected) { KinectManager kinectManager = KinectManager.Instance; if (kinectManager && kinectManager.IsInitialized() && kinectManager.IsUserDetected(playerIndex)) { OnDressingItemSelected(selected); } } if (selModel != null) { float curMuscleLimits = applyMuscleLimits ? 1f : 0f; if (Mathf.Abs(curModelOffset - (verticalOffset + forwardOffset + curMuscleLimits)) >= 0.001f) { curModelOffset = verticalOffset + forwardOffset + curMuscleLimits; AvatarController ac = selModel.GetComponent <AvatarController>(); if (ac != null) { ac.verticalOffset = verticalOffset; ac.forwardOffset = forwardOffset; ac.applyMuscleLimits = applyMuscleLimits; } } if (Mathf.Abs(curScaleFactor - (bodyScaleFactor + bodyWidthFactor + armScaleFactor + legScaleFactor)) >= 0.001f) { curScaleFactor = bodyScaleFactor + bodyWidthFactor + armScaleFactor + legScaleFactor; AvatarScaler scaler = selModel.GetComponent <AvatarScaler>(); if (scaler != null) { scaler.continuousScaling = continuousScaling; scaler.bodyScaleFactor = bodyScaleFactor; scaler.bodyWidthFactor = bodyWidthFactor; scaler.armScaleFactor = armScaleFactor; scaler.legScaleFactor = legScaleFactor; } } } }
private void createAvatarController(InputModule module) { AvatarController controller = GameObject.Instantiate(avatarControllerPrefab); controller.inputModule = module; controller.transform.SetParent(avatarControllerParent); controller.color = playerColors[controllers.Count]; controller.character = GameController.instance.party.GetNextCharacter(); if (controller.character) { controller.characterMenu = UICharacterMenus.GetMenu(controller.character); controller.preferredCharacterId = controller.character.id; NeverdawnCamera.AddTargetLerped(controller.character.transform); } controllers.Add(controller); }
private string getTextureName(AvatarController avatar) { if (avatar != null) { Renderer[] renders = avatar.GetComponentsInChildren <Renderer>(); if (renders != null) { for (int k = 0; k < renders.Length; k++) { Texture tex = renders[k].sharedMaterial.GetTexture("_MainTex"); if (tex != null) { return(tex.name); } } } } return(avatar.name); }
/// <summary> /// Defines the doll. /// </summary> public void defineDoll() { if (n_ava == 1) { dolly = doll; dollh.SetActive(true); dollh2.SetActive(false); Debug.Log("João"); } else { dolly = doll2; dollh2.SetActive(true); dollh.SetActive(false); Debug.Log("Maria"); } defined = !defined; }
/// <summary> /// Start function is called when the game ends, to immobilize all players and process their records. /// </summary> void Start() { localID = Login.localid; // End Gameplay initializePlayers(); stopMoving(); QM = gameObject.GetComponent <QuestionManager>(); QM.setEnded(); // Create Records createRecords(); //display User Avatar: AvatarController AC = new AvatarController(); AC.displayAvatar(avatar, LobbySetUp.LS.playerList[PhotonNetwork.LocalPlayer.NickName]); }
private IEnumerator preloadPenguinPrefab() { AssetRequest <GameObject> assetRequest; try { assetRequest = Content.LoadAsync(PENGUIN_KEY); if (assetRequest == null) { throw new NullReferenceException(); } } catch (Exception) { penguinPreload = LoadingTriState.FAILURE; Log.LogError(this, $"Could not load penguin asset {PENGUIN_KEY.Key}."); yield break; } if (assetRequest != null) { yield return(assetRequest); } try { penguin = UnityEngine.Object.Instantiate(assetRequest.Asset); avatarView = penguin.GetComponent <AvatarView>(); avatarModel = penguin.GetComponent <AvatarModel>(); avatarController = penguin.GetComponent <AvatarController>(); if (!avatarController || !avatarView || !avatarModel) { throw new NullReferenceException(); } } catch (Exception) { penguinPreload = LoadingTriState.FAILURE; Log.LogError(this, $"Could not instantiate penguin MVC components. {PENGUIN_KEY.Key}"); yield break; } penguin.SetActive(value: false); defaultBodyColor = avatarModel.BodyColor; penguinPreload = LoadingTriState.SUCCESS; }
private void HandleFall() { if (!isNearGround && !IsInAir) { fallDistance = 0; fallStart = transform.position; Debug.Log("Falling!"); isControlledFall = true; AvatarController.IsFalling = true; AvatarController.IsJumping = true; AvatarController.StartControlledFall(); } if (isControlledFall && fallDistance > fallDistanceUncontrolled) { isControlledFall = false; AvatarController.StartUncontrolledFall(); } }
public void Talk(AvatarController controller) { Vector3 dir = (transform.position - controller.character.transform.position).normalized; controller.character.PushAction(new CharacterTurnAction(dir, 90.0f)); Character npc = GetComponent <Character>(); if (npc != null) { npc.PushAction(new CharacterTurnAction(-dir, 90.0f)); } if (!string.IsNullOrEmpty(trigger)) { EventController.eventTarget = frame; GameController.instance.TriggerEvent(trigger); } }
void Awake() { Cursor.visible = false; //since config is a singleton it will be the one created in scene 0 or this scene config = Config.instance; avatar = GameObject.Find("Avatar"); hud = avatar.GetComponent("HUD") as HUD; avatarController = avatar.GetComponent("AvatarController") as AvatarController; logfile = config.subjectPath + "/test.log"; configfile = config.expPath + "/" + config.filename; hud.showOnlyHUD(); //when in editor if (!config.bootstrapped) { logfile = Directory.GetCurrentDirectory() + "/data/tmp/" + "test.log"; configfile = Directory.GetCurrentDirectory() + "/data/tmp/" + config.filename; } if (config.runMode == ConfigRunMode.NEW) { dblog = new dbLog(logfile); } else if (config.runMode == ConfigRunMode.RESUME) { dblog = new dbPlaybackLog(logfile); } else if (config.runMode == ConfigRunMode.PLAYBACK) { CharacterController c = avatar.GetComponent <CharacterController>(); c.detectCollisions = false; dblog = new dbPlaybackLog(logfile); } else if (config.runMode == ConfigRunMode.DEBUG) { dblog = new dbMockLog(logfile); } //start session }
// private static string[] DeafultMarkPoint = {"GD_Left", "GD_Right","GD_Back"}; public static bool AddToMarkPoint(AvatarController controller) { // List<string> fitter = new List<string>(DeafultMarkPoint); bool ret = false; Transform[] trans = controller.gameObject.GetComponentsInChildren <Transform>(); for (int k = 0; k < trans.Length; k++) { GameObject go = trans[k].gameObject; List <GameObject> list = controller.markPoint.listMarkPoint; // if (!list.Contains(go) && fitter.Contains(go.name)) { if (!list.Contains(go) && go.name.IndexOf("MP_") > -1) { list.Add(go); ret = true; } } return(ret); }
public void Awake() { canDrop = false; avatarController = GetComponent<AvatarController>(); // Set key code: key = KeyCode.LeftShift; // ToolTip text ToolTip.Description = "Doubles explorer Speed"; ToolTip.FirstLabel = "Duration:"; ToolTip.FirstAttribute = Duration.ToString() + " sec"; ToolTip.SecondLabel = "Cooldown:"; ToolTip.SecondAttribute = Cooldown.ToString() + " sec"; ToolTip.ThirdLabel = ""; ToolTip.ThirdAttribute = ""; }
// reaction subroutine for talk actions IEnumerator React(string name, TalkState actionState) { float delay = 0.5f; yield return(new WaitForSeconds(delay)); if (actionState.Equals(TalkState.TALK_START)) { AvatarController partnerController = getPartnerController(name); partnerController.isListening(true); partnerController.DoGazing(GazeState.GAZEAT_PARTNER); } if (actionState.Equals(TalkState.TALK_END)) { AvatarController partnerController = getPartnerController(name); partnerController.isListening(false); partnerController.DoNodding(NodState.NOD_END); partnerController.DoGazing(GazeState.GAZEBACK_PARTNER); } }
public void Awake() { canDrop = false; animator = GetComponentInParent<RpcNetworkAnimator>(); avatarNetwork = GetComponent<AvatarNetworkBehavior>(); avatarController = GetComponent<AvatarController>(); if (FX) { Transform oldParent = FX.parent; FX.parent = null; FX.localScale = new Vector3(AreaRadius, AreaRadius, 1); ; FX.parent = oldParent; } // Set key code: key = KeyCode.Mouse0; }
public void Controller_Avatar_Update_Post_Invalid_Null_Id_Should_Return_Model() { // Arrange AvatarController controller = new AvatarController(); var data = new AvatarModel { Description = "description", Id = null, Name = "Name", Uri = "picture" }; // Act ViewResult result = controller.Update(data) as ViewResult; var resultAvatar = result.Model as AvatarModel; // Assert Assert.AreEqual(data.Description, resultAvatar.Description, TestContext.TestName); }
static EventTracker() { AvatarController.RemoveAvatar(); SceneView.onSceneGUIDelegate += view => { Event e = Event.current; switch (e.type) { case EventType.KeyDown: { // This delivers keys to the key listener. The // key listeners dispaches the events to the correct action. ObjectController.GetKeyListener().Receive(Event.current.keyCode); break; } } }; }
public void Awake() { canDrop = false; animator = GetComponentInParent<RpcNetworkAnimator>(); avatarNetwork = GetComponent<AvatarNetworkBehavior>(); avatarController = GetComponent<AvatarController>(); // Set key code: key = KeyCode.Mouse0; // ToolTip text ToolTip.Description = "Throws light greanade. Deal damage on impact."; ToolTip.FirstAttribute = "Regular"; ToolTip.SecondLabel = "Knockback:"; ToolTip.SecondAttribute = "Low"; ToolTip.ThirdLabel = "Radius:"; ToolTip.ThirdAttribute = ExploRadius.ToString() + "m"; }
public void Awake() { canDrop = false; SlctdTrap = TrapType.Poison; spawnDistance = 1.0f; // Set key code: key = KeyCode.LeftShift; avatarController = GetComponent<AvatarController>(); // ToolTip text ToolTip.Description = "Places a Poison trap.\nDamages enemies."; ToolTip.FirstLabel = "Damage:"; ToolTip.FirstAttribute = "9 per sec"; ToolTip.SecondLabel = "Duration:"; ToolTip.SecondAttribute = "5 sec"; ToolTip.ThirdLabel = ""; ToolTip.ThirdAttribute = ""; }
public void Awake() { canDrop = false; animator = GetComponentInParent<RpcNetworkAnimator>(); avatarNetwork = GetComponent<AvatarNetworkBehavior>(); avatarController = GetComponent<AvatarController>(); if (FX == null) { FX = transform.FindChild("AvatarRotation").FindChild("AllAnimsInOne").FindChild("HealFX"); } if (FX) { Transform oldParent = FX.parent; FX.parent = null; FX.localScale = new Vector3(AreaRadius, AreaRadius, 1); FX.parent = oldParent; } // Set key code: key = KeyCode.LeftShift; // ToolTip text ToolTip.Description = "Recovers allies health around Explorer."; ToolTip.FirstLabel = "Amount:"; ToolTip.FirstAttribute = HealAmount.ToString() + " HP"; ToolTip.SecondLabel = "Radius:"; ToolTip.SecondAttribute = AreaRadius.ToString() + "m"; ToolTip.ThirdLabel = ""; ToolTip.ThirdAttribute = ""; }
public void Awake() { canDrop = false; animator = GetComponentInParent<RpcNetworkAnimator>(); avatarNetwork = GetComponent<AvatarNetworkBehavior>(); avatarController = GetComponent<AvatarController>(); DisplayBox = transform.FindChild("AvatarRotation/SpriteBox").gameObject; DisplayBox.SetActive(false); // Set key code: key = KeyCode.Mouse0; // ToolTip text ToolTip.Description = "Swings heavy staff and deals damage."; ToolTip.FirstAttribute = "High"; ToolTip.SecondLabel = "Knockback:"; ToolTip.SecondAttribute = "High"; ToolTip.ThirdAttribute = "Low"; }
void Start() { avatarCtrl = GetComponent<AvatarController>(); animCtrl = GetComponent<Animation>(); loadingCtrl = GetComponent<AvatarLoadingController>(); //Setup the basic male and female idle animations if (BasicIdleMale == null) { this.enabled = false; Debug.LogError("BasicIdleMale anim is not set"); return; } if (BasicIdleFemale == null) { this.enabled = false; Debug.LogError("BasicIdleFemale anim is not set"); return; } // Add male animations to the animation component and setup animCtrl.AddClip(BasicIdleMale, BasicIdleMale.name); animCtrl[BasicIdleMale.name].layer = 0; animCtrl[BasicIdleMale.name].speed = 1 + Random.Range(-BasicIdleSpeadSpread, BasicIdleSpeadSpread); animCtrl[BasicIdleMale.name].wrapMode = WrapMode.Loop; //Add female aniations to the animation component and setup. animCtrl.AddClip(BasicIdleFemale, BasicIdleFemale.name); animCtrl[BasicIdleFemale.name].layer = 0; animCtrl[BasicIdleFemale.name].speed = 1 + Random.Range(-BasicIdleSpeadSpread, BasicIdleSpeadSpread); animCtrl[BasicIdleFemale.name].wrapMode = WrapMode.Loop; //Create a list of all animations, add them to the animation component and setup variables List<AnimationMixingSettings> allIdles = new List<AnimationMixingSettings>(GenericIdles.Length + MaleIdles.Length + FemaleIdles.Length); allIdles.AddRange(GenericIdles); allIdles.AddRange(FemaleIdles); allIdles.AddRange(MaleIdles); foreach (AnimationMixingSettings animMix in allIdles) { if (animMix != null && animMix.Clip != null) { animCtrl.AddClip(animMix.Clip, animMix.Clip.name); AnimationState state = animCtrl[animMix.Clip.name]; state.layer = 1; state.wrapMode = WrapMode.Once; if (animMix.MixingTransform) { state.AddMixingTransform(animMix.MixingTransform); } if (animMix.Additive) { state.blendMode = AnimationBlendMode.Additive; } } } // setup animations for the current gender LoadAnims(currentGender); StartCoroutine(IdleAnims()); }
/// <summary> /// Must be overriden by child classes for their own server specific startup behaviour. /// </summary> protected override void StartupComponents() { m_log.Info("[STARTUP]: Beginning startup processing"); Version = Util.EnhanceVersionInformation(); m_log.Info("[STARTUP]: Version: " + Version + "\n"); Console = new Console(this,"Region", this); IConfig cnf = m_configSource.Source.Configs["Startup"]; string loginURI = "http://127.0.0.1:9000/"; string firstName = string.Empty; string lastName = string.Empty; string password = string.Empty; string startlocation = ""; bool loadtextures = true; bool multipleSims = false; if (cnf != null) { loginURI = cnf.GetString("login_uri", ""); firstName = cnf.GetString("first_name", "test"); lastName = cnf.GetString("last_name", "user"); password = cnf.GetString("pass_word", "nopassword"); loadtextures = cnf.GetBoolean("load_textures", true); MeshSculpties = cnf.GetBoolean("mesh_sculpties", MeshSculpties); BackFaceCulling = cnf.GetBoolean("backface_culling", BackFaceCulling); AvatarMesh = cnf.GetString("avatar_mesh", AvatarMesh); AvatarMaterial = cnf.GetString("avatar_material", AvatarMaterial); AvatarScale = cnf.GetFloat("avatar_scale", AvatarScale); startlocation = cnf.GetString("start_location", ""); multipleSims = cnf.GetBoolean("multiple_sims", multipleSims); ProcessFoliage = cnf.GetBoolean("process_foliage", ProcessFoliage); m_limitFramesPerSecond = cnf.GetBoolean("limitfps", m_limitFramesPerSecond); } LoadTextures = loadtextures; MainConsole.Instance = Console; // Initialize LibOMV if (NetworkInterface == null) NetworkInterface = new RadegastNetworkModule(RInstance); NetworkInterface.MultipleSims = multipleSims; NetworkInterface.OnLandUpdate += OnNetworkLandUpdate; NetworkInterface.OnConnected += OnNetworkConnected; NetworkInterface.OnObjectAdd += OnNetworkObjectAdd; NetworkInterface.OnSimulatorConnected += OnNetworkSimulatorConnected; NetworkInterface.OnObjectUpdate += OnNetworkObjectUpdate; NetworkInterface.OnObjectRemove += OnNetworkObjectRemove; NetworkInterface.OnAvatarAdd += OnNetworkAvatarAdd; //NetworkInterface.OnChat +=new NetworkChatDelegate(OnNetworkChat); //NetworkInterface.OnFriendsListUpdate +=new NetworkFriendsListUpdateDelegate(OnNetworkFriendsListChange); //NetworkInterface.Login(loginURI, firstName + " " + lastName, password, startlocation); // Startup the GUI Renderer = new RaegastRenderer(this,Device); Renderer.Startup(); GUIFont defaultFont = Renderer.GuiEnvironment.GetFont("defaultfont.png"); skin = Renderer.GuiEnvironment.Skin; skin.Font = defaultFont; skincolor = skin.GetColor(GuiDefaultColor.Face3D); skincolor.A = 255; skin.SetColor(GuiDefaultColor.Face3D, skincolor); skincolor = skin.GetColor(GuiDefaultColor.Shadow3D); skincolor.A = 255; skin.SetColor(GuiDefaultColor.Shadow3D, skincolor); // Set up event handler for the GUI window events. Renderer.Device.OnEvent += new OnEventDelegate(OnDeviceEvent); Renderer.Device.Resizeable = true; MeshManager = new MeshManager(Renderer.SceneManager.MeshManipulator, Renderer.Device); SceneGraph = new VSceneGraph(this); // Set up the picker. SceneGraph.TrianglePicker = new TrianglePickerMapper(Renderer.SceneManager.CollisionManager); SceneGraph.TriangleSelector = Renderer.SceneManager.CreateMetaTriangleSelector(); // Only create a texture manager if the user configuration option is enabled for downloading textures if (LoadTextures) { TextureManager = new TextureManager(this,Renderer.Device, Renderer.Driver, SceneGraph.TrianglePicker, SceneGraph.TriangleSelector, "IdealistCache", NetworkInterface); TextureManager.OnTextureLoaded += OnNetworkTextureDownloaded; } AvatarController = new AvatarController(NetworkInterface, null); TerrainManager = ModuleManager.GetTerrainManager(this, m_configSource); Renderer.SceneManager.SetAmbientLight(new Colorf(1f, 0.2f, 0.2f, 0.2f)); // This light simulates the sun //SceneNode light2 = Renderer.SceneManager.AddLightSceneNode(Renderer.SceneManager.RootSceneNode, new Vector3D(0, 255, 0), new Colorf(0f, 0.5f, 0.5f, 0.5f), 250, -1); SceneNode light2 = Renderer.SceneManager.AddLightSceneNode(Renderer.SceneManager.RootSceneNode, new Vector3D(0, 255, 0), new Colorf(0f, 0.6f, 0.6f, 0.6f), 512, -1); // Fog is on by default, this line disables it. //Renderer.SceneManager.VideoDriver.SetFog(new Color(0, 255, 255, 255), false, 9999, 9999, 0, false, false); float fogBrightness = 0.8f; Renderer.SceneManager.VideoDriver.SetFog(new Color(0, (int)(0.5f * 255 * fogBrightness), (int)(0.5f * 255 * fogBrightness), (int)(1.0f * 255 * fogBrightness)), true, 50, 100, 0, true, true); //ATMOSkySceneNode skynode = new ATMOSkySceneNode(Renderer.Driver.GetTexture("irrlicht2_up.jpg"), null, Renderer.SceneManager, 100, -1); //ATMOSphere atmosphere = new ATMOSphere(Renderer.Device.Timer, null, Renderer.SceneManager, -1); //atmosphere.SkyTexture = Renderer.Driver.GetTexture("irrlicht2_up.jpg"); Renderer.Driver.SetTextureFlag(TextureCreationFlag.CreateMipMaps, false); bool Broken = false; if (!Broken) Renderer.SceneManager.AddSkyBoxSceneNode(null, new Texture[] { Renderer.Driver.GetTexture("topax2.jpg"), Renderer.Driver.GetTexture("irrlicht2_dn.jpg"), Renderer.Driver.GetTexture("rightax2.jpg"), Renderer.Driver.GetTexture("leftax2.jpg"), Renderer.Driver.GetTexture("frontax2.jpg"), Renderer.Driver.GetTexture("backax2.jpg")}, 0); Renderer.Driver.SetTextureFlag(TextureCreationFlag.CreateMipMaps, true); CameraController = new CameraController(this,Renderer.SceneManager); SceneGraph.WaterNode = new WaterSceneNode(null, Renderer.SceneManager, new Dimension2Df(180, 180), new Dimension2D(100, 100), new Dimension2D(512, 512)); SceneGraph.WaterNode.Position = new Vector3D(0, 30, 0); //SceneGraph.WaterNode.WaveHeight *= .4f; SceneGraph.WaterNode.RefractionFactor = 0.3f; SceneGraph.WaterNode.WaveDisplacement = 2f; SceneGraph.WaterNode.WaveHeight = 2f; SceneGraph.WaterNode.WaveLength = 2f; SceneGraph.WaterNode.WaveSpeed = 5f; SceneGraph.WaterNode.WaveRepetition = 20f; SceneGraph.WaterNode.Scale = new Vector3D(0.2f,0.2f,0.2f); SceneGraph.WaterNode.MultiColor = new Colorf(0.9f, 0.7f, 0.7f, 1.0f); UserInterface = new UserInterfaceManager(this, Renderer.Driver, Renderer.SceneManager, Renderer.GuiEnvironment, CameraController, AvatarController); UserInterface.DefaultFont = defaultFont; XmlReader xml = Broken? null: XmlReader.Create(new StreamReader("../../../media/About.xml")); while (xml != null && xml.Read()) { switch (xml.NodeType) { case XmlNodeType.Text: UserInterface.AboutText = xml.ReadContentAsString(); break; case XmlNodeType.Element: if (xml.Name.Equals("startUpModel")) { } else if (xml.Name.Equals("messageText")) UserInterface.AboutCaption = xml.GetAttribute("caption"); break; } } string formsUiConfigurationOption = m_configSource.Source.Configs["Startup"].GetString("forms", "true"); if (formsUiConfigurationOption == "true") { frmCommunications f = new frmCommunications(NetworkInterface); f.Visible = true; this.m_formsThread = new Thread(delegate() { Application.DoEvents(); Thread.Sleep(50); }); m_formsThread.Start(); } AnimationManager = new AnimationManager(this); TimeSpan timeTaken = DateTime.UtcNow - StartupTime; m_log.InfoFormat("[STARTUP]: Startup took {0}m {1}s", timeTaken.Minutes, timeTaken.Seconds); }
protected virtual void Start() { _avatarController = GetComponent<AvatarController>(); if (_avatarController == null) { Debug.LogWarning("No AvatarController found on the Foreign Character, please attach it"); } _actor = GetComponent<Actor>(); if (_actor == null) { Debug.LogWarning("No Actor attached to the Foreign Character, please attach it"); } }
void Awake() { _avatarController = GetComponent<AvatarController>(); _attraction = GetComponent<Chaos>(); }
/* void OnEnable () { GameObject[] playerObjects = GameObject.FindGameObjectsWithTag("Player"); if (playerObjects.Length != 1) { Debug.LogError("There should be exactly one Player-tagged object in the scene, but there are " + playerObjects.Length + "."); } else { m_Avatar = playerObjects[0]; } } */ void Start() { m_Avatar = AvatarController.g; }
protected virtual void Start() { Application.runInBackground = true; _character = GetComponent<AvatarController>(); if (_character == null) { Debug.LogWarning("No AvatarController found on the Foreign Character, please attach it"); } // Find Blob Projector _projector = GetComponentInChildren<Projector>(); _attachPoint = transform.FindChild("AttachPoint"); _lastTargetPos = transform.position; }
void Awake() { _avatarController = GameObject.FindGameObjectWithTag("Player").GetComponent<AvatarController>(); }
void Start() { //init onTop = false; // initialising reference variables anim = gameObject.GetComponent<Animator>(); col = gameObject.GetComponent<CapsuleCollider>(); if(anim.layerCount ==2) anim.SetLayerWeight(1, 1); KinectController = GetComponent<AvatarController>(); AnimationController = GetComponent<Animator>(); rigidbody.isKinematic = false; //rigidbody.useGravity = true; //enable camera dummy follow script cameraManager = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraManager>(); //enable script //cameraManager = cameraDummyObject.GetComponent<cameraDummyFollowPlayer>(); if(cameraManager.Player1.name.Contains("Dummy")) { cameraManager.Player1 = gameObject; cameraManager.Player2 = gameObject; } else { cameraManager.Player2 = gameObject; } if(this.networkView.isMine) { CameraManager.CurrentPlayer1 = gameObject; CameraManager.CurrentPlayer1Controller = this; } //wii wiimote_start(); //sync self position //sendNodeDataToOthers(); //if client need to get server player's data if(Network.isClient){ //if this is mine if(!networkView.isMine){ Debug.Log("Set Server player's data!"); //server's player NetworkManager networkManager = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent<NetworkManager>(); gameObject.transform.position = networkManager.serverPlayerInitialPosition; gameObject.transform.rotation = networkManager.serverPlayerInitialRotation; //Debug.Log("Set Server player data! Pos:"+gameObject.transform.position); } } }
void OnEnable() { m_SELECTABLE_LAYER = (1 << LayerMask.NameToLayer("Selectable")); m_avatar = GetComponent<AvatarController>(); }
void OnEnable() { SELECTABLE_LAYER = (1 << LayerMask.NameToLayer("Selectable")); m_Avatar = GetComponent<AvatarController>(); m_SoundComplexityManager = GetComponent<SoundComplexityManager>(); }
void OnEnable() { m_Avatar = gameObject.GetComponent<AvatarController>(); m_AudioSource = gameObject.GetComponent<AudioSource>(); }
void Awake() { _controller = transform.parent.GetComponent<AvatarController>(); _controller.Outch += PlaySound; }
void Awake() { _container = GameObject.FindGameObjectWithTag("GameManager").GetComponent<ElementsContainer>(); _avatarController = GetComponent<AvatarController>(); State = States.WAITING; _avatarController.Outch += Hit; }