示例#1
0
    // Update is called once per frame
    void Update()
    {
        r = 0f;
        g = 0f;
        b = 0f;
        for (int i = 0; i < filters.Length; i++)
        {
            script           = filters [i].GetComponent <Clickable> ();
            filtersValue [i] = script.isInside;
        }

        for (int i = 0; i < filtersValue.Length; i++)
        {
            if (filtersValue [i])
            {
                script = filters [i].GetComponent <Clickable> ();
                if (script.myColor == Clickable.Colors.A)
                {
                    r = 1f;
                }
                if (script.myColor == Clickable.Colors.B)
                {
                    b = 1f;
                }
                if (script.myColor == Clickable.Colors.C)
                {
                    g = 1f;
                }
            }
        }
        newColor       = new Color(r, g, b, 1f);
        material.color = newColor;
    }
示例#2
0
        /// <summary>
        /// Detect, if the brush points at a paintable and set internal values (coordinates, distance, etc.)
        /// </summary>
        protected void UpdatePaintableCoords()
        {
            lastPaintable       = currentPaintable;
            lastPaintableCoords = currentPaintableCoords;

            RaycastHit hit;
            Ray        ray = GetRay();

            Debug.DrawRay(transform.position, ray.direction * RayDistance, Color.yellow, 0.2f, false);

            Paintable hitPaintable = null;

            currentClickable = null;

            if (Physics.Raycast(ray, out hit, RayDistance))
            {
                GameObject go = hit.collider.gameObject;
                hitPaintable     = go.GetComponent <Paintable>();
                currentClickable = go.GetComponent <Clickable>();
            }

            if (hitPaintable != null)
            {
                currentPaintableDistance = hit.distance;
                currentPaintable         = hitPaintable;
                currentPaintableCoords   = currentPaintable.Uv2Pixel(hit.textureCoord);
            }
            else
            {
                currentPaintable = null;
            }
        }
示例#3
0
        public void exitClick()
        {
            if (searching)
            {
                stopSearching = true;

                if (timer != null)
                {
                    timer.Dispose();
                }
                TurnPop(true);
                popup.SetActive(true);
            }
            else
            {
                popup.SetActive(false);
                foreach (var clickable in Clickable.Except(Clickable.Where(p => p.Parent == popup.grid)))
                {
                    clickable.Active = true;
                }

                chosenDeck             = null;
                Game1.self.popupToDraw = null;
                ClickableToRemove.ForEach(p => Clickable.Remove(p));
            }
        }
示例#4
0
 private void Clickable_MouseOut(Clickable sender)
 {
     if (!selected)
     {
         SetHighlighted(false);
     }
 }
示例#5
0
 private void Clickable_MouseDown(Clickable sender, UnityEngine.EventSystems.PointerEventData e)
 {
     this.dragging = true;
     this.lastY    = Input.mousePosition.y;
     this.angle    = Quaternion.Angle(this.model.rotation, this.targetOrientation.rotation);
     this.audio_Rotate.Play();
 }
            void SetupTroubleShootingBlock()
            {
                m_TroubleshootingBlock = provider.rootVisualElement.Q(k_TroubleshootingBlock);

                if (m_TroubleshootingBlock != null)
                {
                    m_TroubleshootingBlock.Q <Button>(k_TroubleToggle).clicked += ToggleTroubleshooting;

                    var accessDashboard = m_TroubleshootingBlock.Q(k_AccessAnalyticsDashboardLink);
                    if (accessDashboard != null)
                    {
                        var clickable = new Clickable(() =>
                        {
                            Application.OpenURL(string.Format(AnalyticsConfiguration.instance.dashboardUrl, Connect.UnityConnect.instance.projectInfo.projectGUID));
                        });
                        accessDashboard.AddManipulator(clickable);
                    }
                    var supportLink = m_TroubleshootingBlock.Q(k_SupportLink);
                    if (supportLink != null)
                    {
                        var clickable = new Clickable(() =>
                        {
                            Application.OpenURL(AnalyticsConfiguration.instance.supportUrl);
                        });
                        supportLink.AddManipulator(clickable);
                    }
                    CheckTroubleshootingModeVisibility(m_TroubleshootingBlock);
                }
            }
            public override void EnterState()
            {
                var generalTemplate = EditorGUIUtility.Load(k_AdsDisabledUxmlPath) as VisualTreeAsset;
                var scrollContainer = provider.rootVisualElement.Q(null, k_ServiceScrollContainerClassName);

                scrollContainer.Clear();
                if (generalTemplate != null)
                {
                    var newVisual = generalTemplate.CloneTree().contentContainer;
                    ServicesUtils.TranslateStringsInTree(newVisual);
                    scrollContainer.Add(newVisual);

                    var gettingStarted = scrollContainer.Q(k_GettingStartedLink);
                    if (gettingStarted != null)
                    {
                        var clickable = new Clickable(() =>
                        {
                            Application.OpenURL(ServicesConfiguration.instance.adsGettingStartedUrl);
                        });
                        gettingStarted.AddManipulator(clickable);
                    }
                    provider.UpdateServiceToggleAndDashboardLink(provider.serviceInstance.IsServiceEnabled());
                }
                scrollContainer.Add(ServicesUtils.SetupSupportedPlatformsBlock(ServicesUtils.GetAdsSupportedPlatforms()));
                provider.HandlePermissionRestrictedControls();
            }
示例#8
0
 public override void Interact(Action action, Clickable target)
 {
     if (action == Action.PICKUP_WATER)
     {
         CurrentState = Guy02State.WALKING_TO_WELL;
     }
 }
示例#9
0
        void SetupCrashDiag()
        {
            var crashDiagContainer = rootVisualElement.Q(className: k_CloudDiagCrashContainerClassName);

            if (crashDiagContainer == null)
            {
                return;
            }

            var generalTemplate = EditorGUIUtility.Load(k_CloudDiagCrashCommonUxmlPath) as VisualTreeAsset;

            if (generalTemplate != null)
            {
                var newVisual = generalTemplate.CloneTree().contentContainer;
                ServicesUtils.TranslateStringsInTree(newVisual);
                crashDiagContainer.Clear();
                crashDiagContainer.Add(newVisual);
                crashDiagContainer.Add(ServicesUtils.SetupSupportedPlatformsBlock(ServicesUtils.GetCloudDiagCrashSupportedPlatforms()));

                m_CrashServiceGoToDashboard = rootVisualElement.Q(k_CloudDiagCrashGoToDashboardName);
                if (m_CrashServiceGoToDashboard != null)
                {
                    var clickable = new Clickable(() =>
                    {
                        OpenDashboardOrgAndProjectIds(ServicesConfiguration.instance.baseCloudDiagCrashesDashboardUrl);
                    });
                    m_CrashServiceGoToDashboard.AddManipulator(clickable);
                }

                m_CrashServiceToggle = rootVisualElement.Q <Toggle>(className: k_ServiceToggleClassName);
                SetupServiceToggle();
                RegisterEvent();
            }
        }
示例#10
0
        public void ReDo()
        {
            ClickableToRemove = new List <IClickable>();
            Clickable.ForEach(p =>
            {
                if (p is Card || p is CardSlot)
                {
                    ClickableToRemove.Add(p);
                }
            });
            ClickableToRemove.ForEach(p => Clickable.Remove(p));
            grid.RemoveChildren();
            slots = new List <CardSlot>();
            for (int row = 0; row < 3; row++)
            {
                for (int column = 0; column < 5; column++)
                {
                    CardSlot c = new CardSlot(CardWidth, CardHeight, Game1.self.GraphicsDevice, Gui);
                    grid.AddChild(c, row, column);
                    c.clickEvent += CardSlotClick;
                    slots.Add(c);
                    Clickable.Add(c);
                }
            }
            var autoEvent = new AutoResetEvent(false);

            time  = 0;
            timer = new Timer(timerStart, autoEvent, 0, 1000);
            grid.UpdateP();
        }
示例#11
0
 public override void Interact(Action action, Clickable target)
 {
     if (CurrentState == GuyState.IDLE && action == Action.REPAIR_ROCKET)
     {
         NextState = GuyState.GOING_TOWARDS_ROCKET1;
     }
 }
示例#12
0
    private void DataCard_ButtonClicked(Clickable source)
    {
        var menuBundleCard = source as MenuBundleCard;

        Debug.Log("Clicked: " + menuBundleCard.AssetInfo.Name);
        MasterController.Instance.LoadBundle(menuBundleCard.AssetInfo);
    }
示例#13
0
    public bool CanInteractWith(Action action, Clickable target)
    {
        if (!target.enabled)
        {
            return(false);
        }

        if (interactions == null)
        {
            interactions = new Dictionary <Action, List <Clickable> >();
            for (int i = 0; i < actions.Count; i++)
            {
                if (!interactions.ContainsKey(actions[i]))
                {
                    interactions[actions[i]] = new List <Clickable>();
                }
                interactions[actions[i]].Add(targets[i]);
            }
        }

        if (interactions.ContainsKey(action))
        {
            foreach (Clickable c in interactions[action])
            {
                if (c.GetType() == target.GetType())
                {
                    PlaySound(yesTrack);
                    return(true);
                }
            }
        }
        PlaySound(noTrack);
        return(false);
    }
示例#14
0
    // Use this for initialization
    void Start()
    {
        var allClickables = GetComponentsInChildren <Clickable>();

        foreach (var clickable in allClickables)
        {
            if (clickable.gameObject.name == "dismissButton")
            {
                dismissButton = clickable;
            }
        }
        dismissButton.setClickReleaseCallback(dismiss);

        anim = GetComponent <Animator>();

        //choose random sprite
        if (spinner == null)
        {
            spinner = new RandomSpinner <Sprite>();
            AllTips.ForEach(t => spinner.addNewPossibility(5, t));
        }

        var things = this.GetComponentsInChildren <SpriteRenderer>();

        foreach (var renderer in things)
        {
            if (renderer.gameObject.name == "tip")
            {
                tipSprite = renderer;
            }
        }

        tipSprite.sprite = spinner.getRandom();
    }
示例#15
0
    public void LoadClickableInformation(BodyInformation leg)
    {
        Clickable clickable = this.gameObject.AddComponent(typeof(Clickable)) as Clickable;

        clickable.notifyInformation = leg.notifyInformation;
        // further -> PUT OnMouseOverIcon
    }
示例#16
0
 public void makeVC(Clickable item)
 {
     // Makes an item both visible and clickable
     //Debug.Log("Door "+door_number+": Making item "+item.itemName+" visible.");
     makeClickable(item);
     makeVisible(item);
 }
示例#17
0
        protected GameObject AddControl(string resourceName, Transform subDialog, Vector3 position, Vector3 scale, Action action = null)
        {
            GameObject prefab  = Resources.Load <GameObject>(resourceName);
            GameObject control = GameObject.Instantiate(prefab);

            control.transform.parent = subDialog;
            control.layer            = 5; //UI

            GameObject defaultObject = control.transform.Find(@"default").gameObject;

            defaultObject.layer             = 5;
            control.transform.localPosition = position;
            control.transform.localScale    = scale;
            control.transform.localRotation = Quaternion.Euler(0, 0, 0);

            Renderer renderer = defaultObject.GetComponent <Renderer>();

            if (action != null)
            {
                BoxCollider collider = control.AddComponent <BoxCollider>();

                //float scaleFactor = 1.8f;
                //collider.size = new Vector3((float)(renderer.bounds.size.x / scaleFactor), 1, (float)(renderer.bounds.size.y / scaleFactor));
                collider.size = new Vector3(2f, 1, 2f);

                Clickable clickable = control.AddComponent <Clickable>();
                clickable.Initialize(() => { action(); });
            }

            return(control);
        }
示例#18
0
    protected virtual Clickable GetClickableFromClick()
    {
        Ray        ray     = targetCamera.ScreenPointToRay(Input.mousePosition);
        RaycastHit hitInfo = new RaycastHit();

        if (Physics.Raycast(ray, out hitInfo))
        {
            Clickable   co  = null;
            Clickable[] cos = hitInfo.collider.GetComponents <Clickable>();
            for (int i = 0; i < cos.Length; i++)
            {
                if (cos[i].enabled)
                {
                    co = cos[i];
                    break;
                }
            }

            if (co)
            {
                co.Click();
                return(co);
            }
        }

        return(null);
    }
示例#19
0
        protected void IntialText(GameObject textObj, Transform subDialog, Vector3 position, Vector3 scale, Action action = null)
        {
            textObj.transform.SetParent(subDialog);
            textObj.layer = 5; //UI
            textObj.transform.localPosition = position;
            textObj.transform.localScale    = scale;

            TextMeshProUGUI container = textObj.GetComponent <TextMeshProUGUI>();
            //// container.bounds.size = new Vector3(50, 5, 1);

            RectTransform container2 = textObj.GetComponent <RectTransform>();

            //// container2.

            // container = 120;

            if (action != null)
            {
                BoxCollider collider = textObj.AddComponent <BoxCollider>();

                //float scaleFactor = 1.8f;
                //collider.size = new Vector3((float)(renderer.bounds.size.x / scaleFactor), 1, (float)(renderer.bounds.size.y / scaleFactor));
                collider.size = new Vector3(2f, 1, 2f);

                Clickable clickable = textObj.AddComponent <Clickable>();
                clickable.Initialize(() => { action(); });
            }
        }
示例#20
0
 public override void Interact(Action action, Clickable target)
 {
     if (action == Action.MAKE_POTION)
     {
         AudioSource audioS = GetComponent <AudioSource>();
         if (!bucketAtCauldron.activeSelf)
         {
             // NO WATER
             NextState   = Gal02State.IDLE;
             audioS.clip = angryTrack;
             audioS.Play();
             return;
         }
         Cauldron c = (Cauldron)target;
         if (!c.IsFull())
         {
             // NOT FULL
             audioS.clip = angryTrack;
             audioS.Play();
             NextState = Gal02State.IDLE;
             return;
         }
         audioS.clip = yesTrack;
         audioS.Play();
         NextState = Gal02State.APROACHING_CAULDRON;
     }
     else if (action == Action.GIVE_POTION && potionIsReady)
     {
         happyKid.SetActive(true);
         dyingKid.SetActive(false);
         GoToNextLevel();
     }
 }
            public override void EnterState()
            {
                LoadTemplateIntoScrollContainer(k_TemplatePath);

                m_ImportIapBlock  = provider.rootVisualElement.Q(k_ImportIapBlock);
                m_IapOptionsBlock = provider.rootVisualElement.Q(k_IapOptionsBlock);

                SetupWelcomeIapBlock();
                SetupImportIapBlock();
                SetupIapOptionsBlock();
                var scrollContainer = provider.rootVisualElement.Q(className: k_ScrollContainerClass);

                scrollContainer.Add(ServicesUtils.SetupSupportedPlatformsBlock(GetSupportedPlatforms()));

                var gotoDashboard = scrollContainer.Q(k_GoToDashboardLink);

                if (gotoDashboard != null)
                {
                    var clickable = new Clickable(() =>
                    {
                        Application.OpenURL(ServicesConfiguration.instance.purchasingDashboardUrl);
                    });
                    gotoDashboard.AddManipulator(clickable);
                }
                provider.HandlePermissionRestrictedControls();

                // Prepare the package section and update the package information
                PreparePackageSection(provider.rootVisualElement);
                UpdatePackageInformation();
            }
示例#22
0
    void onRelease(Clickable wasReleased)
    {
        //query all the things in the zone, notify them they are disposed
        var toRemove = new List <GameObject>();

        foreach (var thing in thingsInZone)
        {
            var outBoxable = thing.GetComponent <IoutBoxable>();
            if (outBoxable != null)
            {
                if (outBoxable.isSellable())
                {
                    player.giveMoney(outBoxable.sellWorth());
                }
                outBoxable.disposed();
                toRemove.Add(thing);
            }
        }

        foreach (var dead in toRemove)
        {
            thingsInZone.Remove(dead);
        }

        toRemove = null;
    }
示例#23
0
        void FinalizeServiceSetup()
        {
            var scrollContainer = rootVisualElement.Q(className: k_ScrollContainerClassName);
            var serviceTemplate = EditorGUIUtility.Load(k_ServiceTemplateUxmlPath) as VisualTreeAsset;

            var footer = scrollContainer.Q(k_FooterName);

            scrollContainer.Remove(footer);

            // Make sure to clear the dictionary if previously filled-up
            m_ClickableByServiceName.Clear();
            m_StatusLabelByServiceName.Clear();
            foreach (var singleCloudService in m_SortedServices.Values)
            {
                SetupService(scrollContainer, serviceTemplate, singleCloudService);
            }

            scrollContainer.Add(footer);

            var privacyClickable = new Clickable(() =>
            {
                Application.OpenURL(k_PrivacyPolicyUrl);
            });

            scrollContainer.Q(k_PrivacyPolicyLinkName).AddManipulator(privacyClickable);
        }
示例#24
0
        protected override void ActivateAction(string searchContext)
        {
            // Must reset properties every time this is activated
            var mainTemplate = EditorGUIUtility.Load(k_PurchasingServicesTemplatePath) as VisualTreeAsset;

            rootVisualElement.Add(mainTemplate.CloneTree().contentContainer);

            if (!PurchasingService.instance.IsServiceEnabled())
            {
                m_StateMachine.Initialize(m_DisabledState);
            }
            else
            {
                m_StateMachine.Initialize(m_EnabledState);
            }

            // Moved the Go to dashboard link to the header title section.
            m_GoToDashboard = rootVisualElement.Q(k_GoToDashboardLink);
            if (m_GoToDashboard != null)
            {
                var clickable = new Clickable(() =>
                {
                    ServicesConfiguration.instance.RequestBasePurchasingDashboardUrl(OpenDashboardForProjectGuid);
                });
                m_GoToDashboard.AddManipulator(clickable);
            }

            m_MainServiceToggle = rootVisualElement.Q <Toggle>(className: k_ServiceToggleClassName);
            SetupServiceToggle(PurchasingService.instance);

            InitializeServiceCallbacks();
        }
示例#25
0
 private void Clickable_Click(Clickable sender, UnityEngine.EventSystems.PointerEventData e)
 {
     if (this.seq == null)
     {
         PressButton();
     }
 }
示例#26
0
    private GameObject CheckClickInput()   // sending clicking and hovering messages
    // I'm assuing there's only one object in contact with player
    {
        RaycastHit hit;
        bool       isClicking = Input.GetMouseButton(0);

        if (Physics.Raycast(myCamera.transform.position, myCamera.transform.forward, out hit, Mathf.Infinity, runeLayer))
        {
            // if it's in "touching range"
            if (hit.distance <= interactRange)
            {
                Clickable hovered = hit.collider.gameObject.GetComponent <Clickable>();
                if (isClicking)
                {
                    hovered.Click();
                }
                else
                {
                    hovered.Hover();
                }

                return(hit.collider.gameObject);
            }
        }
        else
        {
            Debug.Log("no hit");
        }

        return(null);
    }
示例#27
0
    public override void CollectatbleTapped(GameObject collectable)
    {
        List <GameObject> list = new List <GameObject>();

        PocketDroidConstant.OBJECTTYPE = collectable.GetComponent <CollectableObject>().ObjectType;
        collectable.GetComponent <CollectableObject>().ObjectState = false;
        //if (PocketDroidConstant.OBJECTTYPE != 1 || (PocketDroidConstant.OBJECTTYPE == 1 && PocketDroidConstant.MONSTRER_ACTIVATED))
        //{
        //    collectable.GetComponent<CollectableObject>().ObjectState = false;
        //}
        if (PocketDroidConstant.USING_MAGICEYE)
        {
            Clickable  newClickable = new Clickable();
            GameObject newObj       = Instantiate(clickables[PocketDroidConstant.OBJECTTYPE], collectable.transform.position, Quaternion.identity);
            newClickable.type = PocketDroidConstant.OBJECTTYPE;
            newClickable.pos  = newObj.transform.position;
            newObj.AddComponent <Clickable>();

            PocketDroidConstant.shownObjects.Add(newClickable);
            PocketDroidConstant.USING_MAGICEYE = false;
            PocketDroidConstant.HINTTEXT       = "";
        }
        else
        {
            SceneTransitionManager.Instance.GoToScene(PocketDroidConstant.SCENE_CAPTURE, list);
        }
    }
            public override void EnterState()
            {
                CloudBuildPoller.instance.Disable(true);
                var generalTemplate = EditorGUIUtility.Load(k_CloudBuildDisabledUxmlPath) as VisualTreeAsset;
                var scrollContainer = m_Provider.rootVisualElement.Q(className: k_ServiceScrollContainerClassName);

                scrollContainer.Clear();
                if (generalTemplate != null)
                {
                    var disabledStateContent = generalTemplate.CloneTree().contentContainer;
                    ServicesUtils.TranslateStringsInTree(disabledStateContent);
                    scrollContainer.Add(disabledStateContent);
                    m_Provider.UpdateServiceToggleAndDashboardLink(m_Provider.serviceInstance.IsServiceEnabled());
                }

                var startUsing = m_Provider.rootVisualElement.Q(k_StartUsingCloudBuildLink);

                if (startUsing != null)
                {
                    var clickable = new Clickable(() =>
                    {
                        Application.OpenURL(ServicesConfiguration.instance.GetCloudBuildTutorialUrl());
                    });
                    startUsing.AddManipulator(clickable);
                }

                m_Provider.HandlePermissionRestrictedControls();
            }
示例#29
0
 void UpdateIgnoreWall()
 {
     if (ignoreWallClickable != null && !ignoreWallClickable.IsWall())
     {
         ignoreWallClickable = null;
     }
 }
示例#30
0
    /*
     * IEnumerator ExpulsionAlien()
     * {
     *  SetMovementState(AlienMovementState.Expulsion);
     *  currentClickableExpulsion = currentClickable;
     *  RectTransform rt = GetComponent<RectTransform>();
     *  Vector2 targetPosition = library.map.GetExpulsionTargetPosition(this, currentClickable);
     *  SetIgnoreWallClickable(currentClickable);
     *
     *  while (Vector2.Distance(rt.position, targetPosition) > 1f)
     *  {
     *      while (pauseInCupol || pauseInBlackHole)
     *          yield return null;
     *
     *      rt.position = Vector2.Lerp(rt.position, targetPosition, Time.deltaTime * 5);
     *
     *      yield return null;
     *  }
     *  currentClickableExpulsion = null;
     *  SetMovementState(AlienMovementState.Free);
     * }*/

    /*
     * IEnumerator PusherExpulsionAlienCoroutine()
     * {
     * SetMovementState(AlienMovementState.Expulsion);
     * currentClickableExpulsion = currentClickable;
     * currentFountainTarget = null;
     *
     * RectTransform rt = GetComponent<RectTransform>();
     * Vector2 targetPosition = library.map.GetPusherExpulsionTargetPosition(this, currentClickable);
     *
     * while (Vector2.Distance(rt.position, targetPosition) > 3f)
     * {
     *  while (pauseInCupol || pauseInBlackHole)
     *      yield return null;
     *
     *  rt.position = Vector2.Lerp(rt.position, targetPosition, Time.deltaTime * GameplayConstants.ExpulsionAlienSpeed);
     *
     *  yield return null;
     * }
     * currentClickableExpulsion = null;
     * SetMovementState(AlienMovementState.Free);
     * }*/

    /*
     * public void PusherExpulsionAlien()
     * {
     * if (currentMovableCoroutine != null)
     *  StopCoroutine(currentMovableCoroutine);
     *
     * if (currentWaitCoroutine != null)
     *  StopCoroutine(currentWaitCoroutine);
     *
     * StartCoroutine(PusherExpulsionAlienCoroutine());
     * }
     */

    IEnumerator MoveToCoroutine(Clickable clickable)
    {
        RectTransform rt = GetComponent <RectTransform>();
        //  RectTransform targetRt = null;

        //   targetRt = clickable.GetComponent<RectTransform>();

        bool isFinalTarget = false;

        if (wayQueue.Count == 0)
        {
            isFinalTarget = true;
            SetMovementState(AlienMovementState.MoveToPoint);
        }
        else
        {
            SetMovementState(AlienMovementState.MoveToJump);
        }
        Vector2 targetPosition = clickable.GetLocalPosition(isFinalTarget) /*- library.canvas.scaleFactor * new Vector3(0, DeltaHeight, 0)*/;


        while (Vector2.Distance(rt.anchoredPosition, targetPosition) > 1f)
        {
            while (pauseInCupol || pauseInBlackHole)
            {
                yield return(null);
            }

            Vector2 tempPosition = Vector2.MoveTowards(rt.anchoredPosition, targetPosition, Time.deltaTime * speed);

            /*
             * if (currentClickable.IsWall() && AlienInWall(tempPosition))
             * {
             *
             *  ////После столкновения со стеной на пару секунд надо забыть о фонтане.
             * //   SetLastTarget(currentClickable);
             *  SetIgnoreFountainClickable(currentFountainTarget);
             *  currentFountainTarget = null;
             * // isFoundFountain = false;
             *  currentMovementState = AlienMovementState.Free;
             *  StopAllCoroutines();
             * }
             * else*/
            rt.anchoredPosition = tempPosition;



            yield return(null);
        }
        //  rt.position = targetPosition;

        // SetLastTarget(clickable);

        if (currentMovementState.Equals(AlienMovementState.MoveToJump))
        {
            readyToJump = true;
        }

        MoveToTarget();
    }
示例#31
0
    IEnumerator JumpCoroutine(JumpDirection direction, Clickable clickable)
    {
        SetMovementState(AlienMovementState.Jump, direction);
        readyToJump = false;

        library.audioController.Jump();

        switch (direction)
        {
        case JumpDirection.RightUp: yield return(childAnim.GetComponent <Animator>().PlayAnimation(1)); break;

        case JumpDirection.LeftUp: yield return(childAnim.GetComponent <Animator>().PlayAnimation(2)); break;

        case JumpDirection.RightDown: yield return(childAnim.GetComponent <Animator>().PlayAnimation(3)); break;

        case JumpDirection.LeftDown: yield return(childAnim.GetComponent <Animator>().PlayAnimation(4)); break;
        }

        transform.position = childAnim.transform.position;
        transform.GetComponent <RectTransform>().anchoredPosition = new Vector2(transform.GetComponent <RectTransform>().anchoredPosition.x, transform.GetComponent <RectTransform>().anchoredPosition.y - fChild.GetComponent <RectTransform>().anchoredPosition.y);

        //      SetLastTarget(clickable);

        currentFloor = clickable.GetFloor();

        MoveToTarget();
    }
示例#32
0
    public void AddAsActor(Clickable actor)
    {
        if (!_order.actors.Contains(actor)) {
            _order.actors.Add(actor);
        }

        actor.OnSelect();
    }
示例#33
0
    public CountAnxiety(Clickable target, int required)
    {
		this.required = required;

		// Register for clicks
        ClickRcvr rcv = this.incrementCount;
        target.onClick(rcv);
    }
    private void HandleOnClick(Clickable clickable)
    {
        IsOn = !IsOn;

        if(OnClick != null)
        {
            OnClick(this);
        }
    }
    private void HandleOnClick_off(Clickable clickable)
    {
        IsOn = false;

        if(OnClick != null)
        {
            OnClick(this);
        }
    }
    private void HandleOnClick_on(Clickable clickable)
    {
        IsOn = true;

        if(OnClick != null)
        {
            OnClick(this);
        }
    }
    private void HandleOnClick(Clickable clickable)
    {
        if(OnClick != null)
        {
            OnClick(this);
        }

        if (state == 0)
        {
            state = 1;
        }
        else
        {
            if (state == 1)
            {
                state = 2;
            }
            else
            {
                if (state == 2)
                {
                    state = 3;
                }
                else
                {
                    if (state == 3)
                    {
                        state = 0;

                    }
                }
            }
        }

        UpdateSprite();
    }
示例#38
0
    public LightAnxiety(Clickable target, int required) : base(target, required)
	{
        this.target = target;
        this.required = required;
	}
示例#39
0
        private void FirstClickableRun(string text)
        {
            Tweet.Clickables = new List<Clickable>();
            Tweet.ClickablesToDo = new List<int>();
            int id = 0;
            System.Text.RegularExpressions.MatchCollection m = GetClickables.Matches(text);
            Dictionary<string, int> occurrencesOfMatches = new Dictionary<string, int>();
            foreach (System.Text.RegularExpressions.Match match in m)
            {
                if (occurrencesOfMatches.ContainsKey(match.Value.Trim(IgnoredAtChars)))
                {

                }
                var c = new Clickable {Text = match.Value.Trim(IgnoredAtChars), Id = id};
                Tweet.ClickablesToDo.Add(id);
                Tweet.Clickables.Add(c);
                id++;
            }
        }
示例#40
0
 public void makeUnVC(Clickable item)
 {
     // Makes an item invisible and unclickable
     makeUnclickable(item);
     makeInvisible(item);
 }
示例#41
0
 private void FirstClickableRun(string text)
 {
     Tweet.Clickables = new List<Clickable>();
     System.Text.RegularExpressions.MatchCollection m = GetClickables.Matches(text);
     foreach (System.Text.RegularExpressions.Match match in m)
     {
         Clickable c = new Clickable();
         c.Text = match.Value.Trim(IgnoredAtChars);
         Tweet.Clickables.Add(c);
     }
 }
示例#42
0
    // Use this for initialization
    void Start()
    {
        click = null;
        //gold.text = "100";
        mCamera = mainCamera.GetComponent<Camera>();
        itemDescriptionPanel = GameObject.Find("ButtonDescriptionPanel");
        itemDescriptionText = GameObject.Find("ButtonDescriptionText").GetComponent<Text>();
        damageText = GameObject.Find("DamageText").GetComponent<Text>();
        inventory = GameObject.Find("InventoryPanel").GetComponent<InventoryScript>();
        gold = GameObject.Find("GoldText").GetComponent<Text>();
        baseHealth = GameObject.Find("BaseHealthText").GetComponent<Text>();
        DeactivateInfo();

        click = GameObject.Find("NinjaContainer").GetComponent<WarriorAnimation>();
        click.SetSelectedCircle(true);
        healthText.text = (int)click.getCurrentHealth() + "/" + (int)click.getMaxHealth();
        manaText.text = click.getCurrentMana() + "/" + click.getMaxMana();
        name.text = click.getName();
        picture.sprite = click.getPicure();
        actionInspector.AddAllButtons(click.getButtons());

        if ( click is WarriorAnimation ) {
            damageText.text = "Damage: " + ((WarriorAnimation) click).Attack.Damage;
        }
        experienceBar.maxValue = click.getMaxExp();
        experienceBar.value = click.getCurrentExp();
        levelAndClassText.text = "Level " +click.getCurrentLevel() + " " + click.getClassName();
    }
示例#43
0
    public void GroundDestroyed(Clickable clickable)
    {
        GroundBlocks.Remove(clickable);

        _groundsDestroyed++;
        if (_groundsDestroyed % 3 == 0)
        {
            CameraFocusPoint.transform.position = CameraFocusPoint.transform.position.SetY(0) + new Vector3(0, Depth) - FocusPointOffset;
        }

        GenerateGround();
        ActiveAutoclickers.ForEach(x => x.GroundRemoved(Depth));
    }
示例#44
0
 private void FirstClickableRun(string text)
 {
     Tweet.Clickables = new List<Clickable>();
     Tweet.ClickablesToDo = new List<int>();
     int id = 0;
     System.Text.RegularExpressions.MatchCollection m = GetClickables.Matches(text);
     foreach (System.Text.RegularExpressions.Match match in m)
     {
         var c = new Clickable {Text = match.Value.Trim(IgnoredAtChars), Id = id};
         Tweet.ClickablesToDo.Add(id);
         Tweet.Clickables.Add(c);
         id++;
     }
 }
示例#45
0
        private void FindClickables(string line, Graphics g, int lineOffSet)
        {

            //Still need to handle "wrapped" links
            if (!ClientSettings.UseClickables) { return; }
            if (Tweet.ClickablesToDo.Count == 0) { return; }
            float position = ((lineOffSet * (ClientSettings.TextSize)));
            Clickable wrappedClick = null;
            foreach (Clickable c in Tweet.Clickables)
            {
                if (!Tweet.ClickablesToDo.Contains(c.Id))
                    continue;

                int i = line.IndexOf(c.Text);
                float startpos = 0;
                if (i >= 0)
                {
                    if (i > 0)
                    {
                        string LineBeforeThisWord = line.Substring(0, i);
                        startpos = g.MeasureString(LineBeforeThisWord, ClientSettings.TextFont).Width;
                    }
                    SizeF wordSize = g.MeasureString(c.Text, ClientSettings.TextFont);
                    c.Location = new RectangleF(startpos, position, wordSize.Width, wordSize.Height);
                    Tweet.ClickablesToDo.Remove(c.Id);
                }
                else{
                    //Check to see if clickable got wrapped
                    string lastWord = line;
                    string lineBeforeThisWord = "";
                    bool containsSpace = false;
                    if (line.IndexOf(" ") > 0)
                    {
                        lastWord = line.Substring(line.LastIndexOf(" "));
                        containsSpace = true;
                    }

                    if (c.Text.StartsWith(lastWord))
                    {
                        if (containsSpace)
                            lineBeforeThisWord = line.Substring(0, line.LastIndexOf(" "));
                        startpos = g.MeasureString(lineBeforeThisWord, ClientSettings.TextFont).Width;
                        SizeF wordSize = g.MeasureString(lastWord, ClientSettings.TextFont);
                        c.Location = new RectangleF(startpos, position, wordSize.Width, wordSize.Height);
                        //Find the rest of the word on the next line
                        if (lastWord.Length < c.Text.Length)
                        {
                            string secondPart = c.Text.Substring(lastWord.Length);
                            var wrapClick = new Clickable {Text = c.Text};
                            //Find the size of the word
                            wordSize = g.MeasureString(secondPart, ClientSettings.TextFont);
                            //A structure containing info we need to know about the word.
                            float nextPosition = (((lineOffSet + 1) * (ClientSettings.TextSize)));
                            wrapClick.Location = new RectangleF(0F, nextPosition, wordSize.Width, wordSize.Height);
                            wrappedClick = wrapClick;
                        }
                        Tweet.ClickablesToDo.Remove(c.Id);
                    }
                }
            }
            if (wrappedClick != null)
            {
                Tweet.Clickables.Add(wrappedClick);
            }
        }
示例#46
0
 public void makeClickable(Clickable item)
 {
     item.collider2D.enabled = true;
 }
示例#47
0
 public void makeVisible(Clickable item)
 {
     item.renderer.enabled = true;
 }
示例#48
0
 public void makeInvisible(Clickable item)
 {
     //Debug.Log("Door "+door_number+": Making item "+item.itemName+" INvisible.");
     item.renderer.enabled = false;
 }
示例#49
0
 public void AddAsSubject(Clickable Subject)
 {
     _order.subject = Subject;
     Subject.OnSelect();
 }
示例#50
0
 public void AddAsObject(Clickable ObjectAction)
 {
     _order.objectAction = ObjectAction;
 }
示例#51
0
    // Update is called once per frame
    void Update()
    {
        if ( Input.GetMouseButton(0) ) {
            Ray ray = mCamera.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if ( Physics.Raycast(ray, out hit, Mathf.Infinity, LayerMask.GetMask("Clickable")) ) {
                /*if(UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject()){
                    return;
                }*/
                DeactivateInfo();
                actionInspector.ResetButtons();
                click = hit.transform.gameObject.GetComponent<Clickable>();
                SetupUIForClick();
            }
        }

        if ( infoChanged ) {
            updateCharacterInfo();
        }
        CheckForTooltip();
    }
示例#52
0
        private void FindClickables(string Line, Graphics g, int lineOffSet)
        {

            //Still need to handle "wrapped" links
            if (!ClientSettings.UseClickables) { return; }
            float Position = ((lineOffSet * (ClientSettings.TextSize)));
            Clickable wrappedClick = null;
            foreach (Clickable c in Tweet.Clickables)
            {
                int i = Line.IndexOf(c.Text);
                float startpos = 0;
                if (i >= 0)
                {
                    if (i > 0)
                    {
                        string LineBeforeThisWord = Line.Substring(0, i);
                        startpos = g.MeasureString(LineBeforeThisWord.ToString(), ClientSettings.TextFont).Width;
                    }
                    SizeF WordSize = g.MeasureString(c.Text, ClientSettings.TextFont);
                    c.Location = new RectangleF(startpos, Position, WordSize.Width, WordSize.Height);
                }
                else{
                    //Check to see if clickable got wrapped
                    string lastWord = Line;
                    string LineBeforeThisWord = "";
                    if (Line.IndexOf(" ") > 0)
                    {
                        lastWord = Line.Substring(Line.LastIndexOf(" "));
                        LineBeforeThisWord = Line.Substring(0, Line.LastIndexOf(" "));
                    }

                    if (c.Text.StartsWith(lastWord))
                    {
                        startpos = g.MeasureString(LineBeforeThisWord.ToString(), ClientSettings.TextFont).Width;
                        SizeF WordSize = g.MeasureString(lastWord, ClientSettings.TextFont);
                        c.Location = new RectangleF(startpos, Position, WordSize.Width, WordSize.Height);
                        //Find the rest of the word on the next line
                        if (lastWord.Length < c.Text.Length)
                        {
                            string SecondPart = c.Text.Substring(lastWord.Length);
                            Clickable wrapClick = new Clickable();
                            wrapClick.Text = c.Text;
                            //Find the size of the word
                            WordSize = g.MeasureString(SecondPart, ClientSettings.TextFont);
                            //A structure containing info we need to know about the word.
                            float NextPosition = (((lineOffSet + 1) * (ClientSettings.TextSize)));
                            wrapClick.Location = new RectangleF(0F, NextPosition, WordSize.Width, WordSize.Height);
                            wrappedClick = wrapClick;
                        }
                    }
                }
            }
            if (wrappedClick != null)
            {
                Tweet.Clickables.Add(wrappedClick);
            }
        }
示例#53
0
 public void makeUnclickable(Clickable item)
 {
     item.collider2D.enabled = false;
 }