Inheritance: MonoBehaviour
 void Start()
 {
     isMainCam = true;
     craftCam.gameObject.SetActive(false);
     camSwitchInstance = cameraScript.GetComponent <CameraSwitch>();
     backAction        = goBack;
 }
Exemple #2
0
    private void SetPlayerDetails(BasicControl control)
    {
        Controller         = GameObject.FindGameObjectWithTag("Controller").GetComponent <Controller>();
        control.Controller = Controller;

        CameraSwitch cameraSwitch = GameObject.FindGameObjectWithTag("CameraSwitch").GetComponent <CameraSwitch>();
    }
 void Start()
 {
     dropDown = GetComponent<Dropdown>();
     cam_switcher = CameraSettingsManager.GetComponent<CameraSwitch>();
     cam_switcher.Init();
     dropDown.value = PlayerPrefs.GetInt(CameraSettings.Instance.CAMERA_TYPE);
     SetCameraType();
 }
 void Start()
 {
     dropDown     = GetComponent <Dropdown>();
     cam_switcher = CameraSettingsManager.GetComponent <CameraSwitch>();
     cam_switcher.Init();
     dropDown.value = PlayerPrefs.GetInt(CameraSettings.Instance.CAMERA_TYPE);
     SetCameraType();
 }
Exemple #5
0
 // Start is called before the first frame update
 void Start()
 {
     isMainCam = true;
     chestCam.gameObject.SetActive(false);
     electricalCam.gameObject.SetActive(false);
     camSwitchInstance  = cameraScript.GetComponent <CameraSwitch>();
     backAction         = goBack;
     endGameImage.color = Color.black;
 }
 public void OnEdit()
 {
     AbstractCamera.ActiveCamera?.BreakFollow();
     CameraSwitch.OnEagleEye();
     transform.ToRect().sizeDelta = DashboardSize[DashboardMode.EditMode];
     SimulationInfo.gameObject.SetActive(false);
     SimPanel.gameObject.SetActive(false);
     EdPanel.gameObject.SetActive(true);
     CameraOptions.gameObject.SetActive(true);
 }
Exemple #7
0
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         CameraSwitch currentCamera = other.GetComponent <CameraSwitch> ();
         if (!currentCamera.isFPS())
         {
             Messenger.Broadcast(GameEvent.PLAYER_TOOK_HEALTH);
             Destroy(this.gameObject);
         }
     }
 }
 public void OnRun()
 {
     Selectable.Deselect();
     Selectable.DeleteMode = false;
     AbstractCamera.ActiveCamera?.BreakFollow();
     CameraSwitch.OnRTS();
     transform.ToRect().sizeDelta = DashboardSize[DashboardMode.Simulation];
     SimulationInfo.gameObject.SetActive(true);
     SimPanel.gameObject.SetActive(true);
     EdPanel.gameObject.SetActive(false);
     CameraOptions.gameObject.SetActive(false);
 }
Exemple #9
0
    void Start()
    {
        buttonMod = GameObject.Find("Canvas/Canvas/ButtonModel").GetComponent <Button>();
        buttonMod.onClick.AddListener(OnClickModel);

        buttonCam = GameObject.Find("Canvas/Canvas/ButtonCamera").GetComponent <Button>();
        buttonCam.onClick.AddListener(OnClickCamera);

        buttonQuit = GameObject.Find("Canvas/Canvas/ButtonQuit").GetComponent <Button>();
        buttonQuit.onClick.AddListener(OnClickQuit);

        modSwitch = GetComponent <ModelSwitch>();
        camSwitch = GetComponent <CameraSwitch>();
    }
Exemple #10
0
    // Start is called before the first frame update
    void Start()
    {
        switcher = (CameraSwitch)FindObjectOfType(typeof(CameraSwitch));

        if (switcher == null)
        {
            print("Il manque un CameraSwitch sur la scène");
        }

        cameraTransform = GameObject.FindWithTag("MainCamera").transform;
        myCollider      = GetComponent <Collider>();
        rb         = GetComponent <Rigidbody>();
        myAnimator = GetComponent <Animator>();
    }
