예제 #1
0
    void Start()
    {
        Instance = this;
        StartCoroutine(updateTiling());

        //set the tile size of the texture (in UV units), based on the rows and columns
        Vector2 size = new Vector2(1f / columns, 1f / rows);
        renderer.sharedMaterial.SetTextureScale("_MainTex", size);
    }
예제 #2
0
    private static void AddAnimation(int row, int col, string image)
    {
        Sprite s      = default(Sprite);
        Bitmap imgObj = default(Bitmap);

        imgObj = GameResources.GameImage(image);
        imgObj.SetCellDetails(40, 40, 3, 3, 7);

        AnimationScript animation = default(AnimationScript);

        animation = SwinGame.LoadAnimationScript("splash.txt");

        s   = SwinGame.CreateSprite(imgObj, animation);
        s.X = FIELD_LEFT + col * (CELL_WIDTH + CELL_GAP);
        s.Y = FIELD_TOP + row * (CELL_HEIGHT + CELL_GAP);

        s.StartAnimation("splash");
        _Animations.Add(s);
    }
예제 #3
0
    //再來一局
    public IEnumerator PlayAgain()
    {
        UIController.Instance.rot_blackChess.SetRotating(false); //停止棋盆旋轉
        UIController.Instance.rot_whiteChess.SetRotating(false);

        Vector2 blackPoint = UIController.Instance.rot_blackChess.gameObject.transform.position; //黑子棋盆位置
        Vector2 whitePoint = UIController.Instance.rot_whiteChess.gameObject.transform.position; //白子棋盆位置
        float   freq       = 0.02f;                                                              //頻率

        ChessBehavior.Instance.lastChessIcon.SetActive(false);                                   //隱藏最後下棋點提示
        for (int i = 0; i < ChessBehavior.Instance.chessLine.Count; i++)                         //清除棋盤上的所有棋子(動畫展示)
        {
            ChessType       t = ChessBehavior.Instance.chessLine[i].GetComponent <ChessAttribute>().thisChess;
            AnimationScript animationScript = ChessBehavior.Instance.chessLine[i].GetComponent <AnimationScript>();
            if (animationScript.animationPlaying)
            {
                animationScript.animationPlaying = false;
            }
            animationScript.AnimationCommand(new PositionScript(UIController.Instance.chessReturnCurve, t == ChessType.白子 ? whitePoint : blackPoint, true), new AnimationBehavior(PlayMode.狀態延續)
            {
                destroyThis = true
            });
            AudioManagerScript.Instance.PlayAudioClip("chess_return");
            yield return(new WaitForSeconds(freq));
        }

        ChessBehavior.Instance.turn      = UIController.Instance.senteChess;     //設定先手
        ChessBehavior.Instance.chessLine = new List <GameObject>();              //初始化棋子隊列

        UIController.Instance.retractRemain         = UIController.retractTimes; //重置悔棋次數
        UIController.Instance.tx_retractRemain.text = "剩下  " + UIController.Instance.retractRemain + "  次";
        UIController.Instance.RetractButtonState(false);                         //因棋盤上的棋子數<2, 禁用悔棋按鈕

        yield return(new WaitForSeconds(0.3f));

        UIController.Instance.animScrip_interlude.PlayAnimation("Interlude_GameStart", new AnimationBehavior(PlayMode.初始化, new ActionSetting(
                                                                                                                 () =>
        {
            UIController.Instance.cg_gameMenu.blocksRaycasts = true;
            ChessBehavior.Instance.GameInitialization();
        },
                                                                                                                 TaskMode.僅結束時)), false);
    }
