You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
2.5 KiB
83 lines
2.5 KiB
3 years ago
|
using AX.MessageSystem;
|
||
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
//Author:YHD
|
||
|
public class MBControl : BaseShuiQiangControl {
|
||
|
public override void InitGameObject()
|
||
|
{
|
||
|
part1 = TransformHelper.FindChild(transform, "paokou").gameObject;
|
||
|
water = TransformHelper.FindChild(transform,"Hose").gameObject;
|
||
|
|
||
|
tai= TransformHelper.FindChild(transform, "tai").gameObject;
|
||
|
}
|
||
|
|
||
|
public override void J(IMessage message)
|
||
|
{
|
||
|
if ((string)message.Data == this.gameObject.name)
|
||
|
{
|
||
|
part1.transform.Rotate(-Time.deltaTime * 40, 0, 0, Space.Self);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public override void U(IMessage message)
|
||
|
{
|
||
|
if ((string)message.Data == this.gameObject.name)
|
||
|
{
|
||
|
part1.transform.Rotate(Time.deltaTime * 40, 0, 0, Space.Self);
|
||
|
}
|
||
|
}
|
||
|
public override void ShuiQiangLeftRotate(IMessage message)
|
||
|
{
|
||
|
|
||
|
}
|
||
|
public override void ShuiQiangRightRotate(IMessage message)
|
||
|
{
|
||
|
|
||
|
}
|
||
|
public bool control = false;
|
||
|
bool first = true;
|
||
|
bool Second = false;
|
||
|
float T = 2f;
|
||
|
|
||
|
private GameObject tai;
|
||
|
private new void Update()//注意如果使用Update函数,请手动调用下父类的Update,否则会覆盖;也可直接使用LateUpdate或FixedUpdate
|
||
|
{
|
||
|
base.Update();
|
||
|
if (this.transform.Find("info/Function").GetComponent<TextMesh>().text == "灭火")
|
||
|
{
|
||
|
|
||
|
if (first)
|
||
|
{
|
||
|
//part1.transform.localEulerAngles = new Vector3(part1.transform.localEulerAngles.x, part1.transform.localEulerAngles.y, part1.transform.localEulerAngles.z + Time.deltaTime*5);
|
||
|
T -= Time.deltaTime;
|
||
|
tai.transform.Rotate(0, 0, Time.deltaTime * 15, Space.Self);//part1
|
||
|
if (T < 0)
|
||
|
{
|
||
|
first = false;
|
||
|
Second = true;
|
||
|
T = 0;
|
||
|
}
|
||
|
}
|
||
|
if (Second)
|
||
|
{
|
||
|
T += Time.deltaTime;
|
||
|
tai.transform.Rotate(0, 0, -Time.deltaTime * 15, Space.Self);//part1
|
||
|
//part1.transform.localEulerAngles = new Vector3(part1.transform.localEulerAngles.x, part1.transform.localEulerAngles.y, part1.transform.localEulerAngles.z - Time.deltaTime * 5);
|
||
|
if (T > 4)
|
||
|
{
|
||
|
first = true;
|
||
|
Second = false;
|
||
|
T = 4;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|