Example #1
0
    void SceneJoyControl()
    {
        stick      = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0);
        speed     += stick.x * 0.1f;
        Amplitude += stick.y * 0.05f;
        speed      = Mathf.Clamp(speed, 0.3f, 10.0f);
        Amplitude  = Mathf.Clamp(Amplitude, 0.2f, 5.0f);
        if (Input.GetButton("Fire1"))
        {
            Amplitude = 3f;
            speed     = 5f;
            GameObject cam = GameObject.FindGameObjectWithTag("MainCamera");
            cam.transform.position = camStartPosition;
            cam.transform.rotation = camStartRotation;
        }

        if (pointLinkTimer < 0 && Input.GetButton("Fire2"))
        {
            pointLinkTimer = 0.5f;
            drawGraphCos.GetComponent <AnimationSinVectorMesh>().pointLink = !drawGraphCos.GetComponent <AnimationSinVectorMesh>().pointLink;
            drawGraphSin.GetComponent <AnimationSinVectorMesh>().pointLink = !drawGraphSin.GetComponent <AnimationSinVectorMesh>().pointLink;
        }
        pointLinkTimer -= Time.deltaTime;

        if (mouseOrbitTimer < 0 && Input.GetMouseButton(1))
        {
            mouseOrbitTimer = 0.5f;
            MouseOrbitImproved mo = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <MouseOrbitImproved>();
            mo.enabled = !mo.enabled;
        }
        mouseOrbitTimer -= Time.deltaTime;
    }
Example #2
0
 public BallGraphics(Game game)
 {
     this.game       = game;
     ball            = game.GetBall();
     orbitalControls = game.orbitalControls;
     ballObject      = game.GetBallObject();
 }
Example #3
0
    void throwLogic(string Axis, GameObject item, bool right)
    {
        line.enabled = true;
        //Debug.Log(Axis);
        float throwAxis     = Input.GetAxis(Axis);
        bool  throwReleased = Input.GetButtonUp(Axis);

        MouseOrbitImproved mo = Camera.main.GetComponent <MouseOrbitImproved> ();
        float angle           = maxAngle * .5f;

        if (mo != null)
        {
            angle = Mathf.Deg2Rad * (maxAngle - (Camera.main.transform.eulerAngles.x - mo.yMinLimit) * (maxAngle) / (mo.yMaxLimit - mo.yMinLimit));
        }

        //this.transform.SetParent(Camera.main.transform);
        //transform.parent.gameObject.transform.forward = Vector3.Normalize(transform.forward);

        Vector3 throwVector = (transform.forward + new Vector3(0, angle, 0f)).normalized;

        GetComponentInParent <TurnToVelocity>().enabled = false;
        //Debug.Log("throwthrow");
        ThrowGuide(item, throwVector, transform.forward);
        aimingR = right;
        aimingL = !right;
    }
	void Start()
	{
		pContr = GameObject.FindWithTag("Player").GetComponent<PlayerController>();
		scrPC = GetComponent<PointingCamera>();
		scrMOI = GetComponent<MouseOrbitImproved>();
		mLook = GameObject.FindWithTag("Player").GetComponent<MouseLook>();
	}
Example #5
0
 void Start()
 {
     Gesture.onDraggingStartE += DraggingStartHandler;
     Gesture.onDraggingE += DraggingHandler;
     Gesture.onDraggingEndE += DraggingEndHandler;
     orbit = gameObject.GetComponent<MouseOrbitImproved>();
     megamanInitialX = Megaman.transform.localPosition.x;
     megamanInitialZ = Megaman.transform.localPosition.z;
 }
Example #6
0
    public static void SetMouseSensitivity(float to)
    {
        MouseOrbitImproved MOI = FindObjectOfType <MouseOrbitImproved>();

        if (MOI != null)
        {
            MOI.mouseSensitivity = to;
        }
    }
Example #7
0
    //Unity 5.5 and later does not support extracting an assetbundle compressed with LZMA in WebGL: https://blogs.unity3d.com/cn/2016/09/20/understanding-memory-in-unity-webgl/
    //we have to manually decompress and rebuild blocks and metadata. LZMA decompress block contents.
    //also, appearently unity wont open assetbundles built for another version, even if is able to do so.
    //see Decompressor.Attempt for how this is done.

    private void Awake()
    {
        if (instance != null)
        {
            Destroy(instance);
        }
        instance   = this;
        mouseOrbit = GameObject.FindObjectOfType <MouseOrbitImproved>();
    }
Example #8
0
 public CursorGraphics(Game game)
 {
     this.game           = game;
     cursor              = game.GetCursor();
     orbitalControls     = game.orbitalControls;
     cursorList          = game.GetCursorList();
     cursorTextObject    = game.GetCursorTextObject();
     cursorSubtextObject = game.GetCursorSubtextObject();
 }
Example #9
0
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         ThirdPersonUserControl controller = other.GetComponent <ThirdPersonUserControl>();
         if ((controller != null) && (controller.state != ThirdPersonUserControl.State.Dead))
         {
             MouseOrbitImproved.KillCharacter(controller);
         }
     }
 }
Example #10
0
    private void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
            return;
        }

        instance = this;
        DontDestroyOnLoad(gameObject);
    }
    // Use this for initialization
    void Start()
    {
        ball  = GetComponent <Rigidbody>();
        shots = 0;
        setPowerText();
        setShotsText();

        GameObject mainCamera = GameObject.Find("Main Camera");

        camScript = mainCamera.GetComponent <MouseOrbitImproved>();
    }
Example #12
0
 void Awake()
 {
     if (Instance == null)
     {
         DontDestroyOnLoad(gameObject);
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
Example #13
0
    private void Start()
    {
        world = World.GetInstance();
        cameraInitialPosition   = editCamera.transform.position;
        cameraInitialRotation   = editCamera.transform.rotation;
        cameraOrbitScript       = editCamera.GetComponent <MouseOrbitImproved>();
        cameraFirstPersonScript = player.GetComponent <RigidbodyFirstPersonController>();

        ModeChange(true);
        TerrainTypeChange(world.terrainData.useVoxels ? 1 : 0);
        UpdateUI();
        ResetLodPanel();
    }
Example #14
0
    void Throw(GameObject item, bool right)
    {
        Rigidbody rb = item.GetComponent <Rigidbody> ();

        MouseOrbitImproved mo = Camera.main.GetComponent <MouseOrbitImproved> ();
        float angle           = maxAngle * .5f;

        if (mo != null)
        {
            angle = Mathf.Deg2Rad * (maxAngle - (Camera.main.transform.eulerAngles.x - mo.yMinLimit) * (maxAngle) / (mo.yMaxLimit - mo.yMinLimit));
        }

        Vector3 throwVector = (transform.forward + new Vector3(0, angle, 0f)).normalized;

        Collider childCollider = item.transform.GetComponentInChildren <Collider> ();

        rb.AddForce(throwVector * force, ForceMode.Impulse);
        StartCoroutine(EnableColliders(.5f, childCollider, parentCollider));

        //if the item is a ball, the dog will fitch it (if it's around)
        if (item.GetComponent <tmpItem>().name == "Ball")
        {
            GameObject dog = GameObject.Find("Dog");
            if (dog != null)
            {
                dog.GetComponentInChildren <Dog>().Fetch(item);
            }
        }

        ReleaseItem(item);
        item = null;

        if (right)
        {
            item1         = null;
            pickedUpRight = false;
        }
        else
        {
            item2        = null;
            pickedUpLeft = false;
        }

        Debug.Log(item);
        rb.freezeRotation = false;
        line.enabled      = false;

        aimingR = false;
        aimingL = false;
    }
Example #15
0
    void Update()
    {
        volumeSliderText.text = (int)(volumeSlider.value * 100f) + "%";
        panSliderText.text    = (int)(panSlider.value * 100f) + "%";
        rotSliderText.text    = (int)(rotSlider.value * 100f) + "%";
        BoomBox.SetVolumeStat(volumeSlider.value);
        MouseOrbitImproved.SetMouseSensitivity(rotSlider.value);
        Game game = GameObject.Find("GameController").GetComponent <Game>();

        if (game != null)
        {
            game.SetPanSensitivity(panSlider.value);
        }
    }
Example #16
0
    private void Start()
    {
        var cvars = GameAPI.instance.cvarManager;

        if (cvars.Contains("gamePath"))
        {
            var path = cvars.Get("gamePath", "C:/Games/Mafia");
            Debug.Log("Game path was detected: " + path);

            gamePath = path;
            GameAPI.instance.SetGamePath(gamePath);
        }

        orbitCam = Camera.main.GetComponent <MouseOrbitImproved>();
    }
Example #17
0
    // Use this for initialization
    void Start()
    {
        orbiter = Camera.main.GetComponent <MouseOrbitImproved>();
        if (orbiter != null)
        {
            Debug.Log("Orbiter found");

            startMaterial = orbiter.target.gameObject.GetComponent <Renderer>().material;
            if (startMaterial != null)
            {
                Debug.Log("Start material found");
                currentMaterial        = startMaterial;
                currentShaderName.text = currentMaterial.shader.name;
            }
        }
    }
    void SetTarget()
    {
        ConstraintSource cs = new ConstraintSource();

        cs.sourceTransform = targets[curTargetIndex].transform;
        cs.weight          = 1;
        LookAtConstraint las = gameObject.GetComponent <LookAtConstraint>();

        las.SetSource(0, cs);


        MouseOrbitImproved moi = gameObject.GetComponent <MouseOrbitImproved>();

        moi.target = targets[curTargetIndex].transform;


        targetIndicator.transform.parent        = targets[curTargetIndex].transform;
        targetIndicator.transform.localPosition = Vector3.zero;
    }
Example #19
0
    void Throw(GameObject item, bool right)
    {
        Rigidbody rb = item.GetComponent <Rigidbody> ();

        MouseOrbitImproved mo = Camera.main.GetComponent <MouseOrbitImproved> ();
        float angle           = maxAngle * .5f;

        if (mo != null)
        {
            angle = Mathf.Deg2Rad * (maxAngle - (Camera.main.transform.eulerAngles.x - mo.yMinLimit) * (maxAngle) / (mo.yMaxLimit - mo.yMinLimit));
        }
        Vector3 throwVector = (/*Camera.main.*/ transform.forward + new Vector3(0, angle, 0f)).normalized;

        Collider childCollider = item.transform.GetComponentInChildren <Collider> ();

        rb.AddForce(throwVector * force, ForceMode.Impulse);
        StartCoroutine(EnableColliders(.5f, childCollider, parentCollider));
        ReleaseItem(item);
        item = null;

        if (right)
        {
            item1         = null;
            pickedUpRight = false;
        }
        else
        {
            item2        = null;
            pickedUpLeft = false;
        }

        Debug.Log(item);
        rb.freezeRotation = false;
        line.enabled      = false;

        aimingR = false;
        aimingL = false;
    }
 void Start()
 {
     //camera = GameObject.Find("CameraController").GetComponent<MouseOrbitImproved>();
     mainCamera = GameObject.Find("MainCamera").GetComponent <MouseOrbitImproved>();
 }
 void Awake()
 {
     Instance = this;
 }
    // Use this for initialization
    void Start()
    {
        flManager = GameObject.Find("_Required").GetComponent<FleetManager>();

        Transform[] tmp = this.GetComponentsInChildren<Transform>();
        for (int i = 0; i < tmp.Length; i++)
        {
            if (tmp[i].tag == "CameraPoint")
            {
                camPoint = tmp[i];
                cam = camPoint.GetComponent<Camera>();
                orbitView = camPoint.GetComponent<MouseOrbitImproved>();
            }

            if (tmp[i].tag == "ConstructionPoint")
            {
                constructionArea = tmp[i];
                if (orbitView != null)
                    orbitView.target = constructionArea;
            }
        }

        GameObject.FindGameObjectWithTag("required").GetComponent<Game>().AddSpaceStation(this);

        if (cam == null)
        {
            Debug.Log("NO CAMERA ON STATION:: " + name);
            return;
        }
        else
            cam.enabled = false;

        if (constructionArea == null)
        {
            Debug.Log("NO CONSTRUCTION AREA ON STATION:: " + name);
            return;
        }
    }
    void Start()
    {
        trailPlanet = 1;

        moi          = Camera.main.GetComponent <MouseOrbitImproved> ();
        moi.distance = PlayerPrefs.GetFloat("cameradistance", 500);

        numPlanets = PlayerPrefs.GetInt("numplan", 8);

        if (PlayerPrefs.GetInt("planCollide", 0) == 0)
        {
            planCollide = false;
        }
        else if (PlayerPrefs.GetInt("planCollide", 0) == 1)
        {
            planCollide = true;
        }

        planets = new Planet[numPlanets];

        planets[0] = GameObject.Find("Sun").GetComponent("Planet") as Planet;
        planets[0].GetComponent <Renderer>().material.color = Color.yellow;

//		planets[1] = GameObject.Find ("Sun2").GetComponent ("Planet") as Planet;
//		planets[1].renderer.material.color = Color.yellow;

        //planets[1] = GameObject.Find ("Planet").GetComponent ("Planet") as Planet;

        sourcePlanet = GameObject.Find("Planet").GetComponent("Planet") as Planet;


        //make thickness of trails change with zoom level
        //time trail lasts
        //scale everything down (change mass multipliers)
        //see why increased mass makes them turn faster


        if (planCollide)
        {
            //planets [1].collider.isTrigger = false;
            sourcePlanet.GetComponent <Collider>().isTrigger = false;
        }
        else
        {
            //planets [1].collider.isTrigger = true;
            sourcePlanet.GetComponent <Collider>().isTrigger = true;
        }

//		if (PlayerPrefs.GetInt ("trails") == 0)
//			trail.enabled = false;
//		else if(PlayerPrefs.GetInt ("trails") == 1)
//			trail.enabled = true;



        maxrange = PlayerPrefs.GetFloat("maxrange", 300f);

        massMax = PlayerPrefs.GetFloat("massMax", 30f);
        massMin = PlayerPrefs.GetFloat("massMin", 1f);

        speedMax = PlayerPrefs.GetFloat("speedMax", 4000f);
        speedMin = PlayerPrefs.GetFloat("speedMin", 1f);

        sizeMin = PlayerPrefs.GetFloat("sizeMin", 1f);;
        sizeMax = PlayerPrefs.GetFloat("sizeMax", 40f);;

        PlayerPrefs.GetInt("trails", 1);

        for (int i = 1; i < planets.Length; i++)
        {
            Vector3 randLoc = new Vector3(Random.Range(-maxrange, maxrange), Random.Range(-maxrange, maxrange), Random.Range(-maxrange, maxrange));

            //planets[i] = GameObject.Find ("Planet" + (i + 1).ToString()).GetComponent ("Planet") as Planet;
            //Planet newplanet = Instantiate (planets[1], randLoc, transform.rotation) as Planet;
            Planet newplanet = Instantiate(sourcePlanet, randLoc, transform.rotation) as Planet;
            planets[i] = newplanet;

            if (planCollide)
            {
                planets [i].GetComponent <Collider>().isTrigger = false;
            }
            else
            {
                planets [i].GetComponent <Collider>().isTrigger = true;
            }

            //planets[i].rigidbody.mass = Random.Range (PlayerPrefs.GetFloat ("massMin"), PlayerPrefs.GetFloat ("massMax"));
            planets[i].GetComponent <Rigidbody>().mass = Random.Range(massMin, massMax);

            //planets[i].renderer.material.color = new Color(Random.Range (0f,1f),Random.Range (0f,1f),Random.Range (0f,1f));
            planets[i].GetComponent <Renderer>().material.color =
                ColorFromHSV(Random.Range(0.0f, 360f), 1f, Random.Range(1f, 5f), 1f);

            float randScale = Random.Range(sizeMin, sizeMax);
            planets[i].transform.localScale += new Vector3(randScale, randScale, randScale);

            float   rand = Random.Range(0f, 1f);
            Vector3 dir;

            dir = new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), Random.Range(-1f, 1f));

            //planets[i].rigidbody.AddForce (dir * 9000);

            planets[i].GetComponent <Rigidbody>().velocity = (dir * Random.Range(speedMin, speedMax));
        }

        sourcePlanet.GetComponent <Renderer>().enabled = false;
    }
Example #24
0
 void Awake()
 {
     moi = GetComponent<MouseOrbitImproved>();
     inventory = GameObject.FindGameObjectWithTag(Tags.player).GetComponent<Inventory>();
     Screen.showCursor = false;
 }
Example #25
0
 void Awake()
 {
     instance = this;
 }
Example #26
0
 void OnDestory()
 {
     instance = null;
 }
    void FixedUpdate()
    {
        moi = Camera.main.GetComponent <MouseOrbitImproved> ();
        PlayerPrefs.SetFloat("cameradistance", moi.distance);

//		TrailRenderer trails = planets[3].GetComponent<TrailRenderer>();
//		trails.enabled = true;
//		trails.material.color = Color.green;

        //Debug.Log (moi.distance);

//		trail = planets[trailPlanet].GetComponent<TrailRenderer>();
//		trail.enabled = true;


        if (Input.GetKey(KeyCode.R))
        {
            Application.LoadLevel(0);
        }



        //Debug.Log (trailPlanet + ", " + planets.Length);
        for (int i = 0; i < planets.Length; i++)
        {
            trail = planets[i].GetComponent <TrailRenderer>();

            if (PlayerPrefs.GetInt("trails") == 0)
            {
                //trail.enabled = false;
                trail.startWidth = 0f;
                trail.endWidth   = 0f;
                if (i == trailPlanet)
                {
                    //trail.enabled = true;
                    trail.startWidth = planets[i].transform.localScale.x * 1f;
                    trail.endWidth   = 1f;
                }                //else {
//					//trail.enabled = false;
//					trail.startWidth = 0f;
//					trail.endWidth = 0f;
//				}
            }
            else if (PlayerPrefs.GetInt("trails") == 1)
            {
                //trail.enabled = true;
                trail.startWidth = planets[i].transform.localScale.x * 1f;
                trail.endWidth   = 1f;
            }

            Color nColor = planets[i].GetComponent <Renderer>().material.color;
            //nColor = ColorFromHSV(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), 1f);
            //ColorToHSV(nColor, Random.Range(0.0f, 1.0f),1.0f, 1.0f);
            Material traild = planets[i].GetComponent <TrailRenderer>().material;
            traild.SetColor("_Color", nColor);


            planets[i].GetComponent <Rigidbody>().AddForce((planets[0].transform.position - planets[i].transform.position)
                                                           / (planets[0].GetComponent <Rigidbody>().mass / 18));

//			for(int j = 0; j < planets.Length; j++){
//					if (i != j)
//					planets[i].rigidbody.AddForce((planets[j].transform.position - planets[i].transform.position)
//				                                   / (planets[j].rigidbody.mass / 18));
//
//			}
        }
    }
Example #28
0
    // Use this for initialization
    void Start()
    {
        GameObject mainCamera = GameObject.Find("Main Camera");

        camScript = mainCamera.GetComponent <MouseOrbitImproved>();
    }