Пример #1
0
 void Start()
 {
     myPosition = transform.position;
     floor      = GetComponent <Floor>();
     floor.FunctionAvailability(PitAvailability);
     floor.FunctionSetAvailability(SetPitAvailability);
     floor.isAvailable = false;
     enteredBlock      = null;
     lastCondition     = Attachment.Condititon.zero;
 }
Пример #2
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (enteredBlock == collision.gameObject)
     {
         enteredBlock           = null;
         BlockMoveEnteredBlock  = null;
         AttachmentEnteredBlock = null;
         filled        = false;
         isFloor       = false;
         lastCondition = Attachment.Condititon.zero;
     }
 }
Пример #3
0
 void FixedUpdate()
 {
     if (enteredBlock != null)
     {
         Vector2 posBlock   = enteredBlock.transform.position;
         Vector2 myPosition = this.myPosition;
         Attachment.Condititon enteredBlockCondition = AttachmentEnteredBlock.condititon;
         if (lastCondition != enteredBlockCondition && posBlock == myPosition && BlockMoveEnteredBlock && AttachmentEnteredBlock)
         {
             lastCondition = enteredBlockCondition;
             if (enteredBlockCondition == Attachment.Condititon.not_attached)
             {
                 enteredBlock.transform.position = new Vector3(posBlock.x, posBlock.y, 1);
                 BlockMoveEnteredBlock.enabled   = false;
                 filled            = true;
                 floor.isAvailable = true;
                 isFloor           = true;
                 BlockMoveEnteredBlock.condititon = BlockMove.Condititon.inPit;
                 return;
             }
             if (isFloor && enteredBlockCondition == Attachment.Condititon.attached)
             {
                 BlockMoveEnteredBlock.condititon = BlockMove.Condititon.underPit;
                 enteredBlock.transform.position  = new Vector3(posBlock.x, posBlock.y, 0);
                 BlockMoveEnteredBlock.enabled    = true;
                 filled            = true;
                 floor.isAvailable = false;
                 isFloor           = false;
                 return;
             }
             if (!isFloor && enteredBlockCondition == Attachment.Condititon.attached)
             {
                 BlockMoveEnteredBlock.condititon = BlockMove.Condititon.inPit;
                 return;
             }
         }
     }
 }