Exemplo n.º 1
0
    public void Spawn(Vector3 pos, Vector3 dir, bool forward)
    {
        _btm  = GetComponent <BadTimeMachine>();
        _body = GetComponent <Rigidbody>();

        direction = dir.normalized;

        transform.position = pos + direction * 1.3f;

        //_btm.forwardsInTime = forward;
        //_btm.backwardsInTime = !forward;
        _body.velocity = dir * speed;

        lifetime = lifespan;
    }
Exemplo n.º 2
0
    void FixedUpdate()
    {
        if (rewinding)
        {
            Collider[] colliders = Physics.OverlapSphere(transform.position, sphereRadius, 0x0100); // 0x0100 Stands for layer 8

            foreach (var collider in colliders)
            {
                int id = collider.gameObject.GetInstanceID();
                if (!rewindAffectedCubes.Contains(id))
                {
                    rewindAffectedCubes.Add(id);
                }
                BadTimeMachine badTimeMachine = rewindablesManager.GetBadTimeMachine(id);
                badTimeMachine.StopRecording();
                badTimeMachine.RewindFixedTimeFrame();
            }
        }
    }