Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
-1
Question by Rembo4Fight · Jan 04, 2018 at 07:49 AM · booleantimescalestatementaddon

Help ?Can Chronos Reverse Boolean Statement? Help

I'm using chronos and in my Time Reverse everything is okay, everything is rewindng except my boolean, its important because it is changing the rotation of my 2d enemy, how can it be done and can it be done? Here is a video of my problem https://youtu.be/VrEnWXs2NUw

And a script, another scripts just help rewind the time by time.timeScale

 using UnityEngine;
 using System.Collections;
 using Chronos;
 
 public class Scientist : BaseBehaviour {
 
     public float moveSpeed;
     public bool moveRight;
 
     public Transform sightStart, sightEnd;
 
     public Transform flipStart, flipEnd;
 
     public bool spotted = false;
 
     public bool flip = false;
 
     public GameObject arrow;
 
     public LayerMask detectionLayers;
 
     public Transform wallCheck;
     public float wallCheckRadius;
     public LayerMask whatIsWall;
     private bool hittingWall;
 
     public Transform edgeCheck;
     public float edgeCheckRadius;
     private bool notAtEdge;
 
     public float timer = 3f; //Чтобы изменить время остановки нужно изменить кроме этого значения еще значение ниже, того же timer
 
     public float smoothTime = 1f;
     private float yVelocity = 0.0f;
 
     Animator anim;
 
     private Rigidbody2D rb2d;
 
     void Start () {
 
         rb2d = gameObject.GetComponent<Rigidbody2D>();
 
         anim = GetComponent<Animator>();
 
     }
 
     void Update () {
 
         anim.SetFloat ("Speed", Mathf.Abs(rb2d.velocity.x));
 
         Raycasting ();
 
         Behaviours ();
 
 
         hittingWall = Physics2D.OverlapCircle (wallCheck.position, wallCheckRadius, whatIsWall);
 
         notAtEdge = Physics2D.OverlapCircle (edgeCheck.position, edgeCheckRadius, whatIsWall);
 
 
     }
 
     void FixedUpdate () 
     {
         if (hittingWall || !notAtEdge) {
 
             if (timer > 0) {
 
                 timer -= Time.deltaTime;
 
                 return;
             } 
 
             moveRight = !moveRight;
 
             timer = 3f;
         }
 
         if (moveRight) 
         { 
             transform.localScale = new Vector3 (0.75f, 0.75f, 1f);
             //rb2d.velocity = new Vector2(moveSpeed, rb2d.velocity.y);
             if (time.timeScale > 0) 
             {
                 time.rigidbody2D.velocity = new Vector2 (moveSpeed, time.rigidbody2D.velocity.y);
             }
         } else {
             transform.localScale = new Vector3 (-0.75f, 0.75f, 1f);
             //rb2d.velocity = new Vector2(-moveSpeed, rb2d.velocity.y);
             if (time.timeScale > 0) 
             {
                 time.rigidbody2D.velocity = new Vector2 (-moveSpeed, time.rigidbody2D.velocity.y);
             }
 
         }
 
         Physics2D.IgnoreLayerCollision (16,16); //Даёт возможность не сталкиваться врагам
     }
 
 
 
     void Raycasting() 
     {
         Debug.DrawLine (sightStart.position, sightEnd.position, Color.green);
         spotted = Physics2D.Linecast (sightStart.position, sightEnd.position, detectionLayers); 
 
         Debug.DrawLine (flipStart.position, flipEnd.position, Color.red);
         flip = Physics2D.Linecast (flipStart.position, flipEnd.position, detectionLayers);
     }
 
     void Behaviours() 
     {
         if (spotted == true) {
             arrow.SetActive (true);
             moveSpeed = Mathf.SmoothDamp(moveSpeed,4.5f,ref yVelocity,smoothTime);
         } else {
             arrow.SetActive (false);
             moveSpeed = Mathf.SmoothDamp(moveSpeed,2.5f,ref yVelocity, smoothTime);
         }
 
         if (flip == true && moveSpeed > 2.5f) 
         {
             moveRight = !moveRight; 
             moveSpeed = 2.5f;
         }
     }
 }
 
 
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Backside2357 · Jan 04, 2018 at 11:08 AM

Since this seems to be a specific problem with Chronos, you should ask your question in the Chronos support forum

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Rembo4Fight · Jan 04, 2018 at 11:48 AM 0
Share

I am already resolve this problem.by creating a timer which is when rewinding time also rewinds for flip the character Only problem what is last is that my character is fliping everytime. Can you help resolve this? I marked what was added It just goes from moveRight to !moveRight again and again

avatar image Rembo4Fight · Jan 04, 2018 at 11:50 AM 0
Share

Here is the code

     void FixedUpdate () 
     {
         if (hittingWall || !notAtEdge) {
 
             if (timer > 0) {
 
                 timer -= Time.deltaTime;
 
                 return;
             } 
 
             moveRight = !moveRight;
 
             timer = 3f;
 
             timeAfterRight = 0f;///////ADDED
         }
 
 
 
 
         if (moveRight) 
         { 
             timeAfterRight += time.deltaTime;
             transform.localScale = new Vector3 (0.75f, 0.75f, 1f);
             //rb2d.velocity = new Vector2(moveSpeed, rb2d.velocity.y);
             if (time.timeScale > 0) 
             {
                 time.rigidbody2D.velocity = new Vector2 (moveSpeed, time.rigidbody2D.velocity.y);
             }
             if (timeAfterRight < 0) /////////THIS WHAT IS I ADDED
             {
                 timeAfterRight = 1f; ////////
                 moveRight = false;/////////
             }
 
         } else {
             timeAfterRight += time.deltaTime;
             transform.localScale = new Vector3 (-0.75f, 0.75f, 1f);
             //rb2d.velocity = new Vector2(-moveSpeed, rb2d.velocity.y);
             if (time.timeScale > 0) 
             {
                 time.rigidbody2D.velocity = new Vector2 (-moveSpeed, time.rigidbody2D.velocity.y);
             }
             if (timeAfterRight < 0) /////////THIS WHAT IS I ADDED
             {
                 timeAfterRight = 1f;//////////
                 moveRight = true;////////
             }
         }
 

 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

121 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why is my animation being started, but is not actually playing? 1 Answer

Farming game Time management 0 Answers

Help with bools and if else statements. Animations 2 Answers

How do I create a static bool? 1 Answer

Why does my Gem counter not work? (screenshot included for explanation / easy code) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges