Inheritance: MonoBehaviour
コード例 #1
0
    /*
     * Moved GetComponent to coroutine it is bad practice and expensive (in case of batch of colliders)
     * to use the method in Update
     */
    IEnumerator InvokeRotation(BoxCollider collider)
    {
        DoorOpenClose door = collider.GetComponent <DoorOpenClose>();

        door.StartRotation();
        yield return(null);
    }
コード例 #2
0
 protected override void Start()
 {
     base.Start();
     door = GetComponent <DoorOpenClose>();
     door.OnDoorOpenStart += EnableBlackRoom;
     door.OnDoorCloseEnd  += DisableBlackRoomIfInMainHallway;
 }
コード例 #3
0
 void Start()
 {
     thisDoor = GetComponent <DoorOpenClose>();
     foreach (DoorOpenClose door in doorsInThisSet)
     {
         if (door != thisDoor)
         {
             door.OnDoorOpenStart  += OpenThisDoor;
             door.OnDoorCloseStart += CloseThisDoor;
         }
     }
 }
コード例 #4
0
    // Update is called once per frame
    void Update()
    {
        GameObject Gate = GameObject.Find(nom);

        transform.GetChild(0).gameObject.SetActive(!isActivated);
        transform.GetChild(1).gameObject.SetActive(isActivated);
        DoorOpenClose gate1 = Gate.transform.GetChild(0).GetComponent <DoorOpenClose>();

        if (onActivator && Input.GetKeyDown(KeyCode.E))
        {
            isActivated = !isActivated;
            if (isActivated == true)
            {
                gate1.SetDestination(doorPositionFinal);
            }
            else
            {
                gate1.SetDestination(doorPositionInitial);
            }
        }
    }
コード例 #5
0
 void Awake()
 {
     doorScript = transform.parent.GetComponent<DoorOpenClose>();
     player = GameObject.FindGameObjectWithTag(Tags.player);
 }
コード例 #6
0
ファイル: DoorLockEvent.cs プロジェクト: Greymon94/JeffAndMe
	// Use this for initialization
	void Awake () {
		doorControl = GetComponent<DoorOpenClose> ();
        
	}