예제 #4
0
    void Start()
    {
        set_settingMenuPos = cg_setting.transform.localPosition; //儲存設定選單位置

        playerTypeList.AddRange(System.Enum.GetNames(typeof(PlayerType)));
        aiTypeList.AddRange(System.Enum.GetNames(typeof(AiType)));

        //※未來將用playerPrefs儲存
        senteChess              = ChessType.黑子; //先手棋子類型
        tx_blackLabel.text      = "先 手";
        tx_blackLabel_hide.text = "後 手";
        tx_whiteLabel.text      = "後 手";
        tx_whiteLabel_hide.text = "先 手";

        tx_blackPlayerType.text = playerTypeList[0];
        tx_whitePlayerType.text = playerTypeList[0];

        int[]             buttonCount      = new int[] { blackSelectionButtons.Length, whiteSelectionButtons.Length };
        Button[][]        buttons          = new Button[][] { blackSelectionButtons, whiteSelectionButtons };
        bool[]            isPlayer         = new bool[] { (blackPlayer == PlayerType.玩家), (whitePlayer == PlayerType.玩家) };
        AnimationScript[] animationScripts = new AnimationScript[] { animScript_blackAiButtonFrame, animScript_whiteAiButtonFrame };

        Color32 enableColor  = new Color32(255, 255, 255, 255);
        Color32 disableColor = new Color32(100, 100, 100, 255);

        for (int i = 0; i < buttonCount.Length; i++)
        {
            for (int j = 0; j < buttonCount[i]; j++)
            {
                if (isPlayer[i])
                {
                    animationScripts[i].gameObject.GetComponent <Image>().color = disableColor;
                    buttons[i][j].interactable = false;
                }
                else
                {
                    animationScripts[i].gameObject.GetComponent <Image>().color = enableColor;
                    buttons[i][j].interactable = true;
                }
            }
        }
    }
예제 #5
0
    // Start is called before the first frame update
    void Start()
    {
        FindObjectOfType <MenuController>();
        canRollLeft        = true;
        canRollRight       = true;
        animationScript    = GetComponent <AnimationScript>();
        rotationController = GetComponent <RotationController>();
        flyingStates       = GetComponent <FlyingStates>();
        gliderController   = GetComponent <GliderController>();
        audioManager       = GetComponent <AudioManager>();

        if (FindObjectOfType <MenuController>().controlsInverted == true)
        {
            playerControlsInverted = true;
        }
        else if (FindObjectOfType <MenuController>().controlsInverted == false)
        {
            playerControlsInverted = false;
        }
    }
예제 #6
0
    // public enum hitBoxes { frame1Box, frame2Box, clear }

    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        fighter = (fighter == null) ? animator.gameObject.GetComponent <Fighter>() : fighter;
        p       = fighter.GetComponentInParent <PlayerController>();
        a       = fighter.GetComponentInParent <AnimationScript>();
        h       = fighter.GetComponentInParent <HitboxManagerScript>();

        b = (stateInfo.IsName("Attack1") || stateInfo.IsName("AerialAttack")) ? HitboxManagerScript.hitBoxes.frame1Box :
            (stateInfo.IsName("Attack2")) ? HitboxManagerScript.hitBoxes.frame2Box :
            (stateInfo.IsName("Attack3")) ? HitboxManagerScript.hitBoxes.frame3Box : HitboxManagerScript.hitBoxes.frame4Box;

        fighter.attackState      = stateInfo.IsName("Attack1") || stateInfo.IsName("Attack2");
        fighter.finalAttackState = stateInfo.IsName("Attack3") || stateInfo.IsName("AerialAttack");
        fighter.specialState     = stateInfo.IsName("Special");
        frames    = 0;
        direction = p.dashDir;

        fighter.current_meter += (stateInfo.IsName("Special")) ? -25f : 2.5f;
        a.canFlip              = false;
    }
예제 #7
0
    private void SpawnGems(int count)
    {
        // spawn 8 gems
        for (int i = 0; i < count; i++)
        {
            // instantiate and configure gem
            GameObject      gem    = Instantiate <GameObject>(getPrefab(i).gameObject);
            AnimationScript script = gem.GetComponent <AnimationScript>();
            script.isFloating = false;
            script.isScaling  = false;
            gem.tag           = "gem";

            // add collisionmesh
            gem.AddComponent <MeshCollider>();

            // set scaling to half size
            gem.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);

            // attempt to position gem such that it does not collide with anything in the level
            bool    positionOk  = false;
            Vector3 newPosition = Vector3.zero;
            int     numAttempts = 0;
            while (!positionOk && numAttempts < 5)
            {
                newPosition = ChooseRandomPosition(1f);
                // todo: check if new position collides with anything
                positionOk = true;
            }
            if (!positionOk)
            {
                Debug.Log($"Number of attempts for choosing gem position exceeded. Using position {newPosition}");
            }
            gem.transform.position = newPosition;

            // set parent transform
            gem.transform.SetParent(this.transform);

            // add to gemlist
            gemList.Add(gem);
        }
    }
예제 #8
0
    public override void deliverOnCollisionEffect(Collider other, PersonStatus status)
    {
        if (other != status.gameObject.collider)
        {
            if (other.tag == "Person")
            {
                AnimationScript other_anim  = other.GetComponent <AnimationScript>();
                PersonStatus    otherPerson = other.GetComponent <PersonStatus>();

                if (!otherPerson.isAlive() || otherPerson.UnitStatus == PersonStatus.Status.Zombie)
                {
                    return;
                }

                otherPerson.ActivePower = null;
                ZombieEffect effect = new ZombieEffect();
                effect.initialize(owner);
                otherPerson.ActivePower = effect;
            }
        }
    }
예제 #9
0
    public override void deliverOnCollisionEffect(Collider other, PersonStatus status)
    {
        if (other.tag != "Person")
        {
            return;
        }

        if (other == status.collider)
        {
            return;
        }

        AnimationScript other_anim  = other.GetComponent <AnimationScript>();
        PersonStatus    otherPerson = other.GetComponent <PersonStatus>();

        if (otherPerson.ActivePower == null)
        {
            FireEffect effect = new FireEffect();
            effect.initialize(owner);
            otherPerson.ActivePower = effect;
        }
    }
예제 #10
0
    //UPDATE POWER EFFECTS
    public override void deliverPowerEffects(PersonStatus status, AnimationScript animator, UnitNavigationController navigator)
    {
        if (status.UnitStatus != PersonStatus.Status.Raged && status.UnitStatus != PersonStatus.Status.Dead && !started)
        {
            if (animator.powerEffect)
            {
                Object.Destroy(animator.powerEffect);
            }

            if (Application.loadedLevelName == "TowerDefense")
            {
                burnTime = 3f;
            }
            started              = true;
            status.UnitStatus    = PersonStatus.Status.Panicked;
            animator.powerEffect = (GameObject)Object.Instantiate(owner.particleEffect, new Vector3(status.transform.position.x, status.transform.position.y + 0.9f, status.transform.position.z), Quaternion.identity);
            animator.powerEffect.transform.parent = animator.transform;
            status.Fear = owner.Fear;
        }
        else if (status.UnitStatus != PersonStatus.Status.Raged && status.UnitStatus != PersonStatus.Status.Dead)
        {
            timer += Time.deltaTime;

            if (timer >= burnTime)
            {
                status.Fear       = 0;
                status.UnitStatus = PersonStatus.Status.Dead;
                navigator.Stop();
                started = false;
            }
        }

        if (status.UnitStatus == PersonStatus.Status.Dead)
        {
            Object.Destroy(animator.powerEffect, 3f);
            status.ActivePower = null;
        }
    }
예제 #11
0
    //UPDATE POWER EFFECTS
    public override void deliverPowerEffects(PersonStatus status, AnimationScript animator, UnitNavigationController navigator)
    {
        if (status.UnitStatus != PersonStatus.Status.Raged && status.UnitStatus != PersonStatus.Status.Dead)
        {
            if (animator.powerEffect)
            {
                Object.Destroy(animator.powerEffect);
            }

            timer             = 0;
            status.UnitStatus = PersonStatus.Status.Raged;
            navigator.Stop();
            animator.powerEffect = (GameObject)Object.Instantiate(owner.particleEffect, new Vector3(status.transform.position.x, status.transform.position.y + 0.9f, status.transform.position.z), Quaternion.identity);
            animator.powerEffect.transform.parent = animator.transform;
            status.Fear = owner.Fear;
        }
        else
        {
            timer += Time.deltaTime;
            if (timer >= 10f)
            {
                status.UnitStatus = PersonStatus.Status.Concerned;
                status.Fear       = 0;
                Object.Destroy(animator.powerEffect);
                status.ActivePower = null;
                navigator.SetNewPatrolDestination(navigator.Type);
                navigator.target = null;
            }
        }

        if (status.UnitStatus == PersonStatus.Status.Dead)
        {
            if (animator.powerEffect != null)
            {
                Object.Destroy(animator.powerEffect);
            }
        }
    }
예제 #12
0
    private void Awake()
    {
        Spikes.EditorMode  = false;
        Screen.orientation = ScreenOrientation.Portrait;
        swipeInput         = GetComponent <SwipeControl>();

        anim = cubeMesh.GetComponent <AnimationScript>();

        rightRay   = Right.GetComponent <RayCastScript>();
        leftRay    = Left.GetComponent <RayCastScript>();
        forwardRay = Forward.GetComponent <RayCastScript>();
        backRay    = Back.GetComponent <RayCastScript>();
        downRay    = Down.GetComponent <RayCastScript>();


        RightRotation   = Vector3.back;
        LeftRotation    = Vector3.forward;
        ForwardRotation = Vector3.right;
        BackRotation    = Vector3.left;

        //destination = transform.localPosition;
        mazeRotation = MazeBody.GetComponent <MazeBodyRotation>();
    }
