示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.E) && touching)
        {
            foreach (Transform child in transform)
            {
                //Checking if the child object is not the minimap object by comparison of layer
                //May need tweaking if more children are added to the lever
                if (child.gameObject.layer == LayerMask.NameToLayer("Default"))
                {
                    childLock = child.GetComponent <StateStorage>();
                    childLock.UpdateState();
                }
            }
            this.GetComponent <StateStorage>().UpdateState();
        }

        //Must be called every second to be updated by time travel
        if (this.GetComponent <StateStorage>().state)
        {
            this.GetComponent <SpriteRenderer>().sprite = leverTurnLeft;
        }
        else
        {
            this.GetComponent <SpriteRenderer>().sprite = leverTurnRight;
        }
    }
示例#2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.E) && touching == true)
     {
         stateStorage.UpdateState();
         if (stateStorage.state)
         {
             cctrl.up8    = false;
             cctrl.down8  = false;
             cctrl.right8 = false;
             cctrl.left8  = false;
         }
     }
     //Must be done every second to account for changes with time travel
     if (stateStorage.state)
     {
         this.GetComponent <SpriteRenderer>().sprite = doorOpen;
         this.gameObject.tag = "gimmickNonWall";
     }
     else
     {
         this.GetComponent <SpriteRenderer>().sprite = doorClosed;
         this.gameObject.tag = "gimmick";
     }
 }
示例#3
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.name == "Feet")
        {
            this.GetComponent <StateStorage>().UpdateState();

            foreach (Transform child in transform)
            {
                if (child.gameObject.layer == LayerMask.NameToLayer("Default"))
                {
                    childLock = child.GetComponent <StateStorage>();
                    childLock.UpdateState();
                }
            }
        }
    }