public void DebugWinning()
        {
            ////////////////////////////////////////////////DEBUG - can be removed

            foreach (NodeController node in nodes)
            {
                if (node.name == "Node1")
                {
                    node.NodeUntouched();
                    node.gameObject.tag = "Neighbor";
                }
                else if (node.name == "Node2")
                {
                    node.NodeActive();
                    _second = node;
                }
                else
                {
                    node.NodeTouched();
                }
            }
            foreach (LinkController link in links)
            {
                if (link.name == "Link1")
                {
                    link.LinkUntouched();
                }
                else
                {
                    link.LinkTouched();
                }
            }

            ////////////////////////////////////////////////DEBUG - can be removed
        }
Exemple #2
0
 public void InitializeLink()
 {
     LinkUntouched();
     LinkState           = LinkState.Untouched;
     nodeStartController = null;
     nodeEndController   = null;
 }
 public void ResetPuzzle()
 {
     ScarabCharacterController.Instance.LastNodeController = null;
     SetTextLoser(false);
     SetTextWinner(false);
     SetCrosshair(true);
     _first  = null;
     _second = null;
     InitializeNodes();
     InitializeLinks();
 }
 public void GetNeighborsOnly(NodeController nodeParam)
 {
     foreach (NodeController node in nodes)
     {
         node.gameObject.tag = "Untagged";
     }
     foreach (NodeController node in nodeParam.neighbors)
     {
         node.gameObject.tag = "Neighbor";
     }
     nodeParam.gameObject.tag = "Active";
 }
        public void HighlightLink()
        {
            if (_first != null)
            {
                _second = _first;
                _first  = null;
            }

            if (_first == null)
            {
                foreach (NodeController node in nodes)
                {
                    if (node.IsNodeClicked)
                    {
                        if (node != _second)
                        {
                            _first = node;
                        }
                    }
                }
            }

            StartCoroutine(GetFirstAndSecondCor());
        }
Exemple #6
0
 public void Execute(NodeController node)
 {
     node.GetComponent <MeshRenderer>().material = Resources.Load("Materials/NodeTouched", typeof(Material)) as Material;
     node.NodeState = NodeState.Touched;
     node.tag       = "Untagged";
 }
Exemple #7
0
        void Update()
        {
            if (!IsClickBlocked)
            {
                if (Input.GetMouseButtonDown(0))
                {
                    if (Physics.Raycast(this.transform.position, this.transform.forward, out _hit, distance))
                    {
                        if (_hit.collider.gameObject)
                        {
                            if ((_hit.collider.gameObject.CompareTag("Node") || _hit.collider.gameObject.CompareTag("Neighbor")))
                            {
                                if (resetNodes != null)
                                {
                                    resetNodes();
                                }
                                NodeController freshNodeController = _hit.collider.gameObject.GetComponent <NodeController>();
                                if (LastNodeController)
                                {
                                    if (!GameObject.ReferenceEquals(freshNodeController, LastNodeController))
                                    {
                                        foreach (LinkController link1 in freshNodeController.links)
                                        {
                                            foreach (LinkController link2 in LastNodeController.links)
                                            {
                                                if (link1 == link2)
                                                {
                                                    if (link1.LinkState == LinkState.Untouched)
                                                    {
                                                        LastNodeController = freshNodeController;
                                                        LastNodeController.SuccessNodeSound();
                                                        LastNodeController.PlayActiveNodeParticles();
                                                    }
                                                    else
                                                    {
                                                        LastNodeController.ForbiddenNodeSound();
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    LastNodeController = freshNodeController;
                                    LastNodeController.SuccessNodeSound();
                                    LastNodeController.PlayActiveNodeParticles();
                                }
                                LastNodeController.NodeActive();

                                LastNodeController.IsNodeClicked = true;
                                PuzzleManager.Instance.ScarabGameManager.HighlightLink();
                                StartCoroutine(CheckLinksCor());
                            }
                            else if (_hit.collider.gameObject.CompareTag("Untagged"))
                            {
                                NodeController lastNodeControllerUntagged = _hit.collider.gameObject.GetComponent <NodeController>();
                                if (lastNodeControllerUntagged)
                                {
                                    lastNodeControllerUntagged.ForbiddenNodeSound();
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #8
0
 public void Execute(NodeController node)
 {
     node.GetComponent <MeshRenderer>().material = Resources.Load("Materials/NodeActive", typeof(Material)) as Material;
     node.NodeState = NodeState.Active;
 }