/// <summary> /// Make sure you start the network with no errors. /// </summary> /// <param name="MotionController">controller</param> /// @code ///public static void StartTheNetwork(MotionController controller) ///{ /// // Initialize the Network /// if (controller.NetworkStateGet() != RSINetworkState.RSINetworkStateOPERATIONAL) // Check if network is started already. /// { /// Console.WriteLine("Starting Network.."); /// controller.NetworkStart(); // If not. Initialize The Network. (This can also be done from RapidSetup Tool) /// } /// /// if (controller.NetworkStateGet() != RSINetworkState.RSINetworkStateOPERATIONAL) // Check if network is started again. /// { /// int messagesToRead = controller.NetworkLogMessageCountGet(); // Some kind of error starting the network, read the network log messages /// /// for (int i = 0; i < messagesToRead; i++) /// { /// Console.WriteLine(controller.NetworkLogMessageGet(i)); // Print all the messages to help figure out the problem /// } /// Console.WriteLine("Expected OPERATIONAL state but the network did not get there."); /// //throw new RsiError(); // Uncomment if you want your application to exit when the network isn't operational. (Comment when using phantom axis) /// } /// else // Else, of network is operational. /// { /// Console.WriteLine("Network Started"); /// } ///} /// @endcode /// @see HelperFunctions public static void StartTheNetwork(MotionController controller) { // Initialize the Network if (controller.NetworkStateGet() != RSINetworkState.RSINetworkStateOPERATIONAL) // Check if network is started already. { Console.WriteLine("Starting Network.."); controller.NetworkStart(); // If not. Initialize The Network. (This can also be done from RapidSetup Tool) } if (controller.NetworkStateGet() != RSINetworkState.RSINetworkStateOPERATIONAL) // Check if network is started again. { int messagesToRead = controller.NetworkLogMessageCountGet(); // Some kind of error starting the network, read the network log messages for (int i = 0; i < messagesToRead; i++) { Console.WriteLine(controller.NetworkLogMessageGet(i)); // Print all the messages to help figure out the problem } Console.WriteLine("Expected OPERATIONAL state but the network did not get there."); //throw new RsiError(); // Uncomment if you want your application to exit when the network isn't operational. (Comment when using phantom axis) } else // Else, of network is operational. { Console.WriteLine("Network Started"); } }
protected virtual void Awake() { mNavMeshAgent = GetComponent <NavMeshAgent>(); mMotionController = GetComponent <MotionController>(); mCombatant = GetComponent <Combatant>(); mBasicInventory = GetComponent <BasicInventory>(); }
/// <summary> /// Create and configure the NPC combatant HUD. Right now, only uses a HUD drawn in World Space (attached to the character) /// </summary> /// <param name="rMotionController"></param> protected virtual void SetupCombatantHUD(MotionController rMotionController) { //bool lIsWorldSpacePrefab = false; //if (CombatantHealthBarPrefab != null) //{ // lIsWorldSpacePrefab = CombatantHealthBarPrefab.DisplayInWorldSpace; //} //// If the HUD is set up to display in world space, then we just need to ensure an instance is attached to the character //if (!lIsWorldSpacePrefab) return; // Check to see if the current character GameObject already has a HUD attached BasicCombatantHUD lCombatantHUD = rMotionController.GetComponentInChildren <BasicCombatantHUD>(); // Instantiate the HUD prefab if it wasn't found if (lCombatantHUD == null) { lCombatantHUD = Instantiate(CombatantHealthBarPrefab); lCombatantHUD.name = "Combatant HUD"; lCombatantHUD.transform.SetParent(rMotionController.gameObject.transform); lCombatantHUD.transform.Reset(); lCombatantHUD.transform.position = new Vector3(0, WorldSpaceHUDPosition, 0); } // Set up the HUD for this character lCombatantHUD.UsePlayer = false; lCombatantHUD.BasicAttributes = rMotionController.GetComponent <BasicAttributes>(); lCombatantHUD.HealthKey = "Health"; // TODO: allow AI characters to share a single instance of a HUD; we would reassign the HUD to an AI character // when the player's targeted Combatant changes. }
/// <summary> /// Once the objects are instanciated, awake is called before start. Use it /// to setup references to other objects /// </summary> protected void Start() { _Transform = transform; ActorStances = _ActorStances; mActorController = gameObject.GetComponent <ActorController>(); mMotionController = gameObject.GetComponent <MotionController>(); if (mMotionController != null) { mInputSource = mMotionController._InputSource; } // Register this combatant with the camera if (mMotionController != null && mMotionController.CameraRig is BaseCameraRig) { ((BaseCameraRig)mMotionController.CameraRig).OnPostLateUpdate -= OnCameraUpdated; ((BaseCameraRig)mMotionController.CameraRig).OnPostLateUpdate += OnCameraUpdated; } if (ShowDebug) { CombatManager.ShowDebug = true; } }
/// <summary> /// Arranges event subscriptions, but starts neither of the polling mechanisms /// </summary> public OrderManager(WebClient client, OrderRetriever retriever, MotionController mover) { m_mover = mover; m_client = client; m_externalOrders = new List <Order>(); m_internalOrders = new List <Order>(); m_nextOrder = null; m_panel = Elevator.GetPanel(); m_serlzr = new LogWriter("elev_log"); m_internalOrders.AddRange(m_serlzr.GetOrderData()); foreach (Order ord in m_internalOrders) { m_panel.ButtonLamp[Button.Command, ord.destFloor] = true; } UpdateNextOrder(); client.ConnectionLost += Client_ConnectionLost; client.OrderReceived += Client_OrderReceived; client.ToServeReceived += Client_ToServeReceived; client.ServedReceived += Client_ServedReceived; mover.PassedByFloor += Mover_PassedByFloor; mover.EmergencyStopped += Mover_EmergencyStopped; mover.ArrivedAtFloor += Mover_ArrivedAtFloor; retriever.ExternOrderReceived += Retriever_ExternOrderReceived; retriever.InternOrderReceived += Retriever_InternOrderReceived; retriever.StopTriggered += Retriever_StopTriggered; Console.WriteLine("Order manager initilized successfully"); }
/// <summary> /// Create and configure the Combatant component on the character /// </summary> /// <param name="rMotionController"></param> /// <param name="rMaxLockDistance"></param> /// <param name="rIsPlayer"></param> /// <returns></returns> public static ICombatant CreateCombatant(MotionController rMotionController, float rMaxLockDistance, bool rIsPlayer) { ICombatant lCombatant = rMotionController.GetComponent <ICombatant>(); if (lCombatant == null) { Type lType = AssemblyHelper.ResolveType("com.ootii.Actors.Combat.Combatant, " + AssemblyHelper.AssemblyInfo); if (lType == null) { return(null); } lCombatant = (ICombatant)rMotionController.gameObject.AddComponent(lType); if (lCombatant == null) { return(null); } } lCombatant.ForceActorRotation = rIsPlayer; ReflectionHelper.SetProperty(lCombatant, "IsLockingEnabled", true); ReflectionHelper.SetProperty(lCombatant, "ForceCameraRotation", rIsPlayer); ReflectionHelper.SetProperty(lCombatant, "MaxLockDistance", rMaxLockDistance); if (rIsPlayer) { ReflectionHelper.SetProperty(lCombatant, "TargetLockedIcon", AssetDatabase.LoadAssetAtPath <Texture>(DefaultPaths.FrameworkContent + "Textures/UI/TargetIcon_2.png")); } return(lCombatant); }
public void Init() { mr = player.GetComponentInChildren <SkinnedMeshRenderer>(); originalMaterial = mr.sharedMaterial; player.GetComponent <AttrController>().Death += Death; mc = player.GetComponent <MotionController>(); }
/// <summary> /// Coroutine to play the death animation and disable the actor after a couple of seconds /// </summary> /// <param name="rDamageValue">Amount of damage to take</param> /// <param name="rDamageType">Damage type taken</param> /// <param name="rAttackAngle">Angle that the damage came from releative to the actor's forward</param> /// <param name="rBone">Transform that the damage it... if known</param> /// <returns></returns> protected virtual IEnumerator InternalDeath(float rDamageValue = 0, int rDamageType = 0, float rAttackAngle = 0f, Transform rBone = null) { MotionController lMC = gameObject.GetComponent <MotionController>(); if (lMC != null) { // Wait for any transition to finish while (lMC.ActiveMotion != null && lMC.ActiveMotion.MotionLayer.AnimatorTransitionID != 0) { yield return(null); } // Trigger the death animation lMC.ActivateMotion(DeathMotion, (int)rAttackAngle); yield return(new WaitForSeconds(3.5f)); // Shut down the MC lMC.enabled = false; lMC.ActorController.enabled = false; Collider[] lColliders = gameObject.GetComponents <Collider>(); for (int i = 0; i < lColliders.Length; i++) { lColliders[i].enabled = false; } } }
/// <summary> /// Called when the reactor is first activated /// </summary> /// <returns>Determines if other reactors should process.</returns> public override bool Activate() { base.Activate(); // Send the attack to the motion controller to see if any of the motions can handle it MotionController lMotionController = mActorCore.gameObject.GetComponent <MotionController>(); // First send to any active motions. They have priority for handling. for (int i = 0; i < lMotionController.MotionLayers.Count; i++) { if (lMotionController.MotionLayers[i].ActiveMotion != null) { lMotionController.MotionLayers[i].ActiveMotion.OnMessageReceived(mMessage); if (mMessage.IsHandled) { break; } } } // If unhandled, send to all motions to see if one should handle it. if (!_LimitToActiveMotions && !mMessage.IsHandled) { lMotionController.SendMessage(mMessage); } // Disable the reactor Deactivate(); // Allow other reactors to continue return(true); }
/// <summary> /// Capture Unity's collision event. We use triggers since IsKinematic Rigidbodies don't /// raise collisions... only triggers. /// </summary> protected virtual void OnTriggerEnter(Collider rCollider) { if (rCollider == null) { return; } // Record the collider if (!mTriggeredList.Contains(rCollider)) { mTriggeredList.Add(rCollider); // Set the interactable core on the motion if needed if (!_UseRaycast) { MotionController lMC = rCollider.gameObject.GetComponent <MotionController>(); if (lMC != null) { BasicInteraction lInteractionMotion = lMC.GetMotion <BasicInteraction>(); if (lInteractionMotion != null && !lInteractionMotion.IsActive) { lInteractionMotion.InteractableCore = this; } } } } }
public override void BeginExecution(Entity stateEntity, ActionContext action, Otto actor) { base.BeginExecution(stateEntity, action, actor); // Trigger beginning of walk animation. m_Animator = actor.GetComponentInParent <Animator>(); m_Animator.SetBool(k_Walk, true); m_TargetPosition = action.GetTrait <Location>(1).Position; m_OttoTransform = actor.transform; // Grab nav mesh m_NavMeshAgent = actor.GetComponentInParent <NavMeshAgent>(); // Motion Controller m_MotionController = actor.GetComponentInParent <MotionController>(); m_MotionController.TargetPosition = m_TargetPosition; m_MotionController.StartMoving(); SetAnimationParams(); m_Arrived = false; var startPosition = action.GetTrait <Location>(0).Position; var distance = Vector3.Distance(startPosition, m_TargetPosition); m_PredictedDeltaTime = Mathf.FloorToInt(distance / 0.47f + 1f); }
/// <summary> /// Create the Input Manager Settings for each Motion assigned to the Motion Controller instance /// </summary> /// <param name="rMotionController"></param> public static void CreateDefaultInputSettings(MotionController rMotionController) { CreateInputSetting("Change Stance", "t"); CreateInputSetting("Run", "left shift"); CreateInputSetting("Interact", "f"); CreateInputSetting("Cover Toggle", "m"); CreateInputSetting("ActivateRotation", 0); #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX CreateAxisInputSetting("Run", 5); CreateAxisInputSetting("ActivateRotation", 3); #else CreateAxisInputSetting("Run", 9); CreateAxisInputSetting("ActivateRotation", 4); #endif if (rMotionController == null || rMotionController.MotionLayers == null) { return; } foreach (MotionControllerMotion lMotion in rMotionController.MotionLayers.SelectMany(lMotionLayer => lMotionLayer.Motions)) { lMotion.CreateInputManagerSettings(); } }
/// <summary> /// Activates the motion on the specified target /// </summary> /// <param name="rTarget">GameObject to activate the motion on</param> /// <returns>Bool that determines if the motion was activated</returns> public bool ActivateInstance(GameObject rTarget) { bool lIsActivated = false; // Check if we have a motion controller and activate the motion MotionController lMotionController = rTarget.GetComponent <MotionController>(); if (lMotionController != null) { mMotion = lMotionController.ActivateMotion(MotionName); if (mMotion != null) { lIsActivated = true; // Clear out any event first, then add our event if (TargetTypeIndex == 0 || TargetTypeIndex == 1) { mMotion.OnDeactivatedEvent -= OnMotionDeactivated; mMotion.OnDeactivatedEvent += OnMotionDeactivated; } } // Grab the state as needed if (ExitState.Length > 0) { mExitStateID = lMotionController.AddAnimatorName(ExitState); } } return(lIsActivated); }
/// <summary> /// Used for initialization before any Start or Updates are called /// </summary> protected void Awake() { // Grab our transform _Transform = gameObject.transform; // Hold onto the actor controller so we can tap into it mActorController = gameObject.GetComponent <ActorController>(); if (this.enabled) { OnEnable(); } // Hold onto the motion controller mMotionController = gameObject.GetComponent <MotionController>(); // Grab the nav mesh agent mNavMeshAgent = gameObject.GetComponent <NavMeshAgent>(); // We don't want the agent updating our position and rotation. That's // what the MC will do. We just want the path info if (mNavMeshAgent != null) { mNavMeshAgent.updatePosition = false; mNavMeshAgent.updateRotation = false; } // Default the speed we'll use to rotate mViewSpeedPer60FPSTick = _MaxViewSpeed * 60f; }
void Awake() { m_MotionController = GetComponent <MotionController>(); m_InventoryPlayer = GetComponent <InventoryPlayer>(); // Initialise speed overrides speedOverrides = new DataOverride[m_SpeedData.Length]; for (int i = 0; i < speedOverrides.Length; ++i) { speedOverrides[i] = new DataOverride { name = m_SpeedData[i] } } ; // Initialise strength overrides strengthOverrides = new DataOverride[m_StrengthData.Length]; for (int i = 0; i < strengthOverrides.Length; ++i) { strengthOverrides[i] = new DataOverride { name = m_StrengthData[i] } } ; } IEnumerator Start() { yield return(null); m_SpeedStat = m_InventoryPlayer.stats.Get(m_SpeedStatCategory, m_SpeedStatName); m_StrengthStat = m_InventoryPlayer.stats.Get(m_StrengthStatCategory, m_StrengthStatName); m_MotionController.motionGraph.ApplyDataOverrides(this); }
static void Main(string[] args) { var mapManager = new MapManager(ConfigurationManager.AppSettings["pathToMapDirectory"], ConfigurationManager.AppSettings["pathToMapFile"]); var map = new ConsoleMap(int.Parse(ConfigurationManager.AppSettings["widthField"]), int.Parse(ConfigurationManager.AppSettings["heightField"]), int.Parse(ConfigurationManager.AppSettings["timeToBoom"])); var Bomber = new Model.Bomber(int.Parse(ConfigurationManager.AppSettings["liveCount"]), map.FirstPositionBomber); map.Load(mapManager.GetFirstMap()); map.SetUpgradeOnMap(10, 10, 10); var displayConsole = new ConsoleDisplay(map); var gamepadConsole = new ConsoleGamePad(); Console.CursorVisible = false; Task.Run(() => gamepadConsole.Start()); var mC = new MotionController(displayConsole, gamepadConsole, map, Bomber, mapManager); mC.SetPositionForPerson(4, 2); mC.SetPositionForPerson(3, 2); mC.SetPositionForPerson(2, 1); displayConsole.DrawMap(); // mC.SetPositionForPerson(3, 3); displayConsole.ShowLive(Bomber.LiveCount); Console.WindowLeft = 0; Console.WindowTop = 0; mC.Start(); // Console.ReadKey(); }
public GameplaySceneBase(string sceneID) : base(sceneID) { _inputProcessor = Input.TouchControls.CreateController(); _motionController = new MotionController(); _animationController = new AnimationController(); _timerController = new TimerController(); _pauseController = new PauseController(); _pauseController.AddPausableObject(_timerController); _pauseController.AddPausableObject(_animationController); _cameraController = new Bopscotch.Gameplay.Controllers.PlayerTrackingCameraController(); _cameraController.Viewport = new Rectangle(0, 0, Definitions.Back_Buffer_Width, Definitions.Back_Buffer_Height); _cameraController.ScrollBoundaryViewportFractions = new Vector2(Definitions.Horizontal_Scroll_Boundary_Fraction, Definitions.Vertical_Scroll_Boundary_Fraction); Renderer.ClipOffCameraRendering(_cameraController, Camera_Clipping_Margin); _playerCollisionController = new OneToManyCollisionController(); _opaqueParticleEffectManager = new OpaqueLayerParticleEffectManager(_cameraController); _additiveParticleEffectManager = new AdditiveLayerParticleEffectManager(_cameraController); _levelFactory = new Bopscotch.Gameplay.LevelFactory(RegisterGameObject, _timerController.RegisterUpdateCallback); _smashBlockItemFactory = new Effects.SmashBlockItems.SmashBlockItemFactory(RegisterGameObject, _timerController.RegisterUpdateCallback); _speedometer = new Bopscotch.Gameplay.Objects.Display.Speedometer(); _playerEventPopup = new Bopscotch.Gameplay.Objects.Display.PlayerEventPopup(); _objectWithGlowEffect = new List <ICanHaveGlowEffect>(); }
/// <summary> /// Step 2: Add and configure scene UI objects. Currently, this should only be run when /// configuring the player /// </summary> /// <param name="rMotionController"></param> protected virtual void SetupSceneUI(MotionController rMotionController) { string lProgressTitle = "Configuring Scene Objects (Step 2 of 6)"; float lProgressAmount = 2f / 6f; EditorUtility.DisplayProgressBar(lProgressTitle, "Base scene objects", lProgressAmount); GameObject lUIContainer = UISetupHelper.GetUIContainer(); if (lUIContainer == null) { return; } if (UseReticle && ReticlePrefab != null) { Reticle lReticle = FindObjectOfType <Reticle>(); if (lReticle == null) { lReticle = Instantiate(ReticlePrefab); lReticle.name = ReticlePrefab.name; lReticle.transform.SetParent(lUIContainer.transform); lReticle.transform.Reset(); } lReticle.IsVisible = ReticleStartVisible; } if (UsePlayerHUD) { Canvas lSceneCanvas = lUIContainer.GetComponentInChildren <Canvas>(); SetupPlayerHUD(rMotionController, lSceneCanvas); } }
/// <summary> /// Create and configure the Player health bar HUD /// </summary> /// <param name="rMotionController"></param> /// <param name="rSceneCanvas"></param> protected virtual void SetupPlayerHUD(MotionController rMotionController, Canvas rSceneCanvas) { // We want a single Player HUD in the scene, so attempt to find a HUD that is not set to World Space List <BasicCombatantHUD> lHUDs = FindObjectsOfType <BasicCombatantHUD>().ToList(); BasicCombatantHUD lPlayerHUD = null; if (lHUDs != null) { lPlayerHUD = lHUDs.FirstOrDefault(x => !x.DisplayInWorldSpace); } if (lPlayerHUD != null) { lPlayerHUD.UsePlayer = true; lPlayerHUD.BasicAttributes = rMotionController.GetComponent <BasicAttributes>(); lPlayerHUD.HealthKey = "Health"; lPlayerHUD.HideWhenFull = PlayerHealthBarHideWhenFull; } else { lPlayerHUD = Instantiate(PlayerHealthBarPrefab); lPlayerHUD.name = "Player HUD"; lPlayerHUD.transform.SetParent(rSceneCanvas.transform); lPlayerHUD.transform.ResetRect(); } }
//SDO Method static void CapturePositionOnFallingEdgeOfSI6(MotionController controller, Axis axis) { //Here we are assuming that you still have Touch Probe Status as PDO entries. They can be set and read using SDO in similiar fashion if that isn't the case. const int TOUCH_PROBE_OUTPUT_INDEX = 3; //NetworkOutput #3 - Touch Probe Function const int TOUCH_PROBE_STATUS_INDEX = 6; //NetworkInput #6 - Touch Probe Status const int TOUCH_PROBE_2_FALLING_EDGE_VALUE_INDEX = 0x60BD; const int TOUCH_PROBE_2_FALLING_EDGE_VALUE_SUB_INDEX = 0x0; const int TOUCH_PROBE_2_FALLING_EDGE_VALUE_SIZE = 0x4; //We want to Enable the Touch Probe 2 (Bit 8 to 1), Set to First Event (Bit 9 to 0), Set to EXT2 (Bit 10 to 0), and Sample the negative Edge (Bit 13 to 1) //Our Touch Probe Function should be binary xx1x x001 xxxx xxxx -or- 0x2100 //Note if you are making use of Touch Probe 1, some of the above bits will become significant const ulong TOUCH_PROBE_2_ON_FIRST_FALLING_EXT2_COMMAND = 0x2100; //Enable controller.NetworkOutputValueSet(TOUCH_PROBE_OUTPUT_INDEX, TOUCH_PROBE_2_ON_FIRST_FALLING_EXT2_COMMAND); //Evaluate ulong currentStatus = controller.NetworkInputValueGet(TOUCH_PROBE_STATUS_INDEX); //See above Touch Probe Status Section for details. Maybe be useful for your diagnostics and assurance that it is ok to use the next value. //After you've observed currentStatus Bit 10 go high, you know the following value is useful. int fallingEdgeExt2 = axis.NetworkNode.ServiceChannelRead(TOUCH_PROBE_2_FALLING_EDGE_VALUE_INDEX, TOUCH_PROBE_2_FALLING_EDGE_VALUE_SUB_INDEX, TOUCH_PROBE_2_FALLING_EDGE_VALUE_SIZE); }
/// <summary> /// Controller constructor /// </summary> /// <param name="rController">Controller the motion belongs to</param> public AdventureForward(MotionController rController) : base(rController) { _Priority = 1; mIsStartable = true; //mIsGroundedExpected = true; }
/// <summary> /// Called when the actor takes damage. This allows the actor to respond. /// Damage Type 0 = Physical melee /// Damage Type 1 = Physical ranged /// </summary> /// <param name="rDamageValue">Amount of damage to take</param> /// <param name="rDamageType">Damage type taken</param> /// <param name="rAttackAngle">Angle that the damage came from releative to the actor's forward</param> /// <returns>Determines if the damage was applied</returns> public virtual bool OnDamaged(float rDamageValue, int rDamageType = 0, float rAttackAngle = 0f, Transform rBone = null) { if (!IsAlive) { return(true); } float lRemainingHealth = 0f; if (AttributeSource != null) { lRemainingHealth = AttributeSource.GetAttributeValue(HealthID) - rDamageValue; AttributeSource.SetAttributeValue(HealthID, lRemainingHealth); } if (lRemainingHealth <= 0f) { OnDeath(rDamageValue, rDamageType, rAttackAngle, rBone); } else { MotionController lMC = gameObject.GetComponent <MotionController>(); if (lMC != null) { lMC.ActivateMotion(DamagedMotion, (int)rAttackAngle); } } return(true); }
/// <summary> /// New way to create sub-state machines without destroying what exists first. /// </summary> protected override void CreateStateMachine() { int rLayerIndex = mMotionLayer._AnimatorLayerIndex; MotionController rMotionController = mMotionController; UnityEditor.Animations.AnimatorController lController = null; Animator lAnimator = rMotionController.Animator; if (lAnimator == null) { lAnimator = rMotionController.gameObject.GetComponent <Animator>(); } if (lAnimator != null) { lController = lAnimator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController; } if (lController == null) { return; } while (lController.layers.Length <= rLayerIndex) { UnityEditor.Animations.AnimatorControllerLayer lNewLayer = new UnityEditor.Animations.AnimatorControllerLayer(); lNewLayer.name = "Layer " + (lController.layers.Length + 1); lNewLayer.stateMachine = new UnityEditor.Animations.AnimatorStateMachine(); lController.AddLayer(lNewLayer); } UnityEditor.Animations.AnimatorControllerLayer lLayer = lController.layers[rLayerIndex]; UnityEditor.Animations.AnimatorStateMachine lLayerStateMachine = lLayer.stateMachine; UnityEditor.Animations.AnimatorStateMachine lSSM_37928 = MotionControllerMotion.EditorFindSSM(lLayerStateMachine, "BasicEquipStore-SM"); if (lSSM_37928 == null) { lSSM_37928 = lLayerStateMachine.AddStateMachine("BasicEquipStore-SM", new Vector3(192, -1008, 0)); } #if USE_ARCHERY_MP || OOTII_AYMP ArcheryPackDefinition.ExtendBasicEquipStore(rMotionController, rLayerIndex); #endif #if USE_SWORD_SHIELD_MP || OOTII_SSMP SwordShieldPackDefinition.ExtendBasicEquipStore(rMotionController, rLayerIndex); #endif #if USE_SPELL_CASTING_MP || OOTII_SCMP SpellCastingPackDefinition.ExtendBasicEquipStore(rMotionController, rLayerIndex); #endif #if USE_SHOOTER_MP || OOTII_SHMP ShooterPackDefinition.ExtendBasicEquipStore(rMotionController, rLayerIndex); #endif // Run any post processing after creating the state machine OnStateMachineCreated(); }
public SinglePlayerSubScene(int backBufferWidth, int backBufferHeight) : base(backBufferWidth, backBufferHeight) { _motionController = new MotionController(); _animationController = new AnimationController(); _timerController = new TimerController(); _pauseController = new PauseController(); _pauseController.AddPausableObject(_timerController); _pauseController.AddPausableObject(_animationController); _cameraController = new Bopscotch.Gameplay.Controllers.PlayerTrackingCameraController(); _cameraController.Viewport = new Rectangle(0, 0, backBufferWidth, backBufferHeight); _cameraController.ScrollBoundaryViewportFractions = new Vector2(Definitions.Horizontal_Scroll_Boundary_Fraction, Definitions.Vertical_Scroll_Boundary_Fraction); Renderer.ClipOffCameraRendering(_cameraController, Camera_Clipping_Margin); _playerCollisionController = new OneToManyCollisionController(); _opaqueParticleEffectManager = new OpaqueLayerParticleEffectManager(_cameraController); _additiveParticleEffectManager = new AdditiveLayerParticleEffectManager(_cameraController); _levelFactory = new Bopscotch.Gameplay.LevelFactory(RegisterGameObject, _timerController.RegisterUpdateCallback); _levelFactory.BackgroundDimensions = new Point(backBufferWidth, backBufferHeight); _smashBlockItemFactory = new Effects.SmashBlockItems.SmashBlockItemFactory(RegisterGameObject, _timerController.RegisterUpdateCallback); _speedometer = new Bopscotch.Gameplay.Objects.Display.Speedometer(); _speedometer.CenterPosition = new Vector2(backBufferWidth, 0.0f); _playerEventPopup = new PlayerEventPopup(); _playerEventPopup.DisplayPosition = new Vector2(backBufferWidth / 2.0f, backBufferHeight / 4.0f); _active = false; }
public ContentSceneWithControlDialog() : base() { _motionController = new MotionController(); Overlay = new FullScreenColourOverlay(); }
static void Main(string[] args) { // Constants const int AXIS_NUMBER = 0; // Specify which axis/motor to control. // Initialize RapidCode Objects MotionController controller = MotionController.CreateFromSoftware(/*@"C:\RSI\X.X.X\"*/); // Insert the path location of the RMP.rta (usually the RapidSetup folder) SampleAppsCS.HelperFunctions.CheckErrors(controller); // [Helper Function] Check that the controller has been initialized correctly. SampleAppsCS.HelperFunctions.StartTheNetwork(controller); // [Helper Function] Initialize the network. Axis axis = controller.AxisGet(AXIS_NUMBER); // Initialize the axis. SampleAppsCS.HelperFunctions.CheckErrors(axis); // [Helper Function] Check that the axis has been initialized correctly. try { // CHECK AXIS STATE RSIState state = axis.StateGet(); // StateGet will return RSIState enum name of the current state of the Axis or MultiAxis. (Ex: RSIStateERROR) RSISource source; // Declare a RSISource variable. switch (state) { case RSIState.RSIStateIDLE: case RSIState.RSIStateMOVING: PrintState(state); break; case RSIState.RSIStateERROR: case RSIState.RSIStateSTOPPING_ERROR: case RSIState.RSIStateSTOPPED: case RSIState.RSIStateSTOPPING: source = axis.SourceGet(); // SourceGet will return the RSISource enum name of the first status bit that is active. (Ex: RSISourceAMP_FAULT) PrintState(state); PrintSource(axis, source); break; default: Console.WriteLine(""); break; } // or USE STATUS BIT GET bool isAmpFault_Active = axis.StatusBitGet(RSIEventType.RSIEventTypeAMP_FAULT); // StatusBitGet returns the state of a status bit, true or false. bool isPositionErrorLimitActive = axis.StatusBitGet(RSIEventType.RSIEventTypeLIMIT_ERROR); bool isHWNegativeLimitActive = axis.StatusBitGet(RSIEventType.RSIEventTypeLIMIT_HW_NEG); bool isHWPostiveLimitActive = axis.StatusBitGet(RSIEventType.RSIEventTypeLIMIT_HW_POS); // This can be done for all RSIEventTypes Console.WriteLine("\nPress Any Key To Exit"); // Allow time to read Console. Console.ReadKey(); } catch (Exception e) { Console.WriteLine(e.Message); // If there are any exceptions/issues this will be printed out. } }
protected override void Awake() { base.Awake(); m_MotionController = GetComponent <MotionController>(); Debug.Assert(m_MotionController != null, gameObject + " has a MotionControllerAIController but no motionController component."); m_NavMeshAgent = gameObject.GetComponentInParent <NavMeshAgent>(); }
/// <summary> /// Initialize the reactor /// </summary> public override void Awake() { if (mOwner != null) { mActorCore = mOwner.GetComponent <ActorCore>(); mMotionController = mOwner.GetComponent <MotionController>(); } }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { var gameObject = animator.gameObject; m_motionController = gameObject.GetComponent <MotionController>(); m_motionController.TargetOrientation = gameObject.transform.forward; animator.SetBool("Walk", false); }
public virtual BasicInventory CreateInventory(MotionController rMotionController) { BasicInventory lInventory = rMotionController.GetOrAddComponent <BasicInventory>(); CharacterSetupHelper.CreateStandardInventorySlots(lInventory); return(lInventory); }
public void Dispose() { if (MotionController == null) { return; } MotionController.Dispose(); MotionController = null; }
// Use this for initialization void Start() { // Se obtienen las referencias a los componentes del objeto y la cámara. objUserMotionController = objUser.GetComponent<MotionController>(); objUserTransform = objUser.GetComponent<Transform>(); thisTransform = transform; thisCamera = camera; // Se inicializa la perspectiva de la cámara cameraPersp = CameraPersp.cenital; }
void Awake() { if (!Instance) { Instance = this; } else { Debug.LogError("MotionController must be added to just only one gameobject"); } }
void Awake() { ovrCameraController = GetComponentInChildren<OVRCameraController>(); ovrCameraControllerTransform = ovrCameraController.transform; headController = GetComponent<HeadController>(); handsController = GetComponent<HandsController>(); feetController = GetComponent<FeetController>(); motionController = GetComponent<MotionController>(); swooshSound = ovrCameraControllerTransform.Find("SwooshSound").GetComponent<AudioSource>(); materialTriggers = GameObject.FindObjectsOfType( typeof (TriggerSolidColor ) ) as TriggerSolidColor[]; foreach ( CameraAnchor cameraAnchor in GameObject.FindObjectsOfType( typeof(CameraAnchor) )) characterCameraAnchorTransforms.Add( cameraAnchor.transform ); }
Transform thisTransform; // Componente Transform de la cámara #endregion Fields #region Methods // Use this for initialization void Start() { // Se obtienen las referencias a los componentes del objeto y la cámara. objMotionController = objectGUI.GetComponent<MotionController>(); thisTransform = transform; thisCamera = camera; // Situamos la cámara en función de la posición y dimensiones de los límites por donde // puede moverse el objeto, de manera que pueda enfocar todo el espacio abarcado por los límites // independientemente de las dimensiones de estos. thisTransform.position = new Vector3( objMotionController.limits.x + objMotionController.limits.width / 2.0f, 1.5f * Mathf.Max( objMotionController.limits.width, objMotionController.limits.height) / Mathf.Tan( thisCamera.fieldOfView * Mathf.Deg2Rad), objMotionController.limits.y - objMotionController.limits.height / 2.0f); }
/// <summary> /// Called when the script object is loaded /// </summary> void OnEnable() { // Grab the serialized objects mMotionController = (MotionController)target; mMotionControllerSO = new SerializedObject(target); // Load the textures mBackground = Resources.Load<Texture>("MotionController/mc_background"); mItemSelector = Resources.Load<Texture>("MotionController/mc_dot"); mItemBorder = Resources.Load<Texture>("MotionController/Border"); // Grab the list of motion types mControllerMotionTypes.Clear(); mControllerMotionNames.Clear(); // Styles for selected rows mRowStyle = new GUIStyle(); mRowStyle.border = new RectOffset(1, 1, 1, 1); mRowStyle.margin = new RectOffset(0, 0, 0, 0); mRowStyle.padding = new RectOffset(0, 0, 0, 0); mSelectedRowStyle = new GUIStyle(); mSelectedRowStyle.normal.background = (Texture2D)mItemBorder; mSelectedRowStyle.border = new RectOffset(1, 1, 1, 1); mSelectedRowStyle.margin = new RectOffset(0, 0, 0, 0); mSelectedRowStyle.padding = new RectOffset(0, 0, 0, 0); // Dropdown values mControllerMotionTypes.Add(null); mControllerMotionNames.Add("Select Motion"); // Generate the list of motions to display Assembly lAssembly = Assembly.GetAssembly(typeof(MotionController)); foreach (Type lType in lAssembly.GetTypes()) { if (typeof(MotionControllerMotion).IsAssignableFrom(lType)) { if (lType != typeof(MotionControllerMotion)) { mControllerMotionTypes.Add(lType); mControllerMotionNames.Add(lType.Name); } } } // List of general motion properties mBaseProperties = typeof(MotionControllerMotion).GetProperties(); }
/// <summary> /// Called right before the first frame update /// </summary> void Start() { mActiveTarget = Target1; mController = GetComponent<MotionController>(); }
// Use this for initialization void Start() { instance = this; mAction = Actions.IDLE; lastPosR = Vector2.zero; lastPosL = Vector2.zero; prevAngle = Vector2.zero; lastFramePos = frame.transform.position; }
public void Reload() { string path = "Assets/Resources/_LevelData.asset"; savedMotions = (_LevelData)AssetDatabase.LoadAssetAtPath(path, typeof(_LevelData)); motionController = (MotionController)target; motionController.Clear(); if (motionController.selectionIndex > 0 && motionController.selectionIndex < savedMotions.motions.Count) { motionController.Load(savedMotions.motions[motionController.selectionIndex-1]); minFrame = 1; maxFrame = motionController.frames.Count - 1; } else { motionController.selectionIndex = 0; } motionNames = new string[savedMotions.motions.Count + 1]; motionNames[0] = "[Select a Motion]"; for (int i = 0; i < savedMotions.motions.Count; i++) { motionNames[i+1] = savedMotions.motions[i].name; } }
void Start() { // Se obtienen las referencias a los componentes del objeto. objMotionController = objectGUI.GetComponent<MotionController>(); objStatus = objectGUI.GetComponent<Status>(); // Relación de aspecto entre la resolución de pantalla real y las resolución de referencia. vGUIScale = new Vector3( Screen.width / (iWidthScreen * 1.0f), Screen.height / (iHeightScreen * 1.0f), 1); }
void Start() { // Se obtienen las referencias a los componentes del objeto. objUserMotionController = objUser.GetComponent<MotionController>(); objAIMotionController = objAI.GetComponent<MotionController>(); objAIStatus = objAI.GetComponent<Status>(); objUsrAttack = objUser.GetComponent<Attack>(); // Referencias a los componentes de la cámara cameraMotion = GetComponent<CameraMotion>(); // Relación de aspecto entre la resolución de pantalla real y las resolución de referencia. vGUIScale = new Vector3( Screen.width / (iWidthScreen * 1.0f), Screen.height / (iHeightScreen * 1.0f), 1); }
public InputHandler() { KeyboardInput = new KeyboardInput(); MotionController = new MotionController(); }
void Start() { // Se obtienen las referencias a los componentes del objeto. objUserMotionController = objUser.GetComponent<MotionController>(); objAIMotionController = objAI.GetComponent<MotionController>(); objAIStatus = objAI.GetComponent<Status>(); objUsrAttack = objUser.GetComponent<Attack>(); // Referencias a los componentes de la cámara cameraMotion = GetComponent<CameraMotion>(); // Relación de aspecto entre la resolución de pantalla real y las resolución de referencia. vGUIScale = new Vector3( Screen.width / (iWidthScreen * 1.0f), Screen.height / (iHeightScreen * 1.0f), 1); bEndGame = false; fEndTime = 0.0f; if (PlayerPrefs.HasKey( sGamesWon) == false) // Se inicializa el número de partidas ganadas. PlayerPrefs.SetInt( sGamesWon, 0); }
/// <summary> /// Called right before the first frame update /// </summary> void Start() { mController = GetComponent<MotionController>(); }
public MotionController motionController; // Referencia al script controlador del movimiento #endregion Fields #region Methods // Use this for initialization void Start() { // Si no se ha asignado ningún script que seguir, se asigna el script del objeto actual. if (motionController == null) motionController = gameObject.GetComponent<MotionController>(); }