Esempio n. 1
0
    void Flashlight(Flashlight prefab)
    {
        if (flashlightOn)
        {
            flashlightOn = false;
        }
        else
        {
            flashlightOn = true;
        }

        prefab.GetComponent <Light>().enabled = flashlightOn;
    }
        public void Init(Flashlight oldComponent)
        {
            _lights      = oldComponent.GetValue <OWLight2[]>("_lights");
            _root        = oldComponent.GetValue <Transform>("_root");
            _basePivot   = oldComponent.GetValue <Transform>("_basePivot");
            _wobblePivot = oldComponent.GetValue <Transform>("_wobblePivot");
            Destroy(oldComponent.GetComponent <LightLOD>());

            foreach (var light in _lights)
            {
                light.GetLight().enabled = false;
                light.GetLight().shadows = LightShadows.Soft;
            }
            FlashlightOn = false;
        }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        tc       = GameObject.FindObjectOfType <TextController>();
        rb       = gameObject.GetComponent <Rigidbody>();
        animator = gameObject.GetComponentInChildren <Animator>();

        speed        = walkSpeed;
        flashlightOn = true;
        flashlightPrefab.GetComponent <Light>().enabled = flashlightOn;
        updatelastDir = false;

        state     = State.Move;
        direction = Direction.Down;
        lastDir   = new Vector3(0, 0, -1.0f);
    }
Esempio n. 4
0
	// Use this for initialization
	void Start () {
		anim = GetComponent<Animator> ();
		fLight = fLight.GetComponent<Flashlight> ();
		manager = manager.GetComponent<GameManager> ();

		rotationVector = fLight.transform.rotation.eulerAngles;
		rotationVector.y = 77.5f;

		//Playing AudioSources
		sources = new AudioSource[clips.Length];
		int i = 0;
		while (i < clips.Length)
		{
			GameObject child = new GameObject ("Player");
			child.transform.parent = gameObject.transform;
			sources[i] = child.AddComponent("AudioSource") as AudioSource;
			sources[i].clip = clips[i];
			i++;
		}
	}
    private void Update()
    {
        if (dying || !MenuManager.instance || !MenuManager.instance.running)
        {
            return;
        }
        LightRaycasts();
        RotateView();
        // The jump state needs to read here to make sure it is not missed
        if (!m_Jump)
        {
            m_Jump = CrossPlatformInputManager.GetButtonDown("Jump");
        }
        if (CrossPlatformInputManager.GetButtonDown("Jump") || Input.GetKeyDown(KeyCode.Mouse1))
        {
            m_Flashlight.GetComponent <Flashlight>().Toggle();
        }

        // If the player clicked and there's a function in clickHandler, run it and reset the delegate
        if (Input.GetMouseButtonDown(0) && clickHandler != null)
        {
            clickHandler();
        }
    }
Esempio n. 6
0
 public void AddBattery()
 {
     Debug.Log("PlayerController::AddBattery()");
     FlashLightGameObject.GetComponent <Flashlight>().RestoreBattery();
     // FlashLightGameObject.AddBattery();
 }