コード例 #1
0
 public void OnBeginDrag(PointerEventData eventData)
 {
     UIText.text = beingDraggedString;
     canvasGroup.blocksRaycasts = false;
     isTouched = true;
     if (isText)
     {
         slotTextIsIn = DropSlotTypeEnum.DropSlotType.DEFAULT;
     }
 }
コード例 #2
0
ファイル: GameManager.cs プロジェクト: Kyle-Smart/GDDCapstone
    private void CheckAndSetStatusOfDoor()
    {
        if (theDoor != null)
        {
            //Check in here if any of the objects are present then check their states
            if (Generator != null)
            {
                generatorStatus = aGenerator.IsGeneratorOn();
            }

            if (theButtons != null)
            {
                for (int i = 0; i < theButtons.Count; ++i)
                {
                    buttonStatuses[i] = theButtons[i].IsButtonPressed();
                }
            }

            if (MoveableText != null)
            {
                textAttachedTo = aText.slotTextIsIn;
            }


            //The draggable text is checked in the corrosponding things to attach to
            //If the clock has hit the door and opened it then we ignore this
            //EX: The Generator, the Button, and the Door handle the interaction and set powered or open true there
            if (!theDoor.hasClockHit)
            {
                if (buttonStatuses.Count < 1)
                {
                    if (generatorStatus)
                    {
                        theDoor.SetIsPowered(true);
                        theDoor.SetIsOpen(true);
                    }
                    else
                    {
                        theDoor.SetIsPowered(false);
                        theDoor.SetIsOpen(false);
                    }
                }
                else if (Generator == null)
                {
                    if (buttonStatuses[0])
                    {
                        theDoor.SetIsOpen(true);
                        theDoor.SetIsPowered(true);
                    }
                    else
                    {
                        theDoor.SetIsPowered(false);
                        theDoor.SetIsOpen(false);
                    }
                }
                else if (generatorStatus && buttonStatuses[0])
                {
                    theDoor.SetIsOpen(true);
                    theDoor.SetIsPowered(true);
                }
                else if (generatorStatus || buttonStatuses[0])
                {
                    theDoor.SetIsOpen(false);
                    theDoor.SetIsPowered(true);
                }
                else
                {
                    theDoor.SetIsOpen(false);
                    theDoor.SetIsPowered(false);
                }
            }

            if (theDoor.IsPowered())
            {
                DoorPoweredIndicator.GetComponent <SpriteRenderer>().enabled = true;
            }
            else
            {
                DoorPoweredIndicator.GetComponent <SpriteRenderer>().enabled = false;
            }
        }
    }