public void clean_battery4_throwNotEnoughBattery() { IMotionControl procNoBat = new MotionControl(4); Assert.Catch <NotEnoughBatteryException>( () => procNoBat.clean()); }
public void turnLeft_battery0_throwOutOfBattery() { IMotionControl procNoBat = new MotionControl(0); Assert.Catch <OutOfBatteryException>( () => procNoBat.turnLeft()); }
public void clean_battery0_throwOutOfBattery() { IMotionControl procNoBat = new MotionControl(0); Assert.Catch <OutOfBatteryException>( () => procNoBat.clean()); }
public void advance_battery1_throwNotEnoughBattery() { IMotionControl procNoBat = new MotionControl(0); Assert.Catch <NotEnoughBatteryException>( () => procNoBat.advance()); }
public void back_battery0_throwNotEnoughBattery() { IMotionControl procNoBat = new MotionControl(2); Assert.Catch <NotEnoughBatteryException>( () => procNoBat.back()); }
/* ---------------- Functions ---------------------------------- */ /* ---------------- System Functions --------------------------- */ // Initalizes everything once. void OnEnable() { move = GetComponent <MotionControl>(); // Initialize Arrays startPose = new Quaternion[ragdollBones.Length]; stopPose = new Quaternion[ragdollBones.Length]; // Collect Collider Components playColliders = this.GetComponents <Collider> (); ragdollColliders = ragdoll.GetComponentsInChildren <Collider> (); // Collect Ragdoll Joint Components and Data playJoints = ragdoll.GetComponentsInChildren <CharacterJoint> (); playJointLimitStats = new float[playJoints.Length, 4]; for (int i = 0; i < playJoints.Length; i++) { playJointLimitStats[i, 0] = playJoints[i].highTwistLimit.limit; playJointLimitStats[i, 1] = playJoints[i].lowTwistLimit.limit; playJointLimitStats[i, 2] = playJoints[i].swing1Limit.limit; playJointLimitStats[i, 3] = playJoints[i].swing2Limit.limit; } // Ensure Dino Prefab settings ready to race. setBoneMass(); ResetRacer(); }
// Start is called before the first frame update void Start() { //create a copy of the monster's moving body parts and set them as a parents of the monster's shadow body = Instantiate(bones, transform.position, Quaternion.identity); body.transform.SetParent(transform, false); body.transform.localPosition = new Vector3(0f, 0f, 0f); //body.transform.SetParent(transform, true); //body.transform.localPosition = new Vector3(0f, 0f, 0f); //body.transform.position = new Vector3(0f, 0f, 0f); //body.transform.rotation = new Quaternion(0f, 0f, 180f, 0f); //body.transform.rotation = new Quaternion(0f, 0f, 0f, 0f); //body.transform.position = new Vector2(body.transform.position.x, GetComponentInParent<Monster>().specs.legs[0].transform.position.y - gameObject.GetComponentInParent<Monster>().GetComponent<RectTransform>().rect.height); //body.transform.position = new Vector2(transform.position.x, transform.position.y - gameObject.GetComponentInParent<Monster>().GetComponent<RectTransform>().rect.height /2); //transform.position = new Vector2(transform.position.x + 2, transform.position.y - gameObject.GetComponentInParent<Monster>().GetComponent<RectTransform>().rect.height); //body.GetComponent<Puppet2D_GlobalControl>().flip = true; //give all of the shadow parts a material that looks like a shadow foreach (GameObject part in body.GetComponent <MeshBodyParts>().bodyMeshes) { shadowParts.Add(part); part.GetComponent <Renderer>().material = shadowMaterial; part.GetComponent <Renderer>().sortingOrder -= 5; } //set the shadow's animator to match the main body's animator shadowAnimator = GetComponentInParent <Monster>().monsterMotion; shadowMotion = bones.GetComponent <MotionControl>(); body.GetComponent <MotionControl>().monsterAnimator = shadowAnimator; StartCoroutine(ShadowAnimate()); }
public static ProcessingControl createRobot(InputData id) { OpMap map = new OpMap(id.map, id.start.facing, id.start.X, id.start.Y); IMotionControl motCtrl = new MotionControl(id.battery); return(new ProcessingControl(motCtrl, map)); }
void OnEnable() { // dinoSelection = GetComponent<DinoSelect>(); move = GetComponent<MotionControl>(); // // switch(dinoSelection.dinosaurs[dinoSelection.Index].name) // { // case "Diloph": // ragdoll = Ragdolls[0]; // break; // case "Hesp": // ragdoll = Ragdolls[1]; // break; // case "Raptor": // ragdoll = Ragdolls[2]; // break; // case "TRex": // ragdoll = Ragdolls[3]; // break; // case "Troodon": // ragdoll = Ragdolls[4]; // break; // default: // ragdoll = new GameObject(); // break; // } }
private void TurnOffCheating() { isCheating = false; MotionControl mc = GetComponent <MotionControl>(); mc.AIDecreaseAcceleration(bridgeAcceleration); mc.AIDecreaseTopSpeed(bridgeTopSpeed); }
void OnEnable() { move = GetComponent <MotionControl>(); ragdoll = GetComponent <DinoRagdoll> (); inv = GetComponent <Inventory>(); melee = GetComponent <MeleeAttack> (); bomb = GetComponent <Bomb> (); AttackCooldownElasped = 0.0f; }
// Update is called once per frame void Update() { Resize(this.gameObject.guiTexture, buttonPos); if(player == null) { players = GameObject.FindGameObjectsWithTag("Dino"); foreach (var unit in players) { if (unit.networkView.isMine) { player = unit; break; } } //assign the motion script to the variable if(player.GetComponent<MotionControl>()) { mControl = player.GetComponent<MotionControl>(); } } if(Input.touches.Length > 0) { //loop through the touches for(int i = 0; i < Input.touchCount; i++) { //do this for the current touch on the screen if(this.guiTexture.HitTest(Input.GetTouch(i).position)) { //if it is hit if(Input.GetTouch(i).phase == TouchPhase.Began) { mControl.Jump(); } } } } else if(Input.GetMouseButtonDown(0) && guiTexture.HitTest(Input.mousePosition)) { mControl.Jump(); } }
void Enabled() { if (networkView.isMine) { mc = GetComponent <MotionControl>(); inv = GetComponent <Inventory>(); //melee = GetComponent<MeleeAttack>(); bomb = GetComponent <Bomb>(); health = GetComponent <Health>(); current = GameObject.Find(FirstNavNode).GetComponent <RespawnNode>(); current = current.nextNodes[0]; Debug.Log("AI Current Target: " + current.name); StartCoroutine(AITick()); } }
/// <summary> /// Applies a damage over time effect to target, while also snaring target for a short duration /// </summary> /// <param name="target">The target game object (shoudl be one of the dino racers)</param> /// <returns></returns> IEnumerator acidSpitDotAndSnare(GameObject target) { var statFX = target.GetComponent <DinoStatusEffects>(); statFX.ApplyEffect(StatusEffectType.Acid, snareDuration); float elapsedTime = 0.0f; float dotTick = damage / dotDuration; Health health = target.GetComponent <Health>(); MotionControl control = target.GetComponent <MotionControl>(); control.TopSpeedMod(snareMagnitude, snareDuration); while (elapsedTime < dotDuration) { yield return(new WaitForSeconds(1.0f)); elapsedTime += 1.0f; health.Damage(dotTick); } }
// Update is called once per frame void FixedUpdate() { //call the resize function for both arrows Resize(leftArrow, leftArrowPos); Resize(rightArrow, rightArrowPos); if(player == null) { players = GameObject.FindGameObjectsWithTag("Dino"); foreach (var unit in players) { if (unit.networkView.isMine) { player = unit; break; } } //assign the motion script to the variable if(player.GetComponent<MotionControl>()) { motionConScript = player.GetComponent<MotionControl>(); } } if(player != null) { if(Input.touches.Length > 0) { //loop through the touches for(int i = 0; i < Input.touchCount; i++) { //do this for the current touch on the screen if(leftArrow.HitTest(Input.GetTouch(i).position)) { //if it is hit if(Input.GetTouch(i).phase == TouchPhase.Stationary) { currentTurn = Mathf.SmoothDamp(currentTurn, -1, ref velocityLeft, smoothTimeLeft); //turn to the left motionConScript.SetTurn(currentTurn); Debug.Log(currentTurn); } else if(Input.GetTouch(i).phase == TouchPhase.Ended) { currentTurn = Mathf.SmoothDamp(currentTurn, 0, ref velocityLeft, smoothTimeLeft); //turn to the left motionConScript.SetTurn(currentTurn); } } else if(rightArrow.HitTest(Input.GetTouch(i).position)) { //if it is hit if(Input.GetTouch(i).phase == TouchPhase.Moved || Input.GetTouch(i).phase == TouchPhase.Stationary) { currentTurn = Mathf.SmoothDamp(currentTurn, 1, ref velocityRight, smoothTimeRight); //turn to the left motionConScript.SetTurn(currentTurn); } else if(Input.GetTouch(i).phase == TouchPhase.Ended) { currentTurn = Mathf.SmoothDamp(currentTurn, 0, ref velocityRight, smoothTimeRight); //turn to the left motionConScript.SetTurn(currentTurn); } } else { currentTurn = Mathf.SmoothDamp(currentTurn, 0, ref velBack, smoothTimeBack); //turn to the left motionConScript.SetTurn(currentTurn); } } } else if(Input.GetMouseButton(0) && leftArrow.HitTest(Input.mousePosition)) { currentTurn = Mathf.SmoothDamp(currentTurn, -1, ref velocityLeft, smoothTimeLeft); //turn to the left motionConScript.SetTurn(currentTurn); Debug.Log(currentTurn); } else if(Input.GetMouseButton(0) && rightArrow.HitTest(Input.mousePosition)) { currentTurn = Mathf.SmoothDamp(currentTurn, 1, ref velocityRight, smoothTimeRight); //turn to the left motionConScript.SetTurn(currentTurn); Debug.Log(currentTurn); } else { currentTurn = Mathf.SmoothDamp(currentTurn, 0, ref velBack, smoothTimeBack); //turn to the left motionConScript.SetTurn(currentTurn); } } }
// Use this for initialization void Start() { leftArrow.transform.position = Vector3.zero; leftArrow.transform.localScale = Vector3.zero; rightArrow.transform.position = Vector3.zero; rightArrow.transform.localScale = Vector3.zero; //call the resize function for both arrows Resize(leftArrow, leftArrowPos); Resize(rightArrow, rightArrowPos); if(player != null) { //assign the motion script to the variable if(player.GetComponent<MotionControl>()) { motionConScript = player.GetComponent<MotionControl>(); } } }
void OnEnable() { motions = new Dictionary<String, Motion>(); motionControl = (MotionControl)target; }
public void RemoveFrom(MotionControl target) { target.maxSpeedFactor -= maxSpeedMod; target.accelerationFactor -= accelerationMod; }
public void ApplyTo(MotionControl target) { target.maxSpeedFactor += maxSpeedMod; target.accelerationFactor += accelerationMod; }
// Use this for initialization void Start() { //get the player dino and store in player players = GameObject.FindGameObjectsWithTag("Dino"); ai = GameObject.FindGameObjectsWithTag ("Ai"); foreach (var unit in players){ if (unit.networkView.isMine && unit.tag == "Dino"){ player = unit; break; } } foreach (var unit in ai) { if (unit != null) { var aiMotion = unit.GetComponent<MotionControl>(); aiMotion.enabled = false; } } //get the MotionControllers from the player and the cpu playerMotion = player.GetComponent<MotionControl>(); //turn off the motion scripts for the player and the cpu playerMotion.enabled = false; //invoke the CountDown method InvokeRepeating ("CountDown", 1.0f, 1.0f); }
void OnEnable() { move = this.GetComponent<MotionControl>(); // Added by Sam // Weapons = GetComponentInChildren<WeaponControlClass>(); // PickUp = GetComponentInChildren<PlayerPickUpClass>(); // PickUp.Move = move; // RacerHealth = GetComponentInChildren<RacerHealthClass>(); // RacerHealth.TheRagdoll = this.GetComponent<DinoRagdoll>(); // RacerHealth.Move = move; // Dust = GetComponentInChildren<DustEffectClass>(); // FireButton.shoot += this.shoot; }