Exemple #11
0
    // Use this for initialization
    void Start()
    {
        udp    = new UdpClient(5005);
        thread = new Thread(new ThreadStart(ThreadMethod));
        thread.Start();
        muscleLength = HumanTrait.MuscleName.Length;
        muscles      = new float[muscleLength];

        camSwitch = GetComponent <CameraSwitch>();
        modSwitch = GetComponent <ModelSwitch>();

        isCamSwitched = false;
        isModSwitched = false;
        isFeedback    = false;

        activeFeedbackPoints = new float[modSwitch.GetNumberOfFeedbackPoints()];
    }
Exemple #12
0
    void Start()
    {
        Item.buttonClickDelegateItem += OnInteract;

        isMainCam = true;
        prismCam.gameObject.SetActive(false);
        camSwitchInstance = cameraScript.GetComponent <CameraSwitch>();
        backAction        = goBack;


        dialogue = new Dialogue();
        string[] new_sentences = new string[3];
        new_sentences[0]   = "Use your ARROW KEYS to control the laser";
        new_sentences[1]   = "Up, down to move and left, right to rotate";
        new_sentences[2]   = "Your laser has to hit the target to clear this";
        dialogue.sentences = new_sentences;
    }
Exemple #13
0
 // Update is called once per frame
 void Update()
 {
     if (timer > 0.0f)
     {
         timer -= Time.deltaTime;
         if (!trolly.GetComponent <TrolleyMovement>().flag&& Input.GetKeyUp(KeyCode.Space))
         {
             timer = 0.0f;
         }
     }
     else
     {
         trolly.GetComponent <TrolleyMovement>().flag = true;
         CameraSwitch camera = GetComponent <CameraSwitch>();
         camera.run();
     }
 }
Exemple #14
0
 void Start()
 {
     lostPlayers         = new List <PlayerStatus>();
     soloWin             = FindObjectOfType <WinScene>();
     switcher            = FindObjectOfType <CameraSwitch>();
     uiManager           = FindObjectOfType <UIManager>();
     winCamera           = GameObject.FindGameObjectWithTag("WinCamera").GetComponent <Camera>();
     selectionBehaviours = GameObject.FindObjectOfType <Selector>().transform.parent.gameObject;
     generator           = GameObject.FindObjectOfType <Generator>();
     cameraPosition      = GameObject.FindObjectOfType <CameraPosition>();
     musicPlayer         = GameObject.FindObjectOfType <MusicPlayer>();
     highestFloor        = floor = 0;
     ReportNewFloor(0);
     state    = GameState.Menu;
     oldState = state;
     State    = state;
     players  = FindObjectsOfType <PlayerStatus>();
 }
Exemple #15
0
    private void Awake()
    {
        if (current != null && current != this)
        {
            Destroy(gameObject);
            return;
        }

        current        = this;
        _cameraTarget  = _virtualCamera.Follow;
        _cameraTarget2 = _virtualCamera2.Follow;

        resetTargetEvent = new UnityEvent();
        _resetTarget     = ResetTarget;
        resetTargetEvent.AddListener(_resetTarget);
        resetTargetEvent.Invoke();

        GameObject.FindGameObjectWithTag("UI Main").GetComponent <Canvas>().worldCamera = _overlayCamera;
    }
    // Use this for initialization
    void Start()
    {
        rb                     = GetComponent <Rigidbody>();
        t                      = GetComponent <Transform>();
        GameMode               = 0;
        CanGoToComputer        = false;
        CanGoToKitchen         = false;
        CanGetTaskList         = false;
        CanGoToTV              = false;
        CanGiveInput           = false;
        CanGoToSleep           = false;
        GotTasksToday          = false;
        CanKillEnemy           = false;
        CorrectEnemy           = false;
        PuzzlePieceDirection   = 1;
        camswitch              = GameObject.FindGameObjectWithTag("GameController").GetComponent <CameraSwitch>();
        PuzzlePiece            = GameObject.FindGameObjectWithTag("ComputerStartTag");
        Bar                    = GameObject.FindGameObjectWithTag("Bar");
        Cube                   = GameObject.FindGameObjectWithTag("puzzle4");
        Trap1                  = GameObject.FindGameObjectWithTag("Trap1");
        Trap2                  = GameObject.FindGameObjectWithTag("Trap2");
        Trap3                  = GameObject.FindGameObjectWithTag("Trap3");
        dt                     = GameObject.Find("TimeController").GetComponent <Day_TimeScript>();
        SpawnLocation          = new Vector3(PuzzlePiece.transform.position.x, PuzzlePiece.transform.position.y, PuzzlePiece.transform.position.z);
        LevelCommands          = new List <string>();
        TaskList               = new List <string>();
        SecuritySystemArr      = new List <int>();
        ComputerPuzzleAttempts = 1;

        CanLookAtSchedule = false;

        canvasText     = canvas.GetComponentInChildren <TMPro.TextMeshProUGUI>();
        kitchenText    = KitchenC.GetComponentInChildren <TMPro.TextMeshProUGUI>();
        TutorialValue  = 0;
        StartOfGame    = 1;
        StartOfKitchen = 0;
        StartOfComp    = 0;
        StartOfPuzzT   = 0;
        StartOfRadio   = 0;

        kitchenText.SetText("");
        puzzThreeText.SetText("");
    }
Exemple #17
0
            internal void Invoke079CameraSwitch(
                Player player,
                Camera cam,
                bool mapSwitch,
                bool spawning,
                out bool allow
                )
            {
                var ev = new Scp079CameraSwitchEventArgs
                {
                    Scp079    = player,
                    MapSwitch = mapSwitch,
                    Camera    = cam,
                    Spawning  = spawning,
                    Allow     = true
                };

                CameraSwitch?.Invoke(ev);

                //If allowed by the event methods, or if this is the first spawning
                allow = ev.Allow || ev.Spawning;
            }
Exemple #18
0
        private void OnEnable()
        {
            AbstractCamera.ActiveCamera?.BreakFollow();

            CameraSwitch.OnEagleEye();
        }
Exemple #19
0
 // Use this for initialization
 void Start()
 {
     controller = gameObject.GetComponent <CharacterController>();
     checkCam   = gameObject.GetComponent <CameraSwitch>();
     //miniMapPlayer = transform.Find("miniMapPlayer").gameObject;
 }
 // Start is called before the first frame update
 void Start()
 {
     cs = GameObject.FindGameObjectWithTag("GameController").GetComponent <CameraSwitch>();
     sm = GameObject.FindGameObjectWithTag("Player").GetComponent <SimpleMovement>();
 }
 void Start()
 {
     GameObject cameras = GameObject.Find ("Cameras");
     cameraSwitch = cameras.GetComponent<CameraSwitch> ();
 }
Exemple #22
0
    // Update is called once per frame
    void Update()
    {
        GameObject   flyingCamera       = GameObject.Find("flyingCamera");
        CameraSwitch CameraSwitchScript = flyingCamera.GetComponent <CameraSwitch>();


        /* if (CameraSwitchScript.cameraPositionChange)
         * {
         *
         * } */

        //Add new variable
        float oldTimeScale = 1;

        if (timeScale != oldTimeScale)
        {
            TimeFunction();
            oldTimeScale = timeScale;
        }

        //Add new variable
        float oldDistanceScale = 1;

        if (distanceScale != oldDistanceScale)
        {
            DistanceFunction();
            oldDistanceScale = distanceScale;
        }



        //DistanceFunction();

        /*
         * // If the , key is pressed during a frame, halve the speed of the simulation. I.e. < key
         * if (Input.GetKeyDown(KeyCode.Comma))
         * {
         *  timeScale *= 0.5f;
         *  timeVariable = timeInitial * (decimal)timeScale;
         *  // recalculate G
         *  RescalingG(realG, timeVariable, massVariable, distanceVariable);
         *  // Send a Debug Log to confirm the simulation has slowed down
         *  Debug.Log("Simulation slowed down. It is now " + timeScale + " times the Default Speed");
         *  Debug.Log("G in Simulated units is now" + rescaledG);
         * }
         * // If the . key is pressed during a frame, double the speed of the simulation. I.e. > key
         * else if (Input.GetKeyDown(KeyCode.Period))
         * {
         *  timeScale *= 2.0f;
         *  timeVariable = timeInitial * (decimal)timeScale;
         *  // recalculate G
         *  RescalingG(realG, timeVariable, massVariable, distanceVariable);
         *  // Send a Debug Log to confirm the simulation was sped up
         *  Debug.Log("Simulation speed up. It is now " + timeScale + " times the Default Speed");
         *  Debug.Log("G in Simulated units is now" + rescaledG);
         * }
         * // If the V key is pressed during a frame, halve the distance of the simulation. I.e. C for Closer
         * else if (Input.GetKeyDown(KeyCode.C))
         * {
         *  distanceScale *= 2.0f;
         *  distanceVariable = distanceInitial * (decimal)distanceScale;
         *  // recalculate G
         *  RescalingG(realG, timeVariable, massVariable, distanceVariable);
         *  // Send a Debug Log to confirm the simulation has shrunk
         *  Debug.Log("Simulation shrunk. It is now " + (1.0f / distanceScale) + " times the Default Distance");
         *  Debug.Log("G in Simulated units is now" + rescaledG);
         * }
         * // If the F key is pressed during a frame, double the distance of the simulation. I.e. F for Further
         * else if (Input.GetKeyDown(KeyCode.F))
         * {
         *  distanceScale *= 0.5f;
         *  distanceVariable = distanceInitial * (decimal)distanceScale;
         *  // recalculate G
         *  RescalingG(realG, timeVariable, massVariable, distanceVariable);
         *  // Send a Debug Log to confirm the simulation was sped up
         *  Debug.Log("Simulation expanded. It is now " + (1.0f / distanceScale) + " times the Default Distance");
         *  Debug.Log("G in Simulated units is now" + rescaledG);
         * }
         * // If the R key is pressed during a frame, reset the distances and time of the simulation. I.e. R for Reset
         * else if (Input.GetKeyDown(KeyCode.R))
         * {
         *  distanceScale = 1.0f;
         *  distanceVariable = distanceInitial;
         *  timeScale = 1.0f;
         *  timeVariable = timeInitial;
         *  // recalculate G
         *  RescalingG(realG, timeVariable, massVariable, distanceVariable);
         *  // Send a Debug Log to confirm the simulation distances were reset
         *  Debug.Log("Simulation distances were reset. It is now " + (1.0f / distanceScale) + " times the Default distance");
         *  // Send a Debug Log to confirm the simulation was sped up
         *  Debug.Log("Simulation speed was reset. It is now " + timeScale + " times the Default Speed");
         *  Debug.Log("G in Simulated units is now" + rescaledG);
         * }
         *
         * // If any other input is pressed, do nothing
         * else
         * {
         *
         * } */
    }
Exemple #23
0
    void Start()
    {
        GameObject cameras = GameObject.Find("Cameras");

        cameraSwitch = cameras.GetComponent <CameraSwitch> ();
    }
Exemple #24
0
        private void FixedUpdate()
        {
            if (m_Dis != null)
            {
                m_CameraSwitch = m_Dis.GetComponent <CameraSwitch>();
                m_Distance     = m_CameraSwitch.distance;

                Debug.Log("Get distance " + m_Distance);
            }

            if (m_Target == null || !m_Driving)
            {
                // Car should not be moving,
                // use handbrake to stop
                m_CarController.Move(0, 0, -1f, 1f);
            }

            else
            {
                Vector3 fwd = transform.forward;
                if (m_Rigidbody.velocity.magnitude > m_CarController.MaxSpeed * 0.1f)
                {
                    fwd = m_Rigidbody.velocity;
                }

                float desiredSpeed = m_CarController.MaxSpeed;

                // now it's time to decide if we should be slowing down...
                switch (m_BrakeCondition)
                {
                case BrakeCondition.TargetDirectionDifference:
                {
                    // the car will brake according to the upcoming change in direction of the target. Useful for route-based AI, slowing for corners.

                    // check out the angle of our target compared to the current direction of the car
                    float approachingCornerAngle = Vector3.Angle(m_Target.forward, fwd);

                    // also consider the current amount we're turning, multiplied up and then compared in the same way as an upcoming corner angle
                    float spinningAngle = m_Rigidbody.angularVelocity.magnitude * m_CautiousAngularVelocityFactor;

                    // if it's different to our current angle, we need to be cautious (i.e. slow down) a certain amount
                    float cautiousnessRequired = Mathf.InverseLerp(0, m_CautiousMaxAngle,
                                                                   Mathf.Max(spinningAngle,
                                                                             approachingCornerAngle));
                    desiredSpeed = Mathf.Lerp(m_CarController.MaxSpeed, m_CarController.MaxSpeed * m_CautiousSpeedFactor,
                                              cautiousnessRequired);
                    break;
                }

                case BrakeCondition.TargetDistance:
                {
                    // the car will brake as it approaches its target, regardless of the target's direction. Useful if you want the car to
                    // head for a stationary target and come to rest when it arrives there.

                    // check out the distance to target
                    if (m_Distance < 400)
                    {
                        desiredSpeed = 0;
                        Debug.Log("Start Break !!!!!");
                    }
                    else
                    {
                        Vector3 delta = m_Target.position - transform.position;
                        float   distanceCautiousFactor = Mathf.InverseLerp(m_CautiousMaxDistance, 0, delta.magnitude);

                        // also consider the current amount we're turning, multiplied up and then compared in the same way as an upcoming corner angle
                        float spinningAngle = m_Rigidbody.angularVelocity.magnitude * m_CautiousAngularVelocityFactor;

                        // if it's different to our current angle, we need to be cautious (i.e. slow down) a certain amount
                        float cautiousnessRequired = Mathf.Max(
                            Mathf.InverseLerp(0, m_CautiousMaxAngle, spinningAngle), distanceCautiousFactor);
                        desiredSpeed = Mathf.Lerp(m_CarController.MaxSpeed, m_CarController.MaxSpeed * m_CautiousSpeedFactor,
                                                  cautiousnessRequired);
                    }
                    break;
                }

                case BrakeCondition.NeverBrake:
                    break;
                }

                // Evasive action due to collision with other cars:

                // our target position starts off as the 'real' target position
                Vector3 offsetTargetPos = m_Target.position;

                // if are we currently taking evasive action to prevent being stuck against another car:
                if (Time.time < m_AvoidOtherCarTime)
                {
                    // slow down if necessary (if we were behind the other car when collision occured)
                    desiredSpeed *= m_AvoidOtherCarSlowdown;

                    // and veer towards the side of our path-to-target that is away from the other car
                    offsetTargetPos += m_Target.right * m_AvoidPathOffset;
                }
                else
                {
                    // no need for evasive action, we can just wander across the path-to-target in a random way,
                    // which can help prevent AI from seeming too uniform and robotic in their driving
                    offsetTargetPos += m_Target.right *
                                       (Mathf.PerlinNoise(Time.time * m_LateralWanderSpeed, m_RandomPerlin) * 2 - 1) *
                                       m_LateralWanderDistance;
                }

                // use different sensitivity depending on whether accelerating or braking:
                float accelBrakeSensitivity = (desiredSpeed < m_CarController.CurrentSpeed)
                                                  ? m_BrakeSensitivity
                                                  : m_AccelSensitivity;

                // decide the actual amount of accel/brake input to achieve desired speed.
                float accel = Mathf.Clamp((desiredSpeed - m_CarController.CurrentSpeed) * accelBrakeSensitivity, -1, 1);

                // add acceleration 'wander', which also prevents AI from seeming too uniform and robotic in their driving
                // i.e. increasing the accel wander amount can introduce jostling and bumps between AI cars in a race
                accel *= (1 - m_AccelWanderAmount) +
                         (Mathf.PerlinNoise(Time.time * m_AccelWanderSpeed, m_RandomPerlin) * m_AccelWanderAmount);

                // calculate the local-relative position of the target, to steer towards
                Vector3 localTarget = transform.InverseTransformPoint(offsetTargetPos);

                // work out the local angle towards the target
                float targetAngle = Mathf.Atan2(localTarget.x, localTarget.z) * Mathf.Rad2Deg;

                // get the amount of steering needed to aim the car towards the target
                float steer = Mathf.Clamp(targetAngle * m_SteerSensitivity, -1, 1) * Mathf.Sign(m_CarController.CurrentSpeed);

                // feed input to the car controller.
                m_CarController.Move(steer, accel, accel, 0f);

                // if appropriate, stop driving when we're close enough to the target.
                if (m_StopWhenTargetReached && localTarget.magnitude < m_ReachTargetThreshold)
                {
                    m_Driving = false;
                }
            }
        }
	void FixedUpdate()
    { 
        if (mustSnapToPlayerStart > 0) {
			if (GameObject.Find ("PlayerStart")) 
			{
				Vector3 newPos = GameObject.Find ("PlayerStart").transform.position;
				this.transform.position = newPos;
			}
			mustSnapToPlayerStart--;
		}

		if (!started)
			return;
		if (mirrorActivationDelaying) 
		{ // Reentry condition: showing mirror activation
			if(elapsedTime == 0.0f) 
			{
				if (ds == null)
					ds = GameObject.Find ("MasterController").GetComponent<MasterControllerScript> ().getStorage ();
				int mirrorNumber = ds.retrieveIntValue ("ActivateMirror"); // the gates will be just the 'next' mirror

//				if(cam != null)
//				{
//					cam.warpToMarker (mirrorNumber);
//					GameObject newTarget = GameObject.Find (ds.retrieveStringValue ("ActivatedMirror"));
//					cam.target = newTarget;
//				}
				CameraSwitch cameraController = GameObject.Find("CameraController").GetComponent<CameraSwitch>();
				cameraController._wm_switchToCameraIndex (mirrorNumber);
				if (mirrorObject != null) 
				{
					mirrorObject.activate (mirrorNumber);
				}
			}

			elapsedTime += Time.deltaTime;
			if (elapsedTime > mirrorActivationDelay) {
				ds.storeStringValue ("ReentryCondition", "");
				string returnLocation = ds.retrieveStringValue ("ReturnLocation");
				SceneManager.LoadScene (returnLocation);
			}
			return;
		}

		if (agent.enabled == true) 
		{
			return;
		}

		string intern, backn;
		if (interactee != null)
			intern = interactee.name;
		else intern = "null";
		if (backupInteractee != null)
			backn = backupInteractee.name;
		else backn = "null";

        if (meditatingRemaining > 0.0f)
        {
            meditatingRemaining -= Time.deltaTime;
            return;
        }

        /* WARNING crazy statement, reformulate */
        if (blocked)
			return;
		//if ((state != PlayerState.idling) && (state != PlayerState.walking))
		//	return;

		moving = false;
		if((state != PlayerState.materializing) && (state != PlayerState.dematerialized)) state = PlayerState.idling;

		//float moveHorizontal = Input.GetAxis ("Horizontal");
		//float moveVertical = Input.GetAxis ("Vertical");
		float moveHorizontal = 0.0f;
		float moveVertical = 0.0f;

		/*if (walkType == PlayerWalkType.floating) {
			if (height < equilibriumHeight) {
				heightSpeed += (equilibriumHeight - height)*(equilibriumHeight - height) * floatingAcceleration * Time.deltaTime;
			} else if (height > equilibriumHeight) {
				heightSpeed -= (height - equilibriumHeight)*(height - equilibriumHeight) * floatingAcceleration * Time.deltaTime;
			}
			height += heightSpeed * Time.deltaTime * equilibriumStrength;
			if (heightSpeed > 0.0f) {
				if (heightSpeed > maxHeightSpeed)
					heightSpeed = maxHeightSpeed;
			} else {
				if (heightSpeed < -maxHeightSpeed)
					heightSpeed = -maxHeightSpeed;
			}
		}*/

		if (autopilot == false) {
			moveHorizontal = hud.touchHorizontal () * walkMultiplicator;
			moveVertical = hud.touchVertical () * walkMultiplicator;
		} else {
			Vector3 current = this.transform.position;
			current.y = 0.0f;
			Vector3 dest = autopilotDestination;
			dest.y = 0.0f;
			Vector3 origin = autopilotOrigin;
			origin.y = 0.0f;
			DEJAMEVERESADISTANCIA = Vector3.Dot ((dest - current).normalized, (dest - origin).normalized);
			if (Vector3.Dot ((dest - current).normalized, (dest - origin).normalized) < 0.0f) {
				autopilot = false;
				notifyFinishAction ();
			} else {
				moveHorizontal = (autopilotDestination - autopilotOrigin).normalized.x/10.0f * walkMultiplicator;
				moveVertical = (autopilotDestination - autopilotOrigin).normalized.z/10.0f * walkMultiplicator;
			}
		}

		if(lastHorizontal != 0.0f && lastVertical != 0.0f) 
			direction = Direction4FromVector (new Vector2 (lastHorizontal, lastVertical));
		if ((moveHorizontal != 0.0f) || (moveVertical != 0.0f)) {
			direction = Direction4FromVector (new Vector2 (moveHorizontal, moveVertical));
			lastHorizontal = moveHorizontal;
			lastVertical = moveVertical;
			moving = true;
			state = PlayerState.walking;
		}

		if (moving) {
			setOrientation(direction);

			elapsedTime += Time.deltaTime;
			if (elapsedTime > (1.0f / WalkingAnimationSpeed)) {
				elapsedTime = 0.0f;
				frame++;
				foreach (int f in footstepFrame) {
					if(f == frame) {
						levelRef.footstep();
					}
				}
				if (walkType == PlayerWalkType.onGround) {
					switch (direction) {
					case PlayerDirection.left:
						if (frame == WalkingLeft.Length)
							frame = 1;
						break;
					case PlayerDirection.right:
						if (frame == WalkingRight.Length)
							frame = 1;
						break;
					case PlayerDirection.front:
						if (frame == WalkingFront.Length)
							frame = 1;
						break;
					case PlayerDirection.back:
						if (frame == WalkingBack.Length)
							frame = 1;
						break;
					case PlayerDirection.backleft:
						if (frame == WalkingLeftBack.Length)
							frame = 1;
						break;
					case PlayerDirection.backright:
						if (frame == WalkingBackRight.Length)
							frame = 1;
						break;
					case PlayerDirection.frontleft:
						if (frame == WalkingFrontLeft.Length)
							frame = 1;
						break;
					case PlayerDirection.frontright:
						if (frame == WalkingRightFront.Length)
							frame = 1;
						break;
					}
				} else {
					switch (direction) {
					case PlayerDirection.left:
						if (frame == floatingLeft.Length)
							frame = 0;
						break;
					case PlayerDirection.right:
						if (frame == floatingRight.Length)
							frame = 0;
						break;
					case PlayerDirection.front:
						if (frame == floatingFront.Length)
							frame = 0;
						break;
					case PlayerDirection.back:
						if (frame == floatingBack.Length)
							frame = 0;
						break;
					case PlayerDirection.backleft:
						if (frame == floatingBackLeft.Length)
							frame = 0;
						break;
					case PlayerDirection.backright:
						if (frame == floatingBackRight.Length)
							frame = 0;
						break;
					case PlayerDirection.frontleft:
						if (frame == floatingFrontLeft.Length)
							frame = 0;
						break;
					case PlayerDirection.frontright:
						if (frame == floatingFrontRight.Length)
							frame = 0;
						break;
					}
				}
			}

		} else { // not moving
			if (walkType == PlayerWalkType.onGround) {
				switch (direction) {
				case PlayerDirection.left:
					playerRendRef.sprite = WalkingLeft [0];
					otherPlayerRendRef.sprite = WalkingLeft [0];
					break;
				case PlayerDirection.right:
					playerRendRef.sprite = WalkingRight [0];
					otherPlayerRendRef.sprite = WalkingRight [0];
					break;
				case PlayerDirection.front:
					playerRendRef.sprite = WalkingFront [0];
					otherPlayerRendRef.sprite = WalkingFront [0];
					break;
				case PlayerDirection.back:
					playerRendRef.sprite = WalkingBack [0];
					otherPlayerRendRef.sprite = WalkingBack [0];
					break;
				case PlayerDirection.backleft:
					playerRendRef.sprite = WalkingLeftBack [0];
					otherPlayerRendRef.sprite = WalkingLeftBack [0];
					break;
				case PlayerDirection.backright:
					playerRendRef.sprite = WalkingBackRight [0];
					otherPlayerRendRef.sprite = WalkingBackRight [0];
					break;
				case PlayerDirection.frontleft:
					playerRendRef.sprite = WalkingFrontLeft [0];
					otherPlayerRendRef.sprite = WalkingFrontLeft [0];
					break;
				case PlayerDirection.frontright:
					playerRendRef.sprite = WalkingRightFront [0];
					otherPlayerRendRef.sprite = WalkingRightFront [0];
					break;
				}
			}

			frame = 0;
			elapsedTime = 0.0f;
		}

		bool cannotWalk = false;

		float yVelocity = r.velocity.y;

		Vector3 movement = new Vector3 (externalForce.x + moveHorizontal*speed, externalForce.y + yVelocity, externalForce.z + moveVertical*speed); // WARNING magic number
		Vector3 flatMovement = movement;
		flatMovement.y = 0.0f;
		modulusSpeed = flatMovement.magnitude;
		if ((!blocked) && (!cannotWalk))
			r.velocity = movement;
		else
			r.velocity = new Vector3 (0.0f, 0.0f, 0.0f);

		if (Input.GetMouseButtonDown (0) && (moving == false)) 
		{
			canInteract = true;
		}

		if (moving == true)
			canInteract = false;

		if(Input.GetMouseButtonUp(0) && (canInteract == true)) {

			canInteract = false;

			switch (interaction) {

			case Interaction.None:
				break;

			default:
				if(interactee!=null) interactee.effect ();
				break;
			}
		}
	}
Exemple #26
0
        internal void Init()
        {
            teacherInputsRemaining = 4;
                studentInputsRemaining = 5;
                maxInputs = 4;
                roundWins = 0;
                currentState = GameStates.START;
                ArrayList teacherPicks = new ArrayList();
                ArrayList studentPicks = new ArrayList();
                simonSaysSpotlight = GameObject.Find("SimonSaysLight");
                simonRedGameLight = GameObject.Find("SimonSaysLightRed");
                simonBlueGameLight = GameObject.Find("SimonSaysLightBlue");
                simonYellowGameLight = GameObject.Find("SimonSaysLightYellow");
                simonGreenGameLight = GameObject.Find("SimonSaysLightGreen");
                texts = GameObject.Find ("texts");
                tsquare = GameObject.Find ("tsquare");
                facebook = GameObject.Find ("facebook");
                studentCamera = GameObject.Find ("Student Camera").GetComponent<Camera>() as Camera;
                pinkEle = GameObject.Find ("PinkElephant");
                teacherTextNumbers = GameObject.Find("teacherInputsRemaining").GetComponent<TextMesh>();
                teacherNotifications = GameObject.Find("teacherNotifications").GetComponent<TextMesh>();
                studentNotifications = GameObject.Find("studentNotifications").GetComponent<TextMesh>();
                success = GameObject.Find("successNotification").GetComponent<TextMesh>();
                failure = GameObject.Find("failureNotification").GetComponent<TextMesh>();
                texts.SetActive(false);
                tsquare.SetActive(false);
                facebook.SetActive(false);
                s = studentCamera.GetComponent<sleep>();
                d = studentCamera.GetComponent<dream>();
                txts = texts.GetComponent<drift>();
                t2 = tsquare.GetComponent<drift>();
                fb = facebook.GetComponent<drift>();
                roundNum = 1;
                teacherSelections = new ArrayList();
                studentSelections = new ArrayList();
                redScreen = GameObject.Find("redScreen");
                redScreen.SetActive(false);
                greenScreen = GameObject.Find("greenScreen");
                greenScreen.SetActive(false);
                yellowScreen = GameObject.Find("yellowScreen");
                yellowScreen.SetActive(false);
                blueScreen = GameObject.Find("blueScreen");
                blueScreen.SetActive(false);
                //pinkEle.SetActive(false);

                startCam = GameObject.Find("StartCamera");
                switchScript = startCam.GetComponent<CameraSwitch>();

                /*Erin*/
                //startCam = GameObject.Find ("StartCamera").GetComponent<Camera>() as Camera;
                //endCam = GameObject.Find ("EndCamera").GetComponent<Camera>() as Camera;

                //snapeSound = GameObject.Find ("snapeSound");
                //peanutsSound = GameObject.Find ("peanutsSound");
                //anyoneSound = GameObject.Find ("anyoneSound");

                //startCam.enabled = true;
                //endCam.enabled = false;
                //studentCamera.enabled = false;
                //startCam.gameObject.camera.enabled = true;
                //endCam.gameObject.camera.enabled = false;
                //studentCamera.gameObject.camera.enabled = false;

                //snapeSound.gameObject.audio.enabled = false;
                //peanutsSound.gameObject.audio.enabled = false;
                //anyoneSound.gameObject.audio.enabled = true;
                /*Erin*/
        }
Exemple #27
0
 public static void ExitEditMode()
 {
     SimManager.SetStatus(SimulationStatus.Paused);
     CameraSwitch.OnRTS();
     //Instance.gameObject.SetActive(false);
 }
	// Use this for initialization
	void Start () {
		key = GameObject.Find ("Key").GetComponent<Key> ();
		cameraswitch = GameObject.Find ("CameraSwitching").GetComponent<CameraSwitch> ();
	}