size() public static method

public static size ( RectTransform rectTrans, Vector2 to, float time ) : LTDescr,
rectTrans UnityEngine.RectTransform
to Vector2
time float
return LTDescr,
Example #1
0
 //LeanTween.sequence
 //LeanTween.size (RectTransform)
 public static LTDescr LeanSize(this RectTransform rectTransform, Vector2 to, float time)
 {
     return(LeanTween.size(rectTransform, to, time));
 }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        switch (gameState)
        {
        case "StartGame":
            UpdateScreenDisplay();
            gameState = "StartGameWait";
            break;

        case "CharacterSelect":
            UpdateScreenDisplay();
            gameState = "CharacterSelectWait";
            break;

        case "AnalyticsSelect":
            UpdateScreenDisplay();
            ParseDisplayData(-1, saveDataObj);
            gameState = "AnalyticsSelectWait";
            break;

        case "LevelSelect":
            UpdateScreenDisplay();
            gameState = "LevelSelectWait";
            break;

        case "AnimateGarden":
            UpdateScreenDisplay();
            AnimationBreakNumber = 0;
            //gardenLogicObj.AnimateFlag = true;
            gameState = "AnimateGardenWait";
            break;

        case "PlayGame":
            startTime = Time.time;
            UpdateScreenDisplay();
            // Pop size of Letter
            LeanTween.size(DisplayGridTransform, DisplayGridTransform.sizeDelta * 1.1f, 0.75f).setDelay(0.5f).setEaseInOutCirc().setRepeat(4).setLoopPingPong();
            LeanTween.size(DisplayLetterTransform, DisplayLetterTransform.sizeDelta * 1.1f, 0.75f).setDelay(0.5f).setEaseInOutCirc().setRepeat(4).setLoopPingPong();
            // VO Instructions
            audioPlayIntro = true;
            playVOAudio("touch_and_say_letter");
            gameState = "PlayerSelectLetter";
            break;

        case "PlayerSelectLetter":
            if (audioPlayIntro)
            {
                AudioSource audioIntro = gameObject.GetComponent <AudioSource>();
                if (!audioIntro.isPlaying)
                {
                    playLetterAudio(currentDisplayLetter);
                    audioPlayIntro = false;
                }
            }
            break;

        case "AnimationBreak":
            UpdateScreenDisplay();
            StartAnimation(AnimationBreakNumber);
            gameState = "AnimationBreakWait";
            break;
        }
    }
	void Start () {
		// Time.timeScale = 1f/4f;
		
		// *********** Main Window **********
		// Scale the whole window in
		mainWindow.localScale = Vector3.zero;
		LeanTween.scale( mainWindow, new Vector3(1f,1f,1f), 0.6f).setEase(LeanTweenType.easeOutBack);
		LeanTween.alphaCanvas( mainWindow.GetComponent<CanvasGroup>(), 0f, 1f).setDelay(2f).setLoopPingPong().setRepeat(2);

		// Fade the main paragraph in while moving upwards
		mainParagraphText.anchoredPosition3D += new Vector3(0f,-10f,0f);
		LeanTween.textAlpha( mainParagraphText, 0f, 0.6f).setFrom(0f).setDelay(0f);
		LeanTween.textAlpha( mainParagraphText, 1f, 0.6f).setEase(LeanTweenType.easeOutQuad).setDelay(0.6f);
		LeanTween.move( mainParagraphText, mainParagraphText.anchoredPosition3D + new Vector3(0f,10f,0f), 0.6f).setEase(LeanTweenType.easeOutQuad).setDelay(0.6f);

		// Flash text to purple and back
		LeanTween.textColor( mainTitleText, new Color(133f/255f,145f/255f,223f/255f), 0.6f).setEase(LeanTweenType.easeOutQuad).setDelay(0.6f).setLoopPingPong().setRepeat(-1);

		// Fade button in
		LeanTween.textAlpha(mainButton2, 1f, 2f ).setFrom(0f).setDelay(0f).setEase(LeanTweenType.easeOutQuad);
		LeanTween.alpha(mainButton2, 1f, 2f ).setFrom(0f).setDelay(0f).setEase(LeanTweenType.easeOutQuad);

		// Pop size of button
		LeanTween.size(mainButton1, mainButton1.sizeDelta * 1.1f, 0.5f).setDelay(3f).setEaseInOutCirc().setRepeat(6).setLoopPingPong();


		// *********** Pause Button **********
		// Drop pause button in
		pauseWindow.anchoredPosition3D += new Vector3(0f,200f,0f);
		LeanTween.moveY( pauseWindow, pauseWindow.anchoredPosition3D.y + -200f, 0.6f).setEase(LeanTweenType.easeOutSine).setDelay(0.6f);

		// Punch Pause Symbol
		RectTransform pauseText = pauseWindow.Find("PauseText").GetComponent<RectTransform>();
		LeanTween.moveZ( pauseText, pauseText.anchoredPosition3D.z - 80f, 1.5f).setEase(LeanTweenType.punch).setDelay(2.0f);

		// Rotate rings around in opposite directions
		LeanTween.rotateAroundLocal(pauseRing1, Vector3.forward, 360f, 12f).setRepeat(-1);
		LeanTween.rotateAroundLocal(pauseRing2, Vector3.forward, -360f, 22f).setRepeat(-1);
		

		// *********** Chat Window **********
		// Flip the chat window in
		chatWindow.RotateAround(chatWindow.position, Vector3.up, -180f);
		LeanTween.rotateAround(chatWindow, Vector3.up, 180f, 2f).setEase(LeanTweenType.easeOutElastic).setDelay(1.2f);

		// Play a series of sprites on the window on repeat endlessly
		LeanTween.play(chatRect, chatSprites).setLoopPingPong();

		// Animate the bar up and down while changing the color to red-ish
		LeanTween.color( chatBar2, new Color(248f/255f,67f/255f,108f/255f, 0.5f), 1.2f).setEase(LeanTweenType.easeInQuad).setLoopPingPong().setDelay(1.2f);
		LeanTween.scale( chatBar2, new Vector2(1f,0.7f), 1.2f).setEase(LeanTweenType.easeInQuad).setLoopPingPong();

		// Write in paragraph text
		string origText = chatText.text;
		chatText.text = "";
		LeanTween.value(gameObject, 0, (float)origText.Length, 6f).setEase(LeanTweenType.easeOutQuad).setOnUpdate( (float val)=>{
			chatText.text = origText.Substring( 0, Mathf.RoundToInt( val ) );
		}).setLoopClamp().setDelay(2.0f);

		// Raw Image
		LeanTween.alpha(rawImageRect,0f,1f).setLoopPingPong();
	}
    public static void ActivateMemoryScenePortal(int scnID)
    {
        MemoryScene activeScene = null;
        MemoryScene nextScene   = null;

        bool found = false;

        if (MemoryScenes != null)
        {
            for (int i = 0; i < MemoryScenes.Count; i++)
            {
                if (MemoryScenes[i] != null)
                {
                    if (MemoryScenes[i].id == scnID)
                    {
                        //MemoryScenes[i].gameObject.SetActive(true);
                        //GameHandler.Instance.playerCharacter.transform.position = MemoryScenes[i].startPosition.position;
                        //GameHandler.Instance.memoryCamera.transform.position = new Vector3(MemoryScenes[i].startPosition.position.x, MemoryScenes[i].startPosition.position.y, GameHandler.Instance.memoryCamera.transform.position.z);
                        //GameHandler.Instance.playerCharacter.GetComponent<CharacterController>().active = true;

                        nextScene = MemoryScenes[i];
                        found     = true;
                    }
                    else if (MemoryScenes[i].active)
                    {
                        activeScene = MemoryScenes[i];
                    }
                    //else MemoryScenes[i].gameObject.SetActive(false);
                }
            }
        }
        if (!found)
        {
            Debug.LogError("Scene Not Found");
            return;
        }

        if (nextScene != null /* && activeScene != null*/)
        {
            Debug.Log("Openning Scene\nNextScene " + nextScene.name + "\nActiveScene " + activeScene);
            Canvas nextSceneCanvas = nextScene.sceneEntryPortal.GetComponent <Canvas>();
            if (nextSceneCanvas != null)
            {
                GameHandler.Instance.InitPlayer(); // Temporary

                //Make Portal huge
                LeanTween.size(nextSceneCanvas.GetComponent <RectTransform>(), Vector2.one * 60, 5f).setOnComplete(() =>
                {
                    nextSceneCanvas.gameObject.SetActive(false);
                    GameHandler.Instance.playerCharacter.GetComponent <CharacterController>().active = true;
                    GameHandler.Instance.playerCharacter.GetComponent <CharacterController>().m_activationHandler = nextScene.sceneActivationHandler;
                    GameHandler.Instance.soundManager.PlayNext();


                    if (activeScene != null)
                    {
                        activeScene.gameObject.SetActive(false);
                    }

                    //Activate the things in next scene
                    if (nextScene.sceneObjects != null)
                    {
                        for (int i = 0; i < nextScene.sceneObjects.Count; i++)
                        {
                            nextScene.sceneObjects[i].SetActive(true);
                        }
                    }

                    nextScene.active   = true;
                    activeScene.active = false;
                });
            }
        }
        else
        {
            Debug.LogError("Active Scene :" + activeScene + " .. \nNext Scene " + nextScene);
        }
    }
 public void CloseMenu()
 {
     LeanTween.moveX(basePanelTransform, basePanelClosedPos.x, basePanelOpenSpeed);
     LeanTween.size(basePanelTransform, basePanelClosedSize, basePanelOpenSpeed).setOnComplete(OnMenuClosed);
     mainPanel.SetActive(false);
 }
Example #6
0
        private void buildTween(LeanTweenItem item, float delayAdd, bool generateCode)
        {
            float delay = item.delay + delayAdd;
            bool  code  = generateCode;
            float d     = item.duration;

            // Debug.Log("item.gameObject:"+item.gameObject+" name:"+item.gameObject.transform.name);
            if (item.gameObject == null)
            {
                item.gameObject = gameObject;
            }
            // Debug.Log("item:"+item.action);
            if (item.action == TweenAction.ALPHA)
            {
                tween = code ? append("alpha", item.to.x, d) : LeanTween.alpha(item.gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.ALPHA_VERTEX)
            {
                tween = code ? append("alphaVertex", item.to.x, d) : LeanTween.alphaVertex(item.gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE)
            {
                tween = code ? append("move", item.to, d) : LeanTween.move(item.gameObject, item.to, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL)
            {
                tween = code ? append("moveLocal", item.to, d) : LeanTween.moveLocal(item.gameObject, item.to, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL_X)
            {
                tween = code ? append("moveLocalX", item.to.x, d) : LeanTween.moveLocalX(item.gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL_Y)
            {
                tween = code ? append("moveLocalY", item.to.x, d) : LeanTween.moveLocalY(item.gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_LOCAL_Z)
            {
                tween = code ? append("moveLocalZ", item.to.x, d) : LeanTween.moveLocalZ(item.gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_X)
            {
                tween = code ? append("moveX", item.to.x, d) : LeanTween.moveX(item.gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_Y)
            {
                tween = code ? append("moveY", item.to.x, d) : LeanTween.moveY(item.gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_Z)
            {
                tween = code ? append("moveZ", item.to.x, d) : LeanTween.moveZ(item.gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.MOVE_CURVED)
            {
                tween = code ? append("move", item.bezierPath ? item.bezierPath.vec3 : null, d) : LeanTween.move(item.gameObject, item.bezierPath.vec3, d);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath(" + item.orientToPath.ToString().ToLower() + ")");
                    }
                    else
                    {
                        tween.setOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
            }
            else if (item.action == TweenAction.MOVE_CURVED_LOCAL)
            {
                tween = code ? append("moveLocal", item.bezierPath ? item.bezierPath.vec3 : null, d) : LeanTween.moveLocal(item.gameObject, item.bezierPath.vec3, d);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath(" + item.orientToPath + ")");
                    }
                    else
                    {
                        tween.setOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
            }
            else if (item.action == TweenAction.MOVE_SPLINE)
            {
                tween = code ? append("moveSpline", item.splinePath ? item.splinePath.splineVector() : null, d) : LeanTween.moveSpline(item.gameObject, item.splinePath.splineVector(), d);
                if (item.orientToPath)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath(" + item.orientToPath + ")");
                    }
                    else
                    {
                        tween.setOrientToPath(item.orientToPath);
                    }
                }
                if (item.isPath2d)
                {
                    if (code)
                    {
                        codeBuild.Append(".setOrientToPath2d(true)");
                    }
                    else
                    {
                        tween.setOrientToPath2d(item.isPath2d);
                    }
                }
            }
            else if (item.action == TweenAction.ROTATE)
            {
                tween = code ? append("rotate", item.to, d) : LeanTween.rotate(item.gameObject, item.to, d);
            }
            else if (item.action == TweenAction.ROTATE_AROUND)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAround(gameObject, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAround(item.gameObject, item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.ROTATE_AROUND_LOCAL)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAroundLocal(gameObject, " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAroundLocal(item.gameObject, item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.ROTATE_LOCAL)
            {
                tween = code ? append("rotateLocal", item.to, d) : LeanTween.rotateLocal(item.gameObject, item.to, d);
            }
            else if (item.action == TweenAction.ROTATE_X)
            {
                tween = code ? append("rotateX", item.to.x, d) : LeanTween.rotateX(item.gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.ROTATE_Y)
            {
                tween = code ? append("rotateY", item.to.x, d) : LeanTween.rotateY(item.gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.ROTATE_Z)
            {
                tween = code ? append("rotateZ", item.to.x, d) : LeanTween.rotateZ(item.gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.SCALE)
            {
                tween = code ? append("scale", item.to, d) : LeanTween.scale(item.gameObject, item.to, d);
            }
            else if (item.action == TweenAction.SCALE_X)
            {
                tween = code ? append("scaleX", item.to.x, d) : LeanTween.scaleX(item.gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.SCALE_Y)
            {
                tween = code ? append("scaleY", item.to.x, d) : LeanTween.scaleY(item.gameObject, item.to.x, d);
            }
            else if (item.action == TweenAction.SCALE_Z)
            {
                tween = code ? append("scaleZ", item.to.x, d) : LeanTween.scaleZ(item.gameObject, item.to.x, d);
            }
                        #if !UNITY_4_3 && !UNITY_4_5
            else if (item.action == TweenAction.CANVAS_MOVE)
            {
                tween = code ? appendRect("move", item.to, d) : LeanTween.move(item.gameObject.GetComponent <RectTransform>(), item.to, d);
            }
            else if (item.action == TweenAction.CANVAS_SCALE)
            {
                tween = code ? appendRect("scale", item.to, d) : LeanTween.scale(item.gameObject.GetComponent <RectTransform>(), item.to, d);
            }
            else if (item.action == TweenAction.CANVAS_SIZEDELTA)
            {
                Vector2 to = new Vector2(item.to.x, item.to.y);
                tween = code ? appendRect("size", to, d) : LeanTween.size(item.gameObject.GetComponent <RectTransform>(), to, d);
            }
            else if (item.action == TweenAction.CANVAS_ROTATEAROUND)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAround(GetComponent<RectTransform>(), " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAround(item.gameObject.GetComponent <RectTransform>(), item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.CANVAS_ROTATEAROUND_LOCAL)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.rotateAroundLocal(GetComponent<RectTransform>(), " + vecToStr(item.axis) + ", " + item.to.x + "f , " + d + "f)");
                }
                else
                {
                    tween = LeanTween.rotateAroundLocal(item.gameObject.GetComponent <RectTransform>(), item.axis, item.to.x, d);
                }
            }
            else if (item.action == TweenAction.CANVAS_ALPHA)
            {
                tween = code ? appendRect("alpha", item.to.x, d) : LeanTween.alpha(item.gameObject.GetComponent <RectTransform>(), item.to.x, d);
            }
            else if (item.action == TweenAction.CANVAS_COLOR)
            {
                tween = code ? appendRect("color", item.colorTo, d) : LeanTween.color(item.gameObject.GetComponent <RectTransform>(), item.colorTo, d);
            }
            else if (item.action == TweenAction.TEXT_ALPHA)
            {
                tween = code ? appendRect("textAlpha", item.to.x, d) : LeanTween.textAlpha(item.gameObject.GetComponent <RectTransform>(), item.to.x, d);
            }
            else if (item.action == TweenAction.TEXT_COLOR)
            {
                tween = code ? appendRect("textColor", item.colorTo, d) : LeanTween.textColor(item.gameObject.GetComponent <RectTransform>(), item.colorTo, d);
            }
            else if (item.action == TweenAction.CANVAS_PLAYSPRITE)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.play(GetComponent<RectTransform>(), new UnityEngine.Sprite[" + item.sprites.Length + "]).setFrameRate(" + item.frameRate + "f)");
                }
                else
                {
                    tween = LeanTween.play(item.gameObject.GetComponent <RectTransform>(), item.sprites).setFrameRate(item.frameRate);
                }
            }
                        #endif
            else if (item.action == TweenAction.COLOR)
            {
                tween = code ? append("color", item.colorTo, d) : LeanTween.color(item.gameObject, item.colorTo, d);
            }
            else if (item.action == TweenAction.DELAYED_SOUND)
            {
                if (generateCode)
                {
                    codeBuild.Append(tabs + "LeanTween.delayedSound(gameObject, passAudioClipHere, " + vecToStr(item.from) + ", " + d + "f)");
                }
                else
                {
                    tween = LeanTween.delayedSound(gameObject, item.audioClip, item.from, item.duration);
                }
            }
            else
            {
                tween = null;
                Debug.Log("The tween '" + item.action.ToString() + "' has not been implemented. info item:" + item);
                return;
            }


            // Append Extras
            if (generateCode)
            {
                if (delay > 0f)
                {
                    codeBuild.Append(".setDelay(" + delay + "f)");
                }
            }
            else
            {
                tween = tween.setDelay(delay);
            }
            if (item.ease == LeanTweenType.animationCurve)
            {
                if (generateCode)
                {
                    codeBuild.Append(".setEase(");
                    append(item.animationCurve);
                    codeBuild.Append(")");
                }
                else
                {
                    tween.setEase(item.animationCurve);
                }
            }
            else
            {
                if (generateCode)
                {
                    if (item.ease != LeanTweenType.linear)
                    {
                        codeBuild.Append(".setEase(LeanTweenType." + item.ease + ")");
                    }
                }
                else
                {
                    tween.setEase(item.ease);
                }
            }
            // Debug.Log("curve:"+item.animationCurve+" item.ease:"+item.ease);
            if (item.between == LeanTweenBetween.FromTo)
            {
                if (generateCode)
                {
                    codeBuild.Append(".setFrom(" + vecToStr(item.from) + ")");
                }
                else
                {
                    tween.setFrom(item.from);
                }
            }
            if (item.doesLoop)
            {
                if (generateCode)
                {
                    codeBuild.Append(".setRepeat(" + item.loopCount + ")");
                }
                else
                {
                    tween.setRepeat(item.loopCount);
                }

                if (item.loopType == LeanTweenType.pingPong)
                {
                    if (generateCode)
                    {
                        codeBuild.Append(".setLoopPingPong()");
                    }
                    else
                    {
                        tween.setLoopPingPong();
                    }
                }
            }
            if (generateCode)
            {
                if (item.useSpeed)
                {
                    codeBuild.Append(".setSpeed(" + item.speed + "f)");
                }
            }
            else
            {
                if (item.useSpeed)
                {
                    tween.setSpeed(item.speed);
                }
            }
            if (generateCode)
            {
                codeBuild.Append(";\n");
            }
        }
 public void OpenMenu()
 {
     LeanTween.moveX(basePanelTransform, basePanelOpenPos.x, basePanelOpenSpeed);
     LeanTween.size(basePanelTransform, basePanelOpenSize, basePanelOpenSpeed).setOnComplete(OnMenuOpened);
     openMenuButton.SetActive(false);
 }
Example #8
0
    private void ManageDialoguePortrait(Side side)
    {
        // Set references
        CharacterPortraitContainer character;
        Image bust;

        UIManager.TweenedElement   speaker;
        CharacterPortraitContainer otherCharacter;
        Image otherBust;

        UIManager.TweenedElement otherSpeaker;

        if (side == Side.Left)
        {
            character      = leftCharacter;
            bust           = bustL;
            speaker        = UIManager.m_Instance.m_LeftSpeaker;
            leftCharacter  = currentCharacter;
            otherCharacter = rightCharacter;
            otherBust      = bustR;
            otherSpeaker   = UIManager.m_Instance.m_RightSpeaker;
            nameHolder.anchoredPosition = namePos;
        }
        else
        {
            character      = rightCharacter;
            bust           = bustR;
            speaker        = UIManager.m_Instance.m_RightSpeaker;
            rightCharacter = currentCharacter;
            otherCharacter = leftCharacter;
            otherBust      = bustL;
            otherSpeaker   = UIManager.m_Instance.m_LeftSpeaker;
            nameHolder.anchoredPosition = new Vector2(-namePos.x, namePos.y);
        }

        // Grey out the other character
        LeanTween.color(otherBust.rectTransform, Color.gray, 0.1f);
        LeanTween.color(bust.rectTransform, Color.white, 0.1f);

        // Swap portraits
        if (character == currentCharacter)
        {
            bust.sprite = GetCharacterPortrait(currentCharacter, characterExpression);
            // Grow the active speaker
            LeanTween.size(otherBust.rectTransform, defaultPortraitSize, 0.1f);
            LeanTween.size(bust.rectTransform, defaultPortraitSize * 1.1f, 0.1f);
        }
        else
        {
            LeanTween.color(otherBust.rectTransform, Color.gray, 0.1f);
            LeanTween.color(bust.rectTransform, Color.white, 0.1f);
            character = currentCharacter;
            UIManager.m_Instance.SlideElement(speaker, UIManager.ScreenState.Offscreen, () =>
            {
                bust.sprite = GetCharacterPortrait(currentCharacter, characterExpression);
                UIManager.m_Instance.SlideElement(speaker, UIManager.ScreenState.Onscreen);
                // Grow the active speaker
                LeanTween.size(otherBust.rectTransform, defaultPortraitSize, 0.1f);
                LeanTween.size(bust.rectTransform, defaultPortraitSize * 1.1f, 0.1f);
            });
        }
    }
Example #9
0
 public void OnPointerOver()
 {
     LeanTween.moveLocalY(this.gameObject, 300f, 2f);
     LeanTween.size(button, new Vector2(250, 75), 2f);
 }
    public void UpdateOrganIndicator(bool left, float animTime = 0.5f)
    {
        for (int i = 0; i < organIndicators.Length; i++)
        {
            organIndicators[i].TryGetComponent(out OrganIndicator ind);
            if (ind != null)
            {
                Vector2 scale    = new Vector2();
                Vector2 position = new Vector2();
                Color   color    = new Color();
                int     newPos;
                bool    updateImage = false;
                if (!left)
                {
                    newPos = ind.Pos - 1;
                    if (newPos < -2)
                    {
                        newPos      = 2;
                        updateImage = true;
                    }
                }
                else
                {
                    newPos = ind.Pos + 1;
                    if (newPos > 2)
                    {
                        newPos      = -2;
                        updateImage = true;
                    }
                }
                switch (newPos)
                {
                case 0:     //Middle
                    scale    = new Vector2(201f, 229f);
                    position = organIndicatorsPos[2];
                    color    = new Color(1, 1, 1, 1);
                    break;

                case 1:     //right
                    scale    = new Vector2(152f, 173f);
                    position = organIndicatorsPos[3];
                    color    = new Color(1, 1, 1, 0.5f);
                    break;

                case 2:     //right 2
                    scale    = new Vector2(0f, 0f);
                    position = organIndicatorsPos[4];
                    color    = new Color(1, 1, 1, 0f);
                    break;

                case -1:     //left
                    scale    = new Vector2(152f, 173f);
                    position = organIndicatorsPos[1];
                    color    = new Color(1, 1, 1, 0.5f);
                    break;

                case -2:     //left 2
                    scale    = new Vector2(0f, 0f);
                    position = organIndicatorsPos[0];
                    color    = new Color(1, 1, 1, 0f);
                    break;
                }

                if (updateImage)
                {
                    if (newPos == -2)
                    {
                        int OrganFarLeft = currentOrganType;
                        for (int o = 0; o < 2; o++)
                        {
                            OrganFarLeft -= 1;
                            if (OrganFarLeft < 0)
                            {
                                OrganFarLeft = UnlockedOrgans.Count - 1;
                            }
                        }
                        //Debug.Log(OrganFarRight);
                        //Debug.Log("set image far right to: " + UnlockedOrgans[OrganFarRight]);
                        ind.setImage(OrganSprites[UnlockedOrgans[OrganFarLeft]]);
                    }
                    if (newPos == 2)
                    {
                        int OrganFarRight = currentOrganType;
                        for (int o = 0; o < 2; o++)
                        {
                            OrganFarRight += 1;
                            if (OrganFarRight > UnlockedOrgans.Count - 1)
                            {
                                OrganFarRight = 0;
                            }
                        }
                        //Debug.Log(OrganFarLeft);
                        //Debug.Log("set image far left to: " + UnlockedOrgans[OrganFarLeft]);
                        ind.setImage(OrganSprites[UnlockedOrgans[OrganFarRight]]);
                    }
                }
                ind.Pos = newPos;
                LeanTween.cancel(organIndicators[i]);
                LeanTween.moveLocal(organIndicators[i], position, animTime).setEase(LeanTweenType.easeInOutExpo);
                organIndicators[i].TryGetComponent(out RectTransform rect);
                if (rect != null)
                {
                    LeanTween.size(rect, scale, animTime).setEase(LeanTweenType.easeInOutExpo);
                    LeanTween.alpha(organIndicators[i], color.a, animTime);
                }
                organIndicators[i].TryGetComponent(out CanvasGroup cg);
                if (cg != null)
                {
                    LeanTween.alphaCanvas(cg, color.a, animTime);
                }
            }
        }
    }
    void SetOrganIndicator()
    {
        for (int i = 0; i < organIndicators.Length; i++)
        {
            organIndicators[i].TryGetComponent(out OrganIndicator ind);
            if (ind != null)
            {
                int     organTypeID = currentOrganType;
                Vector2 scale       = new Vector2();
                Vector2 position    = new Vector2();
                Color   color       = new Color();
                switch (ind.Pos)
                {
                case -2:
                    for (int o = 0; o < 2; o++)
                    {
                        organTypeID -= 1;
                        if (organTypeID < 0)
                        {
                            organTypeID = UnlockedOrgans.Count - 1;
                        }
                    }
                    scale    = new Vector2(0f, 0f);
                    position = organIndicatorsPos[0];
                    color    = new Color(1, 1, 1, 0f);
                    break;

                case -1:
                    organTypeID -= 1;
                    if (organTypeID < 0)
                    {
                        organTypeID = UnlockedOrgans.Count - 1;
                    }
                    scale    = new Vector2(152f, 173f);
                    position = organIndicatorsPos[1];
                    color    = new Color(1, 1, 1, 0.5f);
                    break;

                case 0:
                    organTypeID = currentOrganType;
                    scale       = new Vector2(201f, 229f);
                    position    = organIndicatorsPos[2];
                    color       = new Color(1, 1, 1, 1);
                    break;

                case 1:
                    organTypeID += 1;
                    if (organTypeID > UnlockedOrgans.Count - 1)
                    {
                        organTypeID = 0;
                    }
                    scale    = new Vector2(152f, 173f);
                    position = organIndicatorsPos[3];
                    color    = new Color(1, 1, 1, 0.5f);
                    break;

                case 2:
                    for (int o = 0; o < 2; o++)
                    {
                        organTypeID += 1;
                        if (organTypeID > UnlockedOrgans.Count - 1)
                        {
                            organTypeID = 0;
                        }
                    }
                    scale    = new Vector2(0f, 0f);
                    position = organIndicatorsPos[4];
                    color    = new Color(1, 1, 1, 0f);
                    break;
                }
                ind.setImage(OrganSprites[UnlockedOrgans[organTypeID]]);
                LeanTween.cancel(organIndicators[i]);
                LeanTween.moveLocal(organIndicators[i], position, 0).setEase(LeanTweenType.easeInOutExpo);
                organIndicators[i].TryGetComponent(out RectTransform rect);
                if (rect != null)
                {
                    LeanTween.size(rect, scale, 0).setEase(LeanTweenType.easeInOutExpo);
                }
                organIndicators[i].TryGetComponent(out CanvasGroup cg);
                if (cg != null)
                {
                    LeanTween.alphaCanvas(cg, color.a, 0);
                }
            }
        }
    }