Пример #1
0
 void Start()
 {
     this.controller    = this.gameObject;
     this.character     = FindUtilities.TryFind(this.controller, "FirstPersonCharacter");
     this.clickCollider = FindUtilities.TryFind(this.character, "ClickCollider");
     solving            = false;
 }
Пример #2
0
 protected override void ShowBuildUp()
 {
     FindUtilities
     .TryFind(this.LinkedDoor.transform.parent.gameObject, "BuildUp")
     .GetComponent <TextMesh>()
     .text = buildUp;
 }
Пример #3
0
 protected virtual void ShowBuildUp()
 {
     FindUtilities
     .TryFind(this.transform.parent.parent.parent.gameObject, "BuildUp")
     .GetComponent <TextMesh>()
     .text = buildUp;
 }
Пример #4
0
 protected virtual void Start()
 {
     currentStringMesh = FindUtilities
                         .TryFind(this.gameObject, "Current String")
                         .GetComponent <TextMesh>();
     ClearCurrentString();
 }
Пример #5
0
    public static void PickUpTablet(GameObject tablet)
    {
        PlayerInventory.MyTablet     = tablet;
        PlayerInventory.TabletPuzzle = FindUtilities.TryFind(MyTablet, "Puzzle").GetComponent <TabletPuzzle>();
        TabletPuzzle.RemovedFromDock();
        MyTablet.transform.parent = parent.transform;
        WalkingView();
        keys = new char[TabletPuzzle.width * TabletPuzzle.height];
        int pseudoIndex = 0;

        for (int i = 0; i < TabletPuzzle.keys.Length; i++)
        {
            if (TabletPuzzle.keys[i] != '\'')
            {
                if (TabletPuzzle.keys[i] == '_')
                {
                    keys[pseudoIndex++] = '\0';
                }
                else
                {
                    keys[pseudoIndex++] = TabletPuzzle.keys[i];
                }
            }
        }
        TabletPuzzle.SetEnabledKeys(true);
    }
Пример #6
0
 // Use this for initialization
 protected virtual void Start()
 {
     myPuzzle = FindUtilities.TryFind(
         FindUtilities.TryFind(this.transform.parent.gameObject, "Pad"),
         "Puzzle").GetComponent <Puzzle>();
     GetComponent <BoxCollider>().enabled = false;
 }
Пример #7
0
 protected virtual void CompleteBuildUp()
 {
     FindUtilities
     .TryFind(this.transform.parent.parent.parent.gameObject, "BuildUp")
     .GetComponent <TextMesh>()
     .text = Hint.GetHintText();
 }
Пример #8
0
    public static bool DetectIfOnTablet(Key test)
    {
        GameObject block = FindUtilities
                           .TryFind(test.transform.parent.parent.gameObject, "Block");

        return(block != null && block.tag == "Tablet");
    }
Пример #9
0
    public virtual void Exit()
    {
        ExitButton eb = FindUtilities
                        .TryFind(this.transform.parent.parent.gameObject, "ExitButton")
                        .GetComponent <ExitButton>();

        eb.ExitPuzzle();
    }
Пример #10
0
    private void ExitPuzzle()
    {
        ExitButton eb = FindUtilities
                        .TryFind(this.character.transform.parent.parent.gameObject, "ExitButton")
                        .GetComponent <ExitButton>();

        eb.ExitPuzzle();
    }
Пример #11
0
 protected override void Start()
 {
     base.Start();
     this.available = false;
     FindUtilities.TryFind(this.gameObject, "KeyVal")
     .GetComponent <TextMesh>().text = "";
     this.defaultColor = Color.black;
 }
Пример #12
0
 protected override void Awake()
 {
     this.MyBlock = FindUtilities
                    .TryFind(this.transform.parent.gameObject, "Block")
                    .GetComponent <Block>();
     InitializeBoard();
     FillBoard();
     SetEnabledKeys(false);
 }
Пример #13
0
 private void PickUpKey(GameObject target)
 {
     homeObject  = target;
     homeKey     = target.GetComponent <DetachableKey>();
     dragging    = Object.Instantiate(DetachablePrefab, FindUtilities.TryFind("FirstPersonCharacter").transform);
     draggingKey = dragging.GetComponent <DetachableKey>();
     draggingKey.SetValue(homeKey.GetValue());
     dragging.GetComponent <BoxCollider>().enabled = false;
     draggingKey.Drag();
 }
Пример #14
0
 public virtual void LockPuzzle()
 {
     LockKeys();
     FindUtilities.TryFind(this.transform.parent.parent.gameObject, "SubmitButton").
     GetComponent <SubmitButton>().enabled = false;
     RemoveDoor();
     FindUtilities
     .TryFind(transform.parent.gameObject, "Block")
     .GetComponent <MeshRenderer>().material.color = ColorUtilities.SOLVED;
     Exit();
 }
Пример #15
0
 public static void PuzzleView()
 {
     if (MyTablet != null)
     {
         MyTablet.transform.localPosition = PUZZLE_POSITION;
         TabletPuzzle.SetEnabledKeys(true);
         FindUtilities.TryFind(MyTablet, "SubmitButton")
         .GetComponent <TabletSubmitButton>()
         .SetBoxColliderEnabled(true);
     }
 }
Пример #16
0
    private static void ToggleSolvingView(bool solving)
    {
        Vector3 copy = MyTablet.transform.localPosition;

        copy.x = solving ? SOLVING_POSITION.x : BACK_TO_WALKING_POSITION.x;
        copy.y = solving ? SOLVING_POSITION.y : BACK_TO_WALKING_POSITION.y;
        MyTablet.transform.localPosition = copy;
        FindUtilities.TryFind(MyTablet, "SubmitButton")
        .GetComponent <TabletSubmitButton>()
        .SetBoxColliderEnabled(true);
    }
Пример #17
0
 public override void CompletePuzzle()
 {
     this.complete = true;
     FindUtilities
     .TryFind(this.transform.parent.gameObject, "SubmitButton")
     .GetComponent <TabletSubmitButton>()
     .SetBoxColliderEnabled(false);
     this.RemoveDoor();
     FindUtilities
     .TryFind(this.transform.parent.gameObject, "Block")
     .GetComponent <MeshRenderer>().material.color = ColorUtilities.SOLVED;
 }
Пример #18
0
 public static void WalkingView()
 {
     if (MyTablet != null)
     {
         MyTablet.transform.localPosition    = new Vector3(0.3f, -0.3f, 0.8f);
         MyTablet.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
         MyTablet.transform.localScale       = new Vector3(0.4f, 0.4f, 0.4f);
         TabletPuzzle.SetEnabledKeys(false);
         FindUtilities.TryFind(MyTablet, "SubmitButton")
         .GetComponent <TabletSubmitButton>()
         .SetBoxColliderEnabled(false);
     }
 }
Пример #19
0
 void Update()
 {
     if (Input.GetKeyUp("q"))
     {
         if (PlayerInventory.HasTablet())
         {
             if (this.solving)
             {
                 Debug.Log("now trying to unsolve");
                 this.controller.GetComponent <CharacterController>().enabled = true;
                 this.controller
                 .GetComponent <FirstPersonController>()
                 .enabled     = true;
                 this.solving = false;
                 if (!PlayerInventory.GetPuzzle().IsComplete())
                 {
                     PlayerInventory.GetPuzzle().SetEnabledKeys(false);
                     PlayerInventory.GetPuzzle().ReleaseAllKeys();
                     PlayerInventory.GetPuzzle().ClearCurrentString();
                 }
                 Hint.ClearHint();
                 this.character.transform.parent = this.controller.transform;
                 PlayerInventory.GetTablet().transform.parent = this.character.transform;
                 PlayerInventory.BackToWalkingView();
             }
             else
             {
                 this.controller.GetComponent <Rigidbody>().velocity = Vector3.zero;
                 Debug.Log("now trying to solve");
                 this.controller.GetComponent <CharacterController>().enabled = false;
                 this.controller
                 .GetComponent <FirstPersonController>()
                 .enabled         = false;
                 Cursor.lockState = CursorLockMode.None;
                 this.solving     = true;
                 if (!PlayerInventory.GetPuzzle().IsComplete())
                 {
                     PlayerInventory.GetPuzzle().SetEnabledKeys(true);
                 }
                 Hint.SetHint(PlayerInventory.GetPuzzle().buildUp, PlayerInventory.GetPuzzle().words);
                 PlayerInventory.GetPuzzle().FillInHint();
                 PlayerInventory.SolvingView();
                 PlayerInventory.GetTablet().transform.parent = null;
                 this.character.transform.parent =
                     FindUtilities.TryFind(
                         PlayerInventory.GetPuzzle().gameObject.transform.parent.gameObject,
                         "Block").transform;
             }
         }
     }
 }
Пример #20
0
    // Use this for initialization
    protected virtual void Awake()
    {
        this.MyBlock = FindUtilities.TryFind(this.transform.parent.gameObject, "Block")
                       .GetComponent <Block>();
        this.MyKeypad = this.MyBlock.transform.parent.gameObject;

        ShowBuildUp();

        foundWords = new string[words.Length];
        foundIndex = 0;
        InitializeBoard();
        FillBoard();
        this.complete = false;
        SetEnabledKeys(false);
    }
Пример #21
0
 public void ExitPuzzle()
 {
     if (controller != null && BoardMutator.dragging == null)
     {
         PlayerInventory.BackToWalkingView();
         if (PlayerInventory.HasTablet())
         {
             PlayerInventory.ClearCurrent();
         }
         controller.GetComponent <CharacterController>().enabled = true;
         Puzzle p = FindUtilities.TryFind(
             FindUtilities.TryFind(this.transform.parent.gameObject, "Pad"),
             "Puzzle")
                    .GetComponent <Puzzle>();
         if (!p.IsComplete())
         {
             p.ReleaseAllKeys();
             p.ClearCurrentString();
         }
         p.SetEnabledKeys(false);
         if (transform.parent.tag != "Gift")
         {
             Light l = FindUtilities
                       .TryFind(this.transform.parent.gameObject, "Light")
                       .GetComponent <Light>();
             if (p.HasLeftovers())
             {
                 l.TurnOn();
             }
             else
             {
                 l.TurnOff();
             }
         }
         this.controller.GetComponent <FirstPersonController>().enabled = true;
         this.character.transform.parent           = controller.transform;
         this.character.transform.localPosition    = this.playerHead.localPosition;
         this.character.transform.localEulerAngles = this.playerHead.localEulerAngles;
         this.character.transform.localScale       = this.playerHead.localScale;
         Hint.ClearHint();
         this.controller.GetComponent <ZoomToTablet>().enabled = true;
         FindUtilities.TryFind(transform.parent.gameObject, "SubmitButton")
         .GetComponent <BoxCollider>().enabled = false;
     }
 }
Пример #22
0
 // Use this for initialization
 void Start()
 {
     controller    = FindUtilities.TryFind("FPSController");
     character     = FindUtilities.TryFind(controller, "FirstPersonCharacter");
     clickCollider = FindUtilities.TryFind(character, "ClickCollider");
 }
Пример #23
0
 // Use this for initialization
 protected override void Start()
 {
     myTabletPuzzle = FindUtilities
                      .TryFind(this.transform.parent.gameObject, "Puzzle")
                      .GetComponent <TabletPuzzle>();
 }
Пример #24
0
 void Start()
 {
     this.airlock = FindUtilities
         .TryFind(transform.parent.parent.gameObject, "Airlock")
         .GetComponent<Airlock>();
 }
Пример #25
0
 private void Interact(Collider other)
 {
     if (other.tag == "Keypad")
     {
         this.controller.GetComponent <Rigidbody>().velocity = Vector3.zero;
         PlayerInventory.PuzzleView();
         controller.GetComponent <CharacterController>().enabled = false;
         GameObject keypad = other.gameObject.transform.parent.gameObject;
         SavePlayerHeadTransform();
         FindUtilities.TryFind(keypad.transform.parent.gameObject, "ExitButton").GetComponent <ExitButton>().SetPlayerHead(this.playerHead);
         FindUtilities.TryFind(keypad.transform.parent.gameObject, "SubmitButton")
         .GetComponent <BoxCollider>().enabled = true;
         this.controller.GetComponent <FirstPersonController>().enabled = false;
         Cursor.lockState = CursorLockMode.None;
         Cursor.visible   = true;
         this.character.transform.parent           = keypad.transform;
         this.character.transform.localPosition    = KEYPAD_CAM_POSITION;
         this.character.transform.localEulerAngles = KEYPAD_CAM_LOCALEULER;
         Puzzle p = FindUtilities.TryFind(keypad, "Puzzle").GetComponent <Puzzle>();
         p.SetEnabledKeys(true);
         Hint.SetHint(p.buildUp, p.words);
         p.FillInHint();
         this.controller.GetComponent <ZoomToTablet>().enabled = false;
     }
     else if (other.tag == "Gift")
     {
         this.controller.GetComponent <Rigidbody>().velocity = Vector3.zero;
         PlayerInventory.PuzzleView();
         controller.GetComponent <CharacterController>().enabled = false;
         GameObject keypad = other.gameObject.transform.parent.gameObject;
         SavePlayerHeadTransform();
         FindUtilities.TryFind(keypad.transform.parent.gameObject, "ExitButton").GetComponent <ExitButton>().SetPlayerHead(this.playerHead);
         this.controller.GetComponent <FirstPersonController>().enabled = false;
         Cursor.lockState = CursorLockMode.None;
         Cursor.visible   = true;
         this.character.transform.parent                       = keypad.transform;
         this.character.transform.localPosition                = GIFT_CAM_POSITION;
         this.character.transform.localEulerAngles             = KEYPAD_CAM_LOCALEULER;
         this.controller.GetComponent <ZoomToTablet>().enabled = false;
         Puzzle p = FindUtilities.TryFind(keypad, "Puzzle").GetComponent <GiftPuzzle>();
         p.SetEnabledKeys(true);
     }
     else if (other.tag == "Dock" && PlayerInventory.HasTablet())
     {
         this.controller.GetComponent <Rigidbody>().velocity = Vector3.zero;
         PlayerInventory.PlaceTablet(other.gameObject.transform.parent);
         other.gameObject.GetComponent <Dock>().ReturnTablet();
     }
     else if (other.tag == "Tablet" && !PlayerInventory.HasTablet())
     {
         this.controller.GetComponent <Rigidbody>().velocity = Vector3.zero;
         if (!PlayerInventory.HasTablet())
         {
             FindUtilities
             .TryFind(other.gameObject.transform.parent.parent.gameObject, "DockBlock")
             .GetComponent <Dock>().TakeTablet();
             PlayerInventory.PickUpTablet(other.transform.parent.gameObject);
         }
         else
         {
             Debug.Log("Already holding a tablet.");
         }
     }
     else if (other.tag != "Key" && other.tag != "DetachableKey" &&
              other.tag != "NormalKey" && other.tag != "BlankKey" &&
              other.tag != "Keypad" && other.tag != "SubmitButton")
     {
         if (this.character.transform.parent != this.controller.transform)
         {
             this.ExitPuzzle();
         }
     }
 }
Пример #26
0
 public virtual void RemoveDoor()
 {
     Object.Destroy(FindUtilities.TryFind(this.transform.parent.parent.parent.gameObject, "Door"));
 }
Пример #27
0
 public virtual void SetValue(char c)
 {
     this.val = c;
     FindUtilities.TryFind(this.gameObject, "KeyVal")
     .GetComponent <TextMesh>().text = this.val.ToString();
 }