예제 #13
0
파일: UnitConfig.cs 프로젝트: JoeSnow0/ZCOM
    //BaseUnitCopy
    void Awake()
    {
        //Load models
        //GameObject classModel = Instantiate(unitClassStats.classModel, modelController.transform);

        //GameObject weaponModel = Instantiate(unitWeapon.weaponModel, classModel.GetComponent<WeaponPosition>().hand);

        //Initiate Variables//
        //////////////////////
        //Get Unit movement points
        movePoints = unitClassStats.maxUnitMovePoints;
        //get unit tile coordinates

        //Add the map incase its missing
        mapConfig    = GameObject.FindGameObjectWithTag("Map").GetComponent <MapConfig>();
        actionPoints = GetComponent <ActionPoints>();
        health       = GetComponent <Health>();
        movement     = GetComponent <UnitMovement>();

        //if (!isFriendly)
        //    InitializeEnemy();

        Vector3 tileCoords = mapConfig.tileMap.WorldCoordToTileCoord((int)transform.position.x, (int)transform.position.z);

        //Set unit position on grid
        tileX = (int)tileCoords.x;
        tileY = (int)tileCoords.z;

        line = GetComponent <LineRenderer>();


        animator          = GetComponentInChildren <AnimationScript>();
        actionPoints      = GetComponent <ActionPoints>();
        health            = GetComponent <Health>();
        animatorHealthbar = GetComponentInChildren <Animator>();
        //movement = GetComponent<UnitMovement>();
    }
    // Use this for initialization
    void Start()
    {
        moveToPosition = GetComponent <MoveHomingNoLimit>();

        if (forcePosition.value)
        {
            forcePosition.value = false;
            posx.value          = transform.position.x;
            posy.value          = transform.position.y;
        }

        transform.position            = new Vector3(posx.value, posy.value, 0);
        moveToPosition.moveToPosition = transform.position;

#if UNITY_EDITOR
        moveToPosition.speed *= speedHack.value;
#endif

        animScript = GetComponent <AnimationScript>();
        animInfo   = new AnimationInformation();
        SetupCharacterAnimations();

        paused.value = false;
    }
예제 #15
0
 public override void deliverPowerEffects(PersonStatus status, AnimationScript animator, UnitNavigationController navigator)
 {
     status.UnitStatus  = PersonStatus.Status.Shocked;
     status.Fear        = this.Fear;
     status.ActivePower = null;
 }
 // Start is called before the first frame update
 void Start()
 {
     meshRenderer    = GetComponent <MeshRenderer> ();
     animationScript = GetComponent <AnimationScript> ();
 }
예제 #17
0
 // Start is called before the first frame update
 void Start()
 {
     rb   = GetComponent <Rigidbody2D>();
     anim = GetComponentInChildren <AnimationScript>();
 }
예제 #18
0
    // Use this for initialization
    void Start()
    {
        playerInput = InputManager.Instance;
        gameManager = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameManager>();

        //Get all player child objects for easy access later.
        playerShoulder = gameObject.transform.FindChild("Player_Shoulder").gameObject;
        playerArm = gameObject.transform.FindChild("Player_Arm").gameObject;
        playerWeapon = playerArm.transform.FindChild("Weapon").gameObject;

        bulletSpawnPosX = playerArm.GetComponent<SpriteRenderer>().sprite.bounds.extents.x;

        playerFlicker = gameObject.GetComponent<FlickerScript>();
        playerAnimScript = gameObject.GetComponent<AnimationScript>();
        shoulderAnimScript = playerShoulder.GetComponent<AnimationScript>();

        invincibilityTimer = new Timer(INVINCIBLE_TIME);

        //Subscribe to necessary events.
        playerInput.Key_Held += ProcessMovement;
        playerInput.Key_Released += Idle;
        playerInput.Key_Pressed += ProcessKeyPress;
        invincibilityTimer.OnTimerComplete += EndInvincibilityTime;
        gameManager.GameOverEvent += OnGameOver;

        crosshair = GameObject.Find("Crosshair");

        //Populate the sprite materials with all sub-objects' materials.
        spriteMaterials.Add(gameObject.GetComponent<SpriteRenderer>().material);
        spriteMaterials.Add(playerShoulder.GetComponent<SpriteRenderer>().material);
        spriteMaterials.Add(playerArm.GetComponent<SpriteRenderer>().material);
        spriteMaterials.Add(playerWeapon.GetComponent<SpriteRenderer>().material);

        playerFlicker.SpriteMaterials = spriteMaterials;

        currDirectionVector = GlobalConstants.DOWN_VECTOR;
    }
예제 #19
0
 void Awake()
 {
     animationScript = GetComponent <AnimationScript>();
 }
예제 #20
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     Instantiate_box();
 }
 // Start is called before the first frame update
 void Start()
 {
     animationScript = GetComponent <AnimationScript>();
     inputManager    = GetComponent <InputManager>();
 }
예제 #22
0
파일: SpinScript.cs 프로젝트: Xiang34/App
 // Use this for initialization
 void Start()
 {
     anim = gameObject.GetComponent <AnimationScript> ();
 }
예제 #23
0
    // Use this for initialization
    void Start()
    {
        Instance = this;
        dialogueObject = GameObject.FindGameObjectWithTag("chatObject");
        dialogue = dialogueObject.GetComponent<DialogueScript>();
        animation = this.GetComponent<AnimationScript>();
        direction = this.transform.position;
        camera.transform.position = new Vector3(0,80,-10);
        inMission = talking = getchat = false;
        Missions = new bool [10];
        name = null;
        for (int i= 0; i < 9; i++)
        {
            Missions[i] = false;

        }
    }
    // Use this for initialization
    void Start()
    {
        controller = GetComponent <PlayerControlScript> ();
        anim = GetComponentInChildren<AnimationScript>();
        properties = GetComponent<PlayerProperties>();

        /*facingRight = properties.facingRight;
        jumpForce = properties.jumpForce;
        moveForce = properties.moveForce;			// Amount of force added to move the player left and right.
        maxSpeed = properties.maxSpeed;
        jumpTimer = properties.jumpTimer;
        float moveTimer = properties.moveTimer;*/
    }
예제 #25
0
 // Start is called before the first frame update
 void Start()
 {
     coll = GetComponent <Collision>();
     rb   = GetComponent <Rigidbody2D>();
     anim = GetComponentInChildren <AnimationScript>();
 }
예제 #26
0
 public override void deliverPowerEffects(PersonStatus status, AnimationScript animator, UnitNavigationController navigator)
 {
 }
    private Vector2 touchOrigin = -Vector2.one; //Used to store location of screen touch origin for mobile controls.

    // Use this for initialization
    void Start()
    {
        sfx = GetComponent <SoundManager>();
        animationController = GetComponent <AnimationScript>();
        levelManager        = GetComponent <Scene>();
    }
예제 #28
0
 void Awake()
 {
     Inst = this;
 }
예제 #29
0
 private void Start()
 {
     anim = FindObjectOfType <AnimationScript>();
     move = FindObjectOfType <Movement>();
     sr   = GetComponent <SpriteRenderer>();
 }
예제 #30
0
 void Start()
 {
     rigidBody        = GetComponent <Rigidbody2D>();
     playerCoreScript = GetComponent <PlayerCoreScript>();
     aniscr           = GetComponent <AnimationScript>();
 }
예제 #31
0
 public abstract void deliverPowerEffects(PersonStatus status, AnimationScript animator, UnitNavigationController navigator);
예제 #32
0
 void Awake()
 {
     coll = GetComponent <Collision>();
     rb   = GetComponent <Rigidbody2D>();
     anim = GetComponent <AnimationScript>();
 }
예제 #33
0
 private void Start()
 {
     animator        = GetComponent <AnimationScript>();
     sfx             = GetComponent <SoundManager>();
     remainingStones = nodes.Length;
 }
예제 #34
0
    void Awake()
    {
        //Start off at correct position.
        transform.position = new Vector3(0, -24, -5);

        //Load letter write sound.
        snd = Resources.Load("SFX/Letter Write Sound") as AudioClip;

        //Find needed objects and components.
        picture = transform.Find("Picture").gameObject;
        textObj = transform.Find("New Text").gameObject;
        box     = transform.Find("box").gameObject;
        anim    = picture.GetComponent <AnimationScript>();
        anim.pauseBetweenFrames = 0.2f;

        //Apply settings based on who is talking.
        switch (per)
        {
        case Person.Carl:     //Done
            pic                  = Resources.Load("Portraits/Commander Carl Image Sheet") as Texture;
            speechNoise          = Resources.Load("SFX/Carl Speaking") as AudioClip;
            s                    = Side.Left;
            anim.framesOffset[0] = Vector2.zero;
            anim.framesOffset[1] = new Vector2(0.75f, 0f);
            textureScale         = new Vector2(0.25f, 1f);
            break;

        case Person.Vektor:     //Done
            pic                          = Resources.Load("Portraits/Vektor Face Sheet") as Texture;
            speechNoise                  = Resources.Load("SFX/Vektor Speak") as AudioClip;
            s                            = Side.Left;
            anim.framesOffset[0]         = Vector2.zero;
            anim.framesOffset[1]         = new Vector2(0.5f, 0f);
            textureScale                 = new Vector2(0.5f, 1f);
            picture.transform.localScale = new Vector3(8f, 8f, 1f);
            break;

        case Person.Redd:                 //Done
            pic          = Resources.Load("Portraits/Reinforcer Redd") as Texture;
            speechNoise  = Resources.Load("SFX/Redd Speaking") as AudioClip;
            s            = Side.Right;
            anim.enabled = false;
            textureScale = Vector2.one;
            break;

        case Person.Cheese:                 //Done
            pic                  = Resources.Load("Portraits/Chef Cheese") as Texture;
            speechNoise          = Resources.Load("SFX/Chef Cheese Talking") as AudioClip;
            s                    = Side.Right;
            anim.framesOffset[0] = Vector2.zero;
            anim.framesOffset[1] = new Vector2(0.5f, 0f);
            textureScale         = new Vector2(0.5f, 1f);
            break;

        case Person.Cotton:                 //Done
            pic                  = Resources.Load("Portraits/Cotton") as Texture;
            speechNoise          = Resources.Load("SFX/Chef Cheese Talking") as AudioClip;
            s                    = Side.Right;
            anim.framesOffset[0] = Vector2.zero;
            anim.framesOffset[1] = new Vector2(0.5f, 0f);
            textureScale         = new Vector2(0.5f, 1f);
            break;

        case Person.Vortex:                 //Done
            pic                  = Resources.Load("Portraits/The Void") as Texture;
            speechNoise          = Resources.Load("SFX/Void Speaking") as AudioClip;
            s                    = Side.Right;
            anim.framesOffset[0] = Vector2.zero;
            anim.framesOffset[1] = new Vector2(0.5f, 0f);
            textureScale         = new Vector2(0.5f, 1f);
            break;

        case Person.Plum:
            pic                  = Resources.Load("Portraits/Punisher Plum") as Texture;
            speechNoise          = Resources.Load("SFX/Plum Speak") as AudioClip;
            s                    = Side.Right;
            anim.framesOffset[0] = Vector2.zero;
            anim.framesOffset[1] = new Vector2(0.5f, 0f);
            textureScale         = new Vector2(0.5f, 1f);
            break;

        case Person.Warden:
            pic          = Resources.Load("Portraits/The Warden") as Texture;
            speechNoise  = Resources.Load("SFX/Warden Speak") as AudioClip;
            s            = Side.Right;
            anim.enabled = false;
            textureScale = Vector2.one;
            break;
        }

        //Find the audio source that plays speech.
        if (GetComponent <AudioSource>() == null)
        {
            speechPlayer = gameObject.AddComponent <AudioSource>();
        }
        else if (GetComponent <AudioSource>() != null)
        {
            speechPlayer = GetComponent <AudioSource>();
        }
        speechPlayer.clip   = speechNoise;
        speechPlayer.volume = Game.soundVolume;
        speechPlayer.loop   = false;
        speechPlayer.pitch  = Random.Range(0.8f, 1.2f);

        //Apply stuff.
        picture.GetComponent <MeshRenderer>().material.mainTexture      = pic;
        picture.GetComponent <MeshRenderer>().material.mainTextureScale = textureScale;
        if (s == Side.Left)
        {
            picture.transform.localPosition = new Vector3(-32, 0, 0);
            box.transform.localPosition     = new Vector3(4, -2, 2);
            textObj.transform.localPosition = new Vector3(-27, -2, 0);
        }
        else if (s == Side.Right)
        {
            picture.transform.localPosition = new Vector3(30.75f, 0, 0);
            box.transform.localPosition     = new Vector3(-4, -2, 2);
            textObj.transform.localPosition = new Vector3(-35, -2, 0);
        }
    }