]> git.lizzy.rs Git - SuperMouseAdventure.git/blob - 2DGame/Assets/Scripts/Scissors.cs
Herzen für die Bosse
[SuperMouseAdventure.git] / 2DGame / Assets / Scripts / Scissors.cs
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4
5 public class Scissors : MonoBehaviour
6 {
7     [SerializeField]
8     float speed;
9
10     [SerializeField]
11     float lifeTime = 10;
12
13     public void StartShoot(bool isFacingLeft)
14     {
15         Rigidbody2D rb2d = GetComponent<Rigidbody2D>();
16         if(isFacingLeft == true)
17         {
18             rb2d.velocity = new Vector2(-speed, 0);
19             transform.localScale = new Vector3(-0.4f, 0.4f, 1);
20         }
21         else
22         {
23             rb2d.velocity = new Vector2(speed, 0);
24             transform.localScale = new Vector3(0.4f, 0.4f, 1);
25         }
26
27         Destroy(gameObject, lifeTime);
28     }
29 }