Exemple #1
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;
            SceneObjectValueData objectData = SceneObjectValue.GetValue(heroKitObject, 0, 1, false);
            Color endColor = ColorValue.GetValue(heroKitObject, 2);
            float duration = (float)(IntegerFieldValue.GetValueA(heroKitObject, 3) * 0.10);

            wait = BoolValue.GetValue(heroKitObject, 4);

            // get the text component
            if (objectData.heroKitObject != null)
            {
                // execute action for all objects in list
                for (int i = 0; i < objectData.heroKitObject.Length; i++)
                {
                    ExecuteOnHeroObject(objectData.heroKitObject[i], endColor, duration);
                }
            }
            else if (objectData.gameObject != null)
            {
                // execute action for all objects in list
                for (int i = 0; i < objectData.gameObject.Length; i++)
                {
                    ExecuteOnGameObject(objectData.gameObject[i], endColor, duration);
                }
            }

            // set up update for long action
            eventID = heroKitObject.heroStateData.eventBlock;
            heroKitObject.heroState.heroEvent[eventID].waiting = wait;
            updateIsDone = false;
            heroKitObject.longActionsFixed.Add(this);

            //------------------------------------
            // debug message
            //------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Color: " + endColor + "\n" +
                                      "Duration: " + duration;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Exemple #2
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get field values
            startColor = ColorValue.GetValue(heroKitObject, 0);
            speed      = IntegerFieldValue.GetValueA(heroKitObject, 1) * 0.01f;

            // get the fade UI
            HeroKitObject targetObject = HeroKitCommonRuntime.GetPrefabFromAssets(HeroKitCommonRuntime.settingsInfo.fadeInOutScreen, true);
            bool          runThis      = (targetObject != null);

            if (runThis)
            {
                targetObject.gameObject.SetActive(true);

                // fade out the scene
                uiColor             = targetObject.GetHeroComponent <UIColor>("UIColor", true);
                uiColor.targetImage = targetObject.GetComponentInChildren <Image>(true);
                uiColor.targetColor = startColor;
                uiColor.startColor  = new Color(0, 0, 0, 0);
                uiColor.speed       = speed;
                uiColor.Initialize();

                // set up update for long action
                eventID = heroKitObject.heroStateData.eventBlock;
                heroKitObject.heroState.heroEvent[eventID].waiting = true;
                updateIsDone = false;
                heroKitObject.longActionsFixed.Add(this);
            }

            // show debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Speed: " + speed + "\n" +
                                      "Start Color:" + startColor;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            // return value
            return(-99);
        }
Exemple #3
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;

            // write messages?
            bool print = BoolValue.GetValue(heroKitObject, 0);

            if (print)
            {
                HeroKitCommonRuntime.writeMessage = BoolValue.GetValue(heroKitObject, 1);
                if (HeroKitCommonRuntime.writeMessage)
                {
                    float messageSpeed = SliderValue.GetValue(heroKitObject, 2);
                    if (messageSpeed < 0)
                    {
                        messageSpeed = 0;
                    }
                    if (messageSpeed > 100)
                    {
                        messageSpeed = 100;
                    }

                    // 0=100, 100=0. Then change to 0 to 1.
                    float waitTime = (100 - messageSpeed) * 0.01f;

                    HeroKitCommonRuntime.messageWaitTime = waitTime;
                }
            }

            // change message alignment?
            bool changeAlignment = BoolValue.GetValue(heroKitObject, 3);

            if (changeAlignment)
            {
                int alignID = DropDownListValue.GetValue(heroKitObject, 4);
                switch (alignID)
                {
                case 1:
                    HeroKitCommonRuntime.messageAlignment = TextAnchor.UpperLeft;
                    break;

                case 2:
                    HeroKitCommonRuntime.messageAlignment = TextAnchor.UpperCenter;
                    break;

                case 3:
                    HeroKitCommonRuntime.messageAlignment = TextAnchor.UpperRight;
                    break;

                case 4:
                    HeroKitCommonRuntime.messageAlignment = TextAnchor.MiddleLeft;
                    break;

                case 5:
                    HeroKitCommonRuntime.messageAlignment = TextAnchor.MiddleCenter;
                    break;

                case 6:
                    HeroKitCommonRuntime.messageAlignment = TextAnchor.MiddleRight;
                    break;

                case 7:
                    HeroKitCommonRuntime.messageAlignment = TextAnchor.LowerLeft;
                    break;

                case 8:
                    HeroKitCommonRuntime.messageAlignment = TextAnchor.LowerCenter;
                    break;

                case 9:
                    HeroKitCommonRuntime.messageAlignment = TextAnchor.LowerRight;
                    break;
                }
            }

            // change background alpha
            bool changeBackgroundAlpha = BoolValue.GetValue(heroKitObject, 5);

            if (changeBackgroundAlpha)
            {
                // get new alpha
                float alpha = SliderValue.GetValue(heroKitObject, 6);

                // keep alpha between 0 - 100
                if (alpha > 100)
                {
                    alpha = 100;
                }
                else if (alpha < 0)
                {
                    alpha = 0;
                }

                // switch to 0 - 1 scale
                alpha *= .01f;

                // change alpha
                HeroKitCommonRuntime.messageBackgroundAlpha = alpha;
                HeroKitCommonRuntime.changeMessageBackgroundTransparency = true;
            }

            // change background alpha
            bool changeButtonAlpha = BoolValue.GetValue(heroKitObject, 19);

            if (changeButtonAlpha)
            {
                // get new alpha
                float alpha = SliderValue.GetValue(heroKitObject, 20);

                // keep alpha between 0 - 100
                if (alpha > 100)
                {
                    alpha = 100;
                }
                else if (alpha < 0)
                {
                    alpha = 0;
                }

                // switch to 0 - 1 scale
                alpha *= .01f;

                // change alpha
                HeroKitCommonRuntime.messageButtonAlpha = alpha;
                HeroKitCommonRuntime.changeMessageButtonTransparency = true;
            }

            // change background image
            bool changeBackgroundImage = BoolValue.GetValue(heroKitObject, 7);

            if (changeBackgroundImage)
            {
                UnityObjectField unityObject = UnityObjectFieldValue.GetValueA(heroKitObject, 8);
                HeroKitCommonRuntime.messageBackgroundImage  = (unityObject.value != null) ? (Sprite)unityObject.value : null;
                HeroKitCommonRuntime.changeMessageBackground = true;
            }

            // change button image
            bool changeButtonImage = BoolValue.GetValue(heroKitObject, 9);

            if (changeButtonImage)
            {
                UnityObjectField unityObject = UnityObjectFieldValue.GetValueA(heroKitObject, 10);
                HeroKitCommonRuntime.messageButtonImage  = (unityObject.value != null) ? (Sprite)unityObject.value : null;
                HeroKitCommonRuntime.changeMessageButton = true;
            }

            // change button layout
            bool changeButtonLayout = BoolValue.GetValue(heroKitObject, 11);

            if (changeButtonLayout)
            {
                HeroKitCommonRuntime.messageButtonLayout       = DropDownListValue.GetValue(heroKitObject, 12);
                HeroKitCommonRuntime.changeMessageButtonLayout = true;
            }

            // change text color
            bool changeTextColor = BoolValue.GetValue(heroKitObject, 13);

            if (changeTextColor)
            {
                HeroKitCommonRuntime.messageTextColor       = ColorValue.GetValue(heroKitObject, 14);
                HeroKitCommonRuntime.changeMessageTextColor = true;
            }

            // change heading color
            bool changeHeadingColor = BoolValue.GetValue(heroKitObject, 15);

            if (changeHeadingColor)
            {
                HeroKitCommonRuntime.messageHeadingColor       = ColorValue.GetValue(heroKitObject, 16);
                HeroKitCommonRuntime.changeMessageHeadingColor = true;
            }

            // change button text color
            bool changeButtonTextColor = BoolValue.GetValue(heroKitObject, 17);

            if (changeButtonTextColor)
            {
                HeroKitCommonRuntime.messageButtonTextColor       = ColorValue.GetValue(heroKitObject, 18);
                HeroKitCommonRuntime.changeMessageButtonTextColor = true;
            }

            // change active button color
            bool changeButtonActiveColor = BoolValue.GetValue(heroKitObject, 21);

            if (changeButtonActiveColor)
            {
                HeroKitCommonRuntime.messageButtonActiveColor       = ColorValue.GetValue(heroKitObject, 22);
                HeroKitCommonRuntime.changeMessageButtonActiveColor = true;
            }

            if (heroKitObject.debugHeroObject)
            {
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, ("")));
            }

            return(-99);
        }
Exemple #4
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;
            String imageGroupPrefabName = "HeroKit Image Canvas";
            String imagePrefabName      = "HeroKit Image Sprite";
            int    imageID     = IntegerFieldValue.GetValueA(heroKitObject, 0);
            int    speed       = IntegerFieldValue.GetValueA(heroKitObject, 1);
            Color  targetColor = ColorValue.GetValue(heroKitObject, 2);

            wait = BoolValue.GetValue(heroKitObject, 3);

            HeroKitObject targetObject = null;
            Image         targetImage  = null;
            Color         currentColor = new Color();

            // get the game object that contains the images
            GameObject imageGroup = GetImageGroup(imageGroupPrefabName);

            if (imageGroup != null)
            {
                // get the game object that contains the image
                GameObject imageObject = GetImage(imagePrefabName, imageID, imageGroup);
                if (imageObject != null)
                {
                    // get the hero kit object
                    targetObject = heroKitObject.GetGameObjectComponent <HeroKitObject>("HeroKitObject", false, imageObject);

                    // get the image component on the game object
                    targetImage = heroKitObject.GetGameObjectComponent <Image>("Image", false, imageObject);
                    if (targetImage != null)
                    {
                        currentColor = targetImage.color;
                    }
                }
            }

            // pan the camera
            uiColor             = targetObject.GetHeroComponent <UIColor>("UIColor", true);
            uiColor.targetImage = targetImage;
            uiColor.targetColor = targetColor;
            uiColor.startColor  = targetImage.color;
            uiColor.speed       = speed;
            uiColor.Initialize();

            // set up update for long action
            eventID = heroKitObject.heroStateData.eventBlock;
            heroKitObject.heroState.heroEvent[eventID].waiting = wait;
            updateIsDone = false;
            heroKitObject.longActions.Add(this);

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Image ID: " + imageID + "\n" +
                                      "Target Image: " + targetImage + "\n" +
                                      "Target Color: " + targetColor + "\n" +
                                      "Speed: " + speed;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }