public void Start() { CreatePointer(); cam = Camera.main; clickSound = this.GetComponent <AudioSource>(); raycastManager = this.GetComponent <RaycastManager>(); }
new void Awake() { breadBoard = BreadBoard.GetInstance(); raycastManager = RaycastManager.GetInstance(); fabricator = Fabricator.GetInstance(); circuitPool = CircuitPool.GetInstance(); }
void Start() { /* * //make sure player is seeing ladders in correct world * if (space) * { * GetComponent<MFPP.Modules.LadderModule>().LadderLayerMask.value = 262144; //only see ladders in real world * } * else { GetComponent<MFPP.Modules.LadderModule>().LadderLayerMask.value = 524288; //only see ladders in laser world * } */ //Debug.Log(Camera.main.fieldOfView); mutationSpawner = GetComponent <MutationSpawner>(); audioSource = GetComponent <AudioSource>(); rm = GetComponent <RaycastManager>(); SoundBox box = SoundBox.Instance; flipSounds = box.currentFlipPalette; flipFailClip = box.flipFail; soundTrack = GetComponentInChildren <SoundTrackManager>(); flipburst = GetComponentInChildren <flipburst>(); transitionCollider = GetComponentInChildren <TransitionCollider>(); eyeThatSeesList = new List <EyeThatSees>(); _pickupModule = GetComponent <MFPP.Modules.PickUpModule>(); eyesEffect = Camera.main.GetComponent <ImageEffectEyes>(); }
private void Awake() { if (Instance == null) { Instance = this; } }
void Start() { acterManager = GetComponent <ActerManager>(); raycastManager = GetComponent <RaycastManager>(); acterManager.SetSpeed = speed; coins = 0; }
private void Awake() { _reticleTransform = reticle.GetComponent <Transform>(); _originalScale = _reticleTransform.localScale; _originalRotation = _reticleTransform.localRotation; _reticleRend = reticle.GetComponent <Renderer>(); _defaultColor = _reticleRend.material.color; _raycastManager = RaycastManager.Instance; _checkForEnemy = CheckForEnemy.Instance; }
// Use this for initialization void Start() { //Утсановка параметров для актера acterManager = GetComponent <ActerManager>(); raycastManager = GetComponent <RaycastManager>(); acterManager.SetSpeed = speed; state = StateList.inactivity; StartCoroutine(StateRandom()); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(this); } }
public void Start() { #region GetComponents gameWorld = GetComponent <GameWorld>(); rayManager = GetComponent <RaycastManager>(); touchManager = GetComponent <TouchManager>(); anchorHandler = GetComponent <MainAnchorHandler>(); buttonStateMachine = GetComponent <ButtonStateMachine>(); objectSpawnHandler = GetComponent <ObjectSpawnHandler>(); baws = gameObject.GetComponent <BAWS>(); #endregion }
private void Update() { if (Input.GetMouseButtonDown(1)) { GameObject hit = RaycastManager.GetRaycastHit(); _hit = hit; if (PathCanStart(hit)) { PathInitialize(hit); // Initialize variables for path analyzing } } }
public void OnObjectSpawn() { objPooler = ObjectPooler.Instance; rayManager = RaycastManager.Instance; camMove = CameraMovement.Instance; rb = GetComponent <Rigidbody>(); isEnemy = rayManager.CheckIsEnemy(); if (!isEnemy) { target = rayManager.lastHitPosition; } }
/// <summary> /// Method for casting raycast into /// </summary> /// <returns></returns> private List <ARRaycastHit> CastRaycast() { List <ARRaycastHit> hitsToReturn = new List <ARRaycastHit>(); if (RaycastManager.Raycast(ScreenCenterPoint, hitsToReturn, TrackingType)) { return(hitsToReturn); } else { return(new List <ARRaycastHit>()); } }
void RotateObject() { if (Input.GetMouseButton(0)) { Debug.Log(transform.eulerAngles.y); float rotX = Input.GetAxis("Mouse X") * rotSpeed * Mathf.Deg2Rad; //float rotY = Input.GetAxis("Mouse Y") * rotSpeed * Mathf.Deg2Rad; if (prevRay == null) { prevRay = RaycastManager.GetRaycastHit().transform; MouseDown = true; Pillar.PillarActive = true; } //if (prevRay == Rotation && MouseDown && border < 90 && border >= 0) if (prevRay == Rotation && MouseDown && RaycastManager.hit.transform.tag == "Handle") { //transform.Rotate(new Vector3(0, Input.GetAxis("Mouse X")) * Time.deltaTime * speed); transform.Rotate(Vector3.up, -rotX, Space.World); //transform.RotateAround(Vector3.right, rotY); } } else { border = transform.localEulerAngles.y; border = Mathf.Clamp(border, 0.5f, 90); //Debug.Log(border); if (transform.eulerAngles.y > 90 && transform.eulerAngles.y < 270) { Debug.Log("Too far"); transform.rotation = Quaternion.Euler(0, -90, 0); } else if (transform.eulerAngles.y > 270) { Debug.Log("Too short"); transform.rotation = Quaternion.Euler(0, 0.5f, 0); } prevRay = null; MouseDown = false; Pillar.PillarActive = false; } }
public void UpdateToolbox() { if (!player) { player = GameObject.FindWithTag("Player"); } if (!mainCanvas) { mainCanvas = GameObject.FindWithTag("Main Canvas"); } playerCam = player.GetComponentInChildren <Camera>(); raycastManager = player.GetComponent <RaycastManager>(); pickUp = player.GetComponent <MFPP.Modules.PickUpModule>(); flipScript = player.GetComponent <flipScript>(); UpdateTransforms(); iconContainer = GameObject.FindWithTag("IconContainer").GetComponent <IconContainer>(); pauseMenu = GameObject.Find("PauseMenu"); Application.backgroundLoadingPriority = ThreadPriority.Low; cameraFogStartDefault = Camera.main.GetComponent <UnityStandardAssets.ImageEffects.GlobalFog>().startDistance; fogDensityDefault = RenderSettings.fogDensity; if (Toolbox.Instance == this) { SoundEffectsAudio = GameObject.Find("SoundEffectsAudio").GetComponent <AudioSource>(); } Debug.Log("adding player info!"); Toolbox.Instance.player = player; Toolbox.Instance.playerCam = playerCam; Toolbox.Instance.pickUp = pickUp; Toolbox.Instance.raycastManager = raycastManager; Toolbox.Instance.flipScript = flipScript; UpdateTransforms(); Toolbox.Instance.iconContainer = iconContainer; Toolbox.Instance.pauseMenu = pauseMenu; Toolbox.Instance.SoundEffectsAudio = GameObject.Find("SoundEffectsAudio").GetComponent <AudioSource>(); Toolbox.Instance.SoundtrackAudio = GameObject.Find("LaserChords").GetComponent <AudioSource>(); Toolbox.Instance.soundEffectsSlider = pauseMenu.transform.GetChild(2).GetComponent <Slider>(); Toolbox.Instance.soundEffectsSlider.onValueChanged.AddListener(delegate { VolumeChangeCheck(); }); }
public void Start() { if (!initialized) { start = this.transform.position; Color RC = platformContainer.GetComponent <PlatformController>().RestingColor; Color AC = platformContainer.GetComponent <PlatformController>().ActiveColor; Color SC = platformContainer.GetComponent <PlatformController>().ShimmerColor; Texture2D ST = platformContainer.GetComponent <PlatformController>().ScrollText; this.Indicator.SetColors(RC, AC, SC, ST); raycastManager = Toolbox.Instance.GetPlayer().GetComponent <RaycastManager>(); pickUp = Toolbox.Instance.GetPlayer().GetComponent <MFPP.Modules.PickUpModule>(); LR = gameObject.transform.parent.gameObject.GetComponentInChildren <LineRenderer>(); LR.positionCount = 2; Vector3 begin = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y - 0.1f, gameObject.transform.position.z); LR.useWorldSpace = true; LR.SetPosition(0, begin); Vector3 finish = new Vector3(end.position.x, end.position.y - 0.1f, end.position.z); LR.SetPosition(1, finish); LR.material.SetColor("_RestingColor", RC); LR.material.SetColor("_ActiveColor", AC); LR.material.SetColor("_ShimmerColor", SC); LR.material.SetFloat("_isLineRenderer", 1.0f); //setup the audio if (!GetComponent <AudioSource>()) { this.gameObject.AddComponent <AudioSource>(); } audio = GetComponent <AudioSource>(); audio.spatialBlend = 1f; audio.playOnAwake = false; initialized = true; } }
private void EssentialSetup() { SunLight = new GameObject() .WithName("Sun Light") .WithColour(Vector3.One) .AddComponent(new Light()); MainCamera = new GameObject() .WithName("Main Camera") .AddComponent(new Camera(Width / (float)Height, 60)); MainScene = new Scene() .WithGameObject(SunLight.gameObject) .WithGameObject(MainCamera.gameObject); Renderer = new MasterRenderer(); RaycastManager = new RaycastManager(MainCamera); PhysicsManager = new PhysicsManager(); SceneManager = new SceneManager(); SceneManager.AddScene(MainScene); }
private void StartGameManager() { try { // define your services here RaycastManager = new RaycastManager(); EnemyManager = new EnemyManager(); AttackManager = new AttackManager(); MovingPlayerManager = new MovingPlayerManager("Player"); CursorManager = new CursorManager(); SoundManager = new SoundManager(); PlayerDeathManager = new PlayerDeathManager(); CameraManager = new CameraManager("Main Camera"); SFXManager.SetSfx(); } catch (Exception e) { Debug.LogException(e); } }
public void Start() { // automatically switch between mouse or controller input based on the platform. I'm not sure if it is working #if SENSEGLOVE pointerTechnique = PointerTechnique.None; #else if (pointerTechnique == PointerTechnique.Auto) { if (Application.platform == RuntimePlatform.Android) { pointerTechnique = PointerTechnique.PointerController; } else { pointerTechnique = PointerTechnique.PointerMouse; } showLaser = pointerTechnique == PointerTechnique.PointerMouse; } #endif CreatePointer(); cam = Camera.main; clickSound = this.GetComponent <AudioSource>(); raycastManager = this.GetComponent <RaycastManager>(); }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { Debug.Log(RaycastManager.GetRaycastHit()); if (RaycastManager.GetRaycastHit() == gameObject) { Cursor.lockState = CursorLockMode.Confined; OnMouseDrag(); } } if (!Input.GetMouseButton(0)) { //makes speed 0 s speed = 0; } _prevMousePos = Input.mousePosition; //Keeps the speed low if (speed >= maxSpeed) { speed = maxSpeed; } }
// Use this for initialization void Start() { _raycastManager = RaycastManager.Instance; _isEnemy = false; }
void Start() { raycastManager = this; }
private void Start() { rayManager = RaycastManager.Instance; }
using UnityEngine; using System.Collections; namespace MFPP.Modules { [HelpURL("https://ashkoredracson.github.io/MFPP/#pick-up-module")] [DisallowMultipleComponent] public class PickUpModule : PlayerModule { /// <summary> /// The maximum pickup distance. /// </summary> [Space] [Tooltip("The maximum pickup distance.")] public float MaxPickupDistance = 2f; public float breakDistance = 5f; public float maxVelocity = 12; [Tooltip("Pick up button.")] public string PickUpButton = "Pick Up"; public Transform playerCam; public GameObject heldObject; public FootstepAsset originalFootstep; public FootstepAsset dragFootstep; public Rigidbody target; [SerializeField] private LayerMask newLayerMask; private Camera mainCamera; private float originalWalkingSpeed = 3; private IconContainer iconContainer; private AudioSource audioSource; private AudioClip pickupClip; private AudioClip dropClip; private AudioClip popClip; private float CurrentHeight; private float Radius; private IHoldable _holdable; private ISelectable _selectable; private ReticleObject _rObject; private RaycastManager rm; void Start () { mainCamera = Camera.main; audioSource = GetComponent<AudioSource>(); SoundBox sound = SoundBox.Instance; pickupClip = sound.pickup; popClip = sound.pop; dropClip = sound.deselect; iconContainer = Toolbox.Instance.GetIconContainer(); CurrentHeight = GetComponent<MFPP.Player>().CurrentHeight; Radius = GetComponent<CharacterController>().radius; rm = GetComponent<RaycastManager>(); } public override void AfterUpdate() { if (ControlManager.Instance.GetButtonDown("PickUp")) // If pick up button was pressed { if (target) // If we already have a target rigidbody, set it to null, thus dropping/throwing it. {PutDown();} else {PrepareForPickup();} } if (target) // If target is not null, move the target in front of the camera at max pickup distance.
// Use this for initialization void Start() { mm = GameObject.FindObjectOfType <RaycastManager>(); }
// Start is called before the first frame update void Start() { transform.position = waypoints[waypointIndex].position; rayManager = RaycastManager.Instance; }
void Start() { raycastManager = FindObjectOfType <RaycastManager>(); gui = GameObject.Find("GUI"); }
private void Awake() { current = this; // PlacementController.current.SelectingNewPlacement += onActiveSelector; // placementButton.GetComponent<Button>().onClick.AddListener(onActiveSelector); }
void Awake() { _raycastManager = RaycastManager.Instance; _poolingManager = PoolingManager.Instance; }