- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class BoxScript : MonoBehaviour
- {
- public Vector3 originalPos;
- public float timer;
- private Rigidbody rb;
- public bool condition;
- private PlayerController playerController;
- private BoxCollider bc;
- public Color color;
- public int boxNumber;
- public bool useColor;
- private Material mat;
- void Start()
- {
- originalPos = transform.position;
- rb = GetComponent<Rigidbody>();
- playerController = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>();
- bc = GetComponent<BoxCollider>();
- mat = GetComponent<Renderer>().material;
-
- }
- public void CheckPos()
- {
- originalPos = transform.position;
- }
- private void Update()
- {
-
- }
- public void Manipulation (bool condition)
- {
- this.condition = condition;
- if (this.condition)
- {
- rb.useGravity = false;
- transform.position = new Vector3(transform.position.x, originalPos.y + 0.5f, transform.position.z);
- mat.SetFloat("_Intensity",0.45f);
- }
- else
- {
- rb.useGravity = true;
- mat.SetFloat("_Intensity", 0f);
- }
- }
-
- }