Inheritance: MonoBehaviour
 private void Start()
 {
     gameObject.AddComponent <InputManager>();
     inputManager = GetComponent <InputManager>();
     if (isPlayer)
     {
         playerDemoscene = GetComponent <DemoScene>();
     }
 }
Exemple #2
0
    void Update()
    {
        DemoScene scene = scenes[sceneID];

        if (scene == null)
        {
            return;
        }

        Vector2D newPosition = new Vector2D(scene.center.position);

        float rot = (float)Vector2D.Atan2(new Vector2D(scene.tracked.position), new Vector2D(scene.center.position));

        newPosition.Push(rot, scene.distance);

        Vector3 pos = Camera.main.transform.position;

        pos.x = pos.x * 0.95f + newPosition.ToVector2().x * 0.05f;
        pos.y = pos.y * 0.95f + newPosition.ToVector2().y * 0.05f;
        pos.z = -10;

        Camera.main.orthographicSize = Camera.main.orthographicSize * 0.95f + scene.cameraSize * 0.05f;

        Camera.main.transform.rotation = Quaternion.Lerp(Camera.main.transform.rotation, Quaternion.Euler(0, 0, (rot - Mathf.PI / 2) * Mathf.Rad2Deg), 0.05f);

        Camera.main.transform.position = pos;
        Color color;

        for (int i = 1; i < scenes.Length; i++)
        {
            if (scenes[i] == scene)
            {
                scenes[i].backgroundAlpha = scenes[i].backgroundAlpha * 0.95f + 0.05f;
            }
            else
            {
                scenes[i].backgroundAlpha = scenes[i].backgroundAlpha * 0.95f;
                color   = scenes[i].background.color;
                color.a = scenes[i].backgroundAlpha;
                scenes[i].background.color = color;
            }
        }

        color   = scene.background.color;
        color.a = scene.backgroundAlpha;
        scene.background.color = color;

        color   = scenes[0].background.color;
        color.a = 1;
        scenes[0].background.color = color;
    }
Exemple #3
0
        override protected void Initialize()
        {
            base.Initialize();
            Scene = new DemoScene();

#if DEBUG
            System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(System.Console.Out));

            // optionally render Nez in an ImGui window
            // var imGuiManager = new ImGuiManager();
            // Core.RegisterGlobalManager(imGuiManager);

            // optionally load up ImGui DLL if not using the above setup so that its command gets loaded in the DebugConsole
            System.Reflection.Assembly.Load("Nez.ImGui");
#endif
        }
    public void handleRope(bool state)
    {
        Rigidbody2D rig = transform.GetComponent <Rigidbody2D>();
        DemoScene   dem = transform.GetComponent <DemoScene>();

        dem.enabled = !state;
        switch (state)
        {
        case true:
            rig.bodyType = RigidbodyType2D.Dynamic;
            break;

        case false:
            rig.bodyType = RigidbodyType2D.Kinematic;
            //rig.velocity = Vector2.zero; take the velocity from the dynamic rigidbody and translate it to a "move" function
            controller.move(rig.velocity);
            rig.velocity = Vector2.zero;
            break;
        }
    }
Exemple #5
0
 // Use this for initialization
 void Start()
 {
     _player = GameObject.FindWithTag("Player").GetComponent <DemoScene>();
 }
Exemple #6
0
 private void Start()
 {
     inputCheck   = gameObject.GetComponent <DemoScene>();
     controller2D = gameObject.GetComponent <CharacterController2D>();
 }
Exemple #7
0
 // Use this for initialization
 void Start()
 {
     player   = GameObject.FindGameObjectWithTag("Player");
     movement = player.GetComponent <DemoScene>();
 }