Inheritance: MonoBehaviour
Ejemplo n.º 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);
    }
 protected override void Start()
 {
     base.Start();
     door = GetComponent <DoorOpenClose>();
     door.OnDoorOpenStart += EnableBlackRoom;
     door.OnDoorCloseEnd  += DisableBlackRoomIfInMainHallway;
 }
 void Start()
 {
     thisDoor = GetComponent <DoorOpenClose>();
     foreach (DoorOpenClose door in doorsInThisSet)
     {
         if (door != thisDoor)
         {
             door.OnDoorOpenStart  += OpenThisDoor;
             door.OnDoorCloseStart += CloseThisDoor;
         }
     }
 }
Ejemplo n.º 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);
            }
        }
    }
Ejemplo n.º 5
0
 void Awake()
 {
     doorScript = transform.parent.GetComponent<DoorOpenClose>();
     player = GameObject.FindGameObjectWithTag(Tags.player);
 }
Ejemplo n.º 6
0
	// Use this for initialization
	void Awake () {
		doorControl = GetComponent<DoorOpenClose> ();
        
	}