Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- using UnityEngine;
- namespace meta
- {
- public class TriggerCode : MonoBehaviour {
- void OnTriggerStay(Collider other) {
- try {
- if (other.attachedRigidbody) {
- other.attachedRigidbody.AddForce (Vector3.up * 10);
- }
- other.attachedRigidbody.GetComponentInChildren<FireTag> ().Ignite ();
- } catch {
- }
- /**
- try {
- other.GetComponent<FireTag>().Ignite();
- } catch {
- }**/
- }/**
- void OnTriggerEnter(Collider other) {
- if (other.attachedRigidbody) {
- other.attachedRigidbody.AddForce (Vector3.up * 10);
- }
- try {
- other.GetComponent<FireTag>().Ignite();
- } catch {
- }
- }**/
- }
- public class Mod : MonoBehaviour
- {
- public Mod() {
- }
- public void Start ()
- {
- }
- public bool LavaUp = false;
- GameObject Lava;
- bool LavaState = false;
- public Color LavaColor = Color.red;
- float TempColorLerpThing;
- public void Update () {
- if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.M) && LavaState == true) {
- GameObject.Destroy (GameObject.Find ("Lava"));
- Lava = null;
- TempColorLerpThing = 0;
- LavaColor = Color.red;
- LavaUp = false;
- LavaState = false;
- } else if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.M) && LavaState == false) {
- Lava = GameObject.CreatePrimitive (PrimitiveType.Cube);
- Lava.renderer.material.color = LavaColor;
- Lava.name = "Lava";
- Lava.transform.position = new Vector3 (0, 0.5f, 0);
- Lava.transform.localScale = new Vector3 (1000, 1, 1000);
- Lava.collider.enabled = true;
- Lava.collider.isTrigger = true;
- Lava.AddComponent<TriggerCode> ();
- //Lava.AddComponent<FireTag> ();
- //Lava.GetComponent<FireTag> ().Start ();
- //Lava.GetComponent<FireTag> ().Ignite ();
- LavaState=true;
- }
- if (GameObject.Find ("Lava") != null) {
- Lava.renderer.material.color = LavaColor;
- if (GameObject.Find ("Lava").transform.position.y < 0) {
- LavaUp = true;
- TempColorLerpThing = 0;
- }
- if (GameObject.Find ("Lava").transform.position.y > 0.5f) {
- LavaUp = false;
- TempColorLerpThing = 1;
- }
- if (LavaUp == true) {
- Lava.transform.position = new Vector3 (0, Lava.transform.position.y + 0.01f, 0);
- TempColorLerpThing += 0.002f;
- LavaColor = Color.Lerp (Color.red, Color.yellow, TempColorLerpThing);
- }
- if (LavaUp == false) {
- Lava.transform.position = new Vector3 (0, Lava.transform.position.y - 0.01f, 0);
- TempColorLerpThing -= 0.002f;
- LavaColor = Color.Lerp (Color.yellow, Color.red, TempColorLerpThing);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement