Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public float moveSpeed = 5f;
- public Rigidbody2D rb;
- Vector2 movement;
- private GameObject mainCam;
- private GameObject skillsUI;
- public bool hasGotBulb;
- public bool hasGotFlashlight;
- public bool hasTalkedToFederna;
- public bool hasGotDog;
- public bool hasTalkedToMarcus;
- public bool hasTalkedToFrazer;
- public bool hasTalkedToJoel;
- public bool hasTalkedToLogan;
- public bool hasTalkedToTyler;
- public bool isInsideBar;
- public AudioSource jazzMusic;
- public bool trashHint;
- public bool lightbulbHint;
- public bool changedBulb;
- public bool dogReturned;
- public bool flashlightReturned;
- public bool trashCollected;
- public bool brokenFight;
- public bool talkedToCivilian;
- public bool gameFinished;
- public Animator animator;
- bool WalkingDown;
- bool NotWalkingDown;
- bool WalkingUp;
- bool NotWalkingUp;
- bool WalkingLeft;
- bool NotWalkingLeft;
- bool WalkingRight;
- bool NotWalkingRight;
- public string startPoint;
- static bool playerExists;
- private void Start()
- {
- mainCam = GameObject.Find("Main Camera");
- skillsUI = GameObject.Find("SkillsUI");
- WalkingDown = false;
- NotWalkingDown = true;
- WalkingUp = false;
- NotWalkingUp = true;
- WalkingRight = false;
- NotWalkingRight = true;
- WalkingLeft = false;
- NotWalkingLeft = true;
- hasGotBulb = false;
- hasGotFlashlight = false;
- hasTalkedToFederna = false;
- hasGotDog = false;
- hasTalkedToMarcus = false;
- hasTalkedToFrazer = false;
- hasTalkedToJoel = false;
- hasTalkedToLogan = false;
- hasTalkedToTyler = false;
- isInsideBar = false;
- DontDestroyOnLoad(this.gameObject);
- }
- void Update()
- {
- movement.x = Input.GetAxisRaw("Horizontal");
- movement.y = Input.GetAxisRaw("Vertical");
- if (Input.GetKeyDown(KeyCode.S))
- {
- WalkingDown = true;
- NotWalkingDown = false;
- }
- else if (Input.GetKeyUp(KeyCode.S))
- {
- NotWalkingDown = true;
- WalkingDown = false;
- }
- if (Input.GetKeyDown(KeyCode.W))
- {
- WalkingUp = true;
- NotWalkingUp = false;
- }
- else if (Input.GetKeyUp(KeyCode.W))
- {
- WalkingUp = false;
- NotWalkingUp = true;
- }
- if (Input.GetKeyDown(KeyCode.A))
- {
- WalkingLeft = true;
- NotWalkingLeft = false;
- }
- else if (Input.GetKeyUp(KeyCode.A))
- {
- WalkingLeft = false;
- NotWalkingLeft = true;
- }
- if (Input.GetKeyDown(KeyCode.D))
- {
- WalkingRight = true;
- NotWalkingRight = false;
- }
- else if (Input.GetKeyUp(KeyCode.D))
- {
- WalkingRight = false;
- NotWalkingRight = true;
- }
- if (isInsideBar == true)
- {
- jazzMusic.UnPause();
- }
- else
- {
- jazzMusic.Pause();
- }
- if (gameFinished == true)
- {
- Destroy(this.gameObject);
- Destroy(mainCam);
- Destroy(skillsUI);
- }
- }
- void FixedUpdate()
- {
- rb.MovePosition(rb.position + movement * moveSpeed * Time.fixedDeltaTime);
- if (WalkingDown == true)
- {
- animator.SetBool("isWalkingDown", true);
- }
- if (NotWalkingDown == true)
- {
- animator.SetBool("isWalkingDown", false);
- }
- if (WalkingUp == true)
- {
- animator.SetBool("isWalkingUp", true);
- }
- if (NotWalkingUp == true)
- {
- animator.SetBool("isWalkingUp", false);
- }
- if (WalkingLeft == true)
- {
- animator.SetBool("isWalkingLeft", true);
- }
- if (NotWalkingLeft == true)
- {
- animator.SetBool("isWalkingLeft", false);
- }
- if (WalkingRight == true)
- {
- animator.SetBool("isWalkingRight", true);
- }
- if (NotWalkingRight == true)
- {
- animator.SetBool("isWalkingRight", false);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement