1,添加电梯prop_lift_exit,-21.85,1.5,48,y角度270
2,为电梯的5个子对象勾选use light probes
3,在电梯下创建一个空对象用来存放碰撞器与子对象分隔开,命名为prop_lift_collider,reset.添加mesh collider,在Mesh添加prop_lift_exit_collision_001
2,为电梯的5个子对象勾选use light probes
3,在电梯下创建一个空对象用来存放碰撞器与子对象分隔开,命名为prop_lift_collider,reset.添加mesh collider,在Mesh添加prop_lift_exit_collision_001
4,为电梯添加box collider检测玩家是否进入,勾选(is trigger,没勾选后面电梯进不去)参数如图:015
5,再添加刚体和音频源组件,如图016
6,添加脚本DoneLiftDoorsTracking控制双层门的开关
using UnityEngine;
using System.Collections;
public class DoneLiftDoorsTracking : MonoBehaviour
{
public float doorSpeed = 7f; // How quickly the inner doors will track the outer doors.
private Transform leftOuterDoor; // Reference to the transform of the left outer door.
private Transform rightOuterDoor; // Reference to the transform of the right outer door.
private Transform leftInnerDoor; // Reference to the transform of the left inner door.
private Transform rightInnerDoor; // Reference to the transform of the right inner door.
private float leftClosedPosX; // The initial x component of position of the left doors.
private float rightClosedPosX; // The initial x component of position of the right doors.
void Awake ()
{
// Setting up the references.
leftOuterDoor = GameObject.Find("door_exit_outer_left_001").transform;
rightOuterDoor = GameObject.Find("door_exit_outer_right_001").transform;
leftInnerDoor = GameObject.Find("door_exit_inner_left_001").transform;
rightInnerDoor = GameObject.Find("door_exit_inner_right_001").transform;
// Setting the closed x position of the doors.
leftClosedPo