Ejemplo n.º 1
0
        private static void CreateDollyTrackWithCart()
        {
            GameObject go = InspectorUtility.CreateGameObject(
                GenerateUniqueObjectName(typeof(CinemachineSmoothPath), "DollyTrack"),
                typeof(CinemachineSmoothPath));

            if (SceneView.lastActiveSceneView != null)
            {
                go.transform.position = SceneView.lastActiveSceneView.pivot;
            }
            Undo.RegisterCreatedObjectUndo(go, "create track");
            CinemachineSmoothPath path = go.GetComponent <CinemachineSmoothPath>();

            Selection.activeGameObject = go;

            go = InspectorUtility.CreateGameObject(
                GenerateUniqueObjectName(typeof(CinemachineDollyCart), "DollyCart"),
                typeof(CinemachineDollyCart));
            if (SceneView.lastActiveSceneView != null)
            {
                go.transform.position = SceneView.lastActiveSceneView.pivot;
            }
            Undo.RegisterCreatedObjectUndo(go, "create cart");
            CinemachineDollyCart cart = go.GetComponent <CinemachineDollyCart>();

            Undo.RecordObject(cart, "create track");
            cart.m_Path = path;
        }
Ejemplo n.º 2
0
 private void Start()
 {
     cart            = cart ?? GetComponentInChildren <CinemachineDollyCart>();
     cartTransform   = cart.transform;
     cart.m_Speed    = 0;
     cart.m_Position = 0;
 }
Ejemplo n.º 3
0
        void Awake()
        {
            CinemachineDollyCart = GetComponent <CinemachineDollyCart>();

            MovementEventOrchestrator.WipeRecordedMovementsEvent += Save;
            MovementEventOrchestrator.PlaybackFinishedEvent      += Load;
        }
Ejemplo n.º 4
0
        protected override void OnBeforeCreateArgumentPlayable(PlayableGraph graph, GameObject owner)
        {
            CinemachineDollyCart dc = dollyCart.Resolve(graph.GetResolver());

            if (dc != null)
            {
                dollCartMaxPathCount = dc.m_Path.MaxUnit(CinemachinePathBase.PositionUnits.PathUnits);
                dollyStartPos        = Mathf.Clamp(dollyStartPos, 0, dollCartMaxPathCount);
                dollyEndPos          = Mathf.Clamp(dollyEndPos, 0, dollCartMaxPathCount);
                switch (dc.m_PositionUnits)
                {
                case CinemachinePathBase.PositionUnits.Distance:
                    dollyStartPercent = dc.m_Path.GetPathDistanceFromPosition(dollyStartPos) / dc.m_Path.MaxUnit(dc.m_PositionUnits);
                    dollyEndPercent   = dc.m_Path.GetPathDistanceFromPosition(dollyEndPos) / dc.m_Path.MaxUnit(dc.m_PositionUnits);
                    break;

                case CinemachinePathBase.PositionUnits.PathUnits:
                    dollyStartPercent = dollyStartPos / dc.m_Path.MaxUnit(dc.m_PositionUnits);
                    dollyEndPercent   = dollyEndPos / dc.m_Path.MaxUnit(dc.m_PositionUnits);
                    break;
                }

                if (dollyEndPercent == 0)
                {
                    dollyEndPercent = 1;
                }
            }
            if (dollyStartPos > dollyEndPos)
            {
                dollyEndPos = dollyStartPos;
            }
            base.OnBeforeCreateArgumentPlayable(graph, owner);
        }
 private void Start()
 {
     if (cartToMove)
     {
         dCartComp         = cartToMove.GetComponent <CinemachineDollyCart>();
         dCartComp.m_Speed = 0f;
     }
 }
Ejemplo n.º 6
0
    protected void Awake()
    {
        inputMaster = new InputMaster();
        aimLocation = new Vector3(Screen.width / 2, Screen.height / 2, 0);

        dolly = GetComponentInParent <CinemachineDollyCart>();
        path  = (CinemachineSmoothPath)dolly.m_Path;
    }
Ejemplo n.º 7
0
 // Start is called before the first frame update
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     CalculatePathLink();
     cart = GetComponent <CinemachineDollyCart>();
 }
Ejemplo n.º 8
0
    private void Start()
    {
        cameraDollyCart = transform.GetComponent <CinemachineDollyCart>();
        //m_speed = m_maxSpeed;
        //cameraDollyCart.m_Speed = m_speed;

        cameraDollyCart.m_Path = path;

        trackLength = path.PathLength;
    }
Ejemplo n.º 9
0
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            dollyCart = playerData as CinemachineDollyCart;
            // float finalSpeed = 0f;
            // float finalWeight = 0f;

            if (!dollyCart)
            {
                return;
            }

            CacheStartState();

            int inputCount = playable.GetInputCount(); //get the number of all clips on this track


            for (int i = 0; i < inputCount; i++)
            {
                float inputWeight = playable.GetInputWeight(i);
                ScriptPlayable <CMDollyCartBehaviour> inputPlayable = (ScriptPlayable <CMDollyCartBehaviour>)playable.GetInput(i);
                CMDollyCartBehaviour input = inputPlayable.GetBehaviour();

                // finalWeight += inputWeight;

                // Use the above variables to process each frame of this playable.
                // finalSpeed += input.GetSpeed() * inputWeight;
                if (inputWeight == 1)
                {
                    // var maxTime = Mathf.Min((float)inputPlayable.GetTime(), (float)inputPlayable.GetDuration());
                    dollyCart.m_Speed = 0;

                    switch (input.positionMode)
                    {
                    case CMDollyCartBehaviour.PositionMode.BaseOnOriginal:
                        dollyCart.m_Position = m_DefaultPosition + (float)(inputPlayable.GetTime() * input.speed);
                        break;

                    case CMDollyCartBehaviour.PositionMode.CustomStart:
                        dollyCart.m_Position = input.customStart + (float)(inputPlayable.GetTime() * input.speed);
                        break;

                    case CMDollyCartBehaviour.PositionMode.DeltaTime:
                        dollyCart.m_Position += (float)(info.deltaTime * input.speed);
                        break;
                    }
                }
            }

            // Debug.Log(finalWeight);

            // dollyCart.m_Speed = 0;

            // if (finalWeight > 0)
            //     dollyCart.m_Position = m_DefaultPosition + (float)(playable.GetTime() * finalSpeed);
        }
Ejemplo n.º 10
0
        public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
        {
#if UNITY_EDITOR
            CinemachineDollyCart trackBinding = director.GetGenericBinding(this) as CinemachineDollyCart;
            if (trackBinding == null)
                return;

            driver.AddFromName<CinemachineDollyCart>(trackBinding.gameObject, "m_Position");
            driver.AddFromName<CinemachineDollyCart>(trackBinding.gameObject, "m_Speed");
#endif
            base.GatherProperties(director, driver);
        }
Ejemplo n.º 11
0
    private void Awake()
    {
        cinemachineDollyCart  = GetComponentInParent <CinemachineDollyCart>();
        carriage              = transform.Find("CarriageZone").GetComponent <Carriage>();
        particle_superSpeedup = transform.Find("Particle_Speedup").GetComponent <ParticleSystem>();
        playerCollider        = GetComponent <BoxCollider>();

        //Register button events
        GameController.OnSpeedup      += Speedup;
        GameController.OnSuperSpeedup += SuperSpeedup;
        currentState = StateID.Normal;
    }
Ejemplo n.º 12
0
    // Use this for initialization
    void Start()
    {
        int randomPathNumber = Random.Range(0, possiblePaths.Length);
        CinemachineDollyCart cartScriptRef = GetComponent <CinemachineDollyCart>();

        cartScriptRef.m_Path = possiblePaths[randomPathNumber];
        if (randomPathNumber == 1)
        {
            cartScriptRef.m_Speed = 1f;
        }
        if (randomPathNumber == 2)
        {
            cartScriptRef.m_Speed = 0.9f;
        }
    }
Ejemplo n.º 13
0
        private static void CreateDollyTrackWithCart()
        {
            GameObject go = new GameObject(
                GenerateUniqueObjectName(typeof(CinemachinePath), "DollyTrack"));

            Undo.RegisterCreatedObjectUndo(go, "create track");
            CinemachinePath path = Undo.AddComponent <CinemachinePath>(go);

            go = new GameObject(GenerateUniqueObjectName(typeof(CinemachineDollyCart), "DollyCart"));
            Undo.RegisterCreatedObjectUndo(go, "create cart");
            CinemachineDollyCart cart = Undo.AddComponent <CinemachineDollyCart>(go);

            Undo.RecordObject(cart, "create track");
            cart.m_Path = path;
        }
Ejemplo n.º 14
0
    // Use this for initialization
    void Start()
    {
        if (saveCamera == null)
        {
            saveCamera = GetComponent <Camera>();
        }

        Speed                  = 14.0f;
        refScriptCart          = gameObject.transform.GetChild(1).gameObject.GetComponent <CinemachineDollyCart>();
        refScriptTrack         = gameObject.transform.root.GetChild(1).gameObject.GetComponent <CinemachineSmoothPath>();
        refScriptVideoRecorder = gameObject.GetComponent <CaptureFromCamera>();
        refScriptVideoRecorder._outputFolderPath = Application.persistentDataPath + "/Save_Media/";
        refScriptCart.m_Position = 0;
        refScriptCart.m_Speed    = 0.0f;
    }
Ejemplo n.º 15
0
    protected override void Start()
    {
        base.Start();

        bossPath = BattleManager.Instance.GetBossPath();
        if (bossPath != null)
        {
            bossCart = BattleManager.Instance.GetBossCart();
            if (bossCart != null)
            {
                bossCartTran  = bossCart.transform;
                bossCartSpeed = bossCart.m_Speed;
            }
        }
        StartCoroutine(Summon());
    }
Ejemplo n.º 16
0
    public override void OnStartLocalPlayer()
    {
        rearView = GameObject.Find("RearView");
        // Info from C# (CPU) into de Shader (GPU)
        MaterialPropertyBlock propsBody = new MaterialPropertyBlock();

        propsBody.SetColor("_Color", new Color(235 / 255f, 125 / 255f, 52 / 255f));
        bodyRenderer = bodyObj.GetComponent <MeshRenderer>();
        bodyRenderer.SetPropertyBlock(propsBody);
        shootCooldown = 0;

        aimTarget       = GameObject.Find("AimTarget").GetComponent <Transform>();
        dollyGameObject = GameObject.Find("GameController");
        dolly           = GameObject.Find("GameController").GetComponent <CinemachineDollyCart>();
        cameraParent    = GameObject.Find("CameraHolder").transform;

        playerModel = transform.GetChild(0);
        SetSpeed(forwardSpeed);
        rearIsActive = false;
        //rearView.SetActive(true);
    }
Ejemplo n.º 17
0
 // Start is called before the first frame update
 void Start()
 {
     dollyCart = GetComponent <CinemachineDollyCart>();
 }
Ejemplo n.º 18
0
 void Start()
 {
     cart_ = ob.GetComponent <CinemachineDollyCart>();
 }
Ejemplo n.º 19
0
 private void OnEnable()
 {
     //myLineRenderer = GetComponent<LineRenderer>();
     playerDollyCart = player.GetComponent <CinemachineDollyCart>();
 }
Ejemplo n.º 20
0
 private void Start()
 {
     Time.timeScale = 0;
     endTime        = 0;
     dollyCart      = GetComponent <CinemachineDollyCart>();
 }
Ejemplo n.º 21
0
 private void Start()
 {
     cinemachineDollyCart = gameObject.GetComponent <CinemachineDollyCart>();
 }
Ejemplo n.º 22
0
 private void Awake()
 {
     cart          = GetComponent <CinemachineDollyCart>();
     virtualCamera = GetComponentInChildren <CinemachineVirtualCamera>();
 }
Ejemplo n.º 23
0
 private void Awake()
 {
     player    = GameObject.FindGameObjectWithTag("Player");
     dollyCart = GetComponent <CinemachineDollyCart>();
 }