コード例 #1
0
    // Use this for initialization
    void Start()
    {
        c_o_l = GameObject.Find("COL");

        _levelCenter = new Vector3();

        if ((c_o_l == null && _CurrBGType == BGType.Tiles))
        {
            Debug.Log("Some backgrounds not supported.\nNo center of level GO (\"COL\") defined in the scene.\nTurning off some features.");
            _CurrBGType = BGType.Default;
        }

        else
        {
            _CurrBGType    = c_o_l.GetComponent <DJ_BackgroundSettings>().TypeOfBG;
            _levelCenter.x = c_o_l.transform.position.x;
            _levelCenter.y = c_o_l.transform.position.y;
            _levelCenter.z = c_o_l.transform.position.z;
        }

        //instantiate the bg effect
        switch (_CurrBGType)
        {
        case BGType.Tiles:
            //BGCamera.gameObject.SetActive(false);
            CreateTileBackground();
            break;

        default:
            break;
        }
    }
コード例 #2
0
 /// <summary>
 /// check if the configuration changed. if so change the GameObject  parameters remove them and create new ones if needed
 /// </summary>
 void Update()
 {
     if (m_renderType != m_lastRenderType || m_bgType != m_lastBGType)
     {
         UpdateBGImage();
     }
     if (m_renderType != m_lastRenderType || m_maskType != m_lastMaskType || m_outline != m_lastOutline)
     {
         UpdatePlayerMasks();
     }
     if (m_rect != m_lastPlaceToDraw || m_snapToPosition != m_lastSnapToPosition)
     {
         if (m_renderType == RenderType.GUITexture)
         {
             FixChildGUITexturePositions();
         }
         else if (m_renderType == RenderType.OnGUI)
         {
         }
     }
     m_lastRenderType     = m_renderType;
     m_lastBGType         = m_bgType;
     m_lastMaskType       = m_maskType;
     m_lastOutline        = m_outline;
     m_lastPlaceToDraw    = m_rect;
     m_lastSnapToPosition = m_snapToPosition;
 }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        _SpriteRenderer = GetComponent <SpriteRenderer>();
        Bounds          = GetComponent <BackgroundBoundFinder> ();

        // initialize
        SetBackground(CurrentType);
        _TmpCurrentType = CurrentType;
    }
コード例 #4
0
 void SetBackground(BGType background)
 {
     // when there's changes in type
     if (_TmpCurrentType != CurrentType)
     {
         CurrentBackgroundModel = FindBackground(background);
         CurrentBackgroundModel.BGSprite.Init();
         _TmpCurrentType = CurrentType;
     }
 }
コード例 #5
0
ファイル: NotifyIconChart.cs プロジェクト: ssor/csharpDemos
 private void DrawBG(BGType t)
 {
     // Clear Graphics object
     g.Clear(Color.Transparent);
     if (t == BGType.rect)
     {
         SolidBrush b = new SolidBrush(backgroundColor);
         g.FillRectangle(b, 0, 0, size, size);
     }
     else if (t == BGType.pie)
     {
         SolidBrush b = new SolidBrush(Color2);
         g.FillEllipse(b, 0, 0, size, size);
     }
 }
コード例 #6
0
 void Awake()
 {
     if (m_bgType != BGType.None)
     {
         UpdateBGImage();
     }
     if (m_maskType != MaskType.None)
     {
         UpdatePlayerMasks();
     }
     m_lastRenderType     = m_renderType;
     m_lastBGType         = m_bgType;
     m_lastMaskType       = m_maskType;
     m_lastOutline        = m_outline;
     m_lastPlaceToDraw    = m_rect;
     m_lastSnapToPosition = m_snapToPosition;
 }
コード例 #7
0
    BackgroundModel FindBackground(BGType type)
    {
        BackgroundModel currentBGModel = null;
        BackgroundModel foundedModel   = null;

        for (int i = 0; i < Backgrounds.Length; i++)
        {
            currentBGModel = Backgrounds [i];
            if (currentBGModel.BackgroundType == type)
            {
                currentBGModel.BGSprite.gameObject.SetActive(true);
                foundedModel = currentBGModel;
            }
            else
            {
                currentBGModel.BGSprite.gameObject.SetActive(false);
            }
        }

        return(foundedModel);
    }
コード例 #8
0
    protected virtual void Moving(GameObject gameObject, float speed, BGType type, int bgNums = 2)
    {
        if (type == BGType.MainBG)
        {
            bgNums = 2;
        }
        else if (type == BGType.SubBG)
        {
            bgNums = 3;
        }

        SpriteRenderer spr = gameObject.GetComponent <SpriteRenderer>();

        gameObject.transform.position += Vector3.left * Time.deltaTime * speed;
        Vector3 pos = gameObject.transform.position;

        if (pos.x + spr.bounds.size.x / 2 < -8)
        {
            float size = spr.bounds.size.x * bgNums;
            pos.x += size;
            gameObject.transform.position = pos;
        }
    }
コード例 #9
0
ファイル: 1.cs プロジェクト: trainsn/LBS
 public ToolDraw(BGType bgType)
 {
     _alterType = bgType;
 }
コード例 #10
0
    // Update is called once per frame
    void Update()
    {
        CurrentBGType = _CurrBGType;

        campos.x = Camera.main.transform.position.x;
        campos.y = Camera.main.transform.position.y;
        campos.z = Camera.main.transform.position.z;

        if (_CurrBGType == BGType.Tiles)
        {
            //set position of tile "folder"
            SetTilesPosition();

            for (int i = 0; i < _currStrength.Length; ++i)
            {
                _currStrength[i] -= _decStrengthAmount[i];
            }

            if ((DJ_BeatManager.synth1 /*|| DJ_BeatManager.synth1Threshold*/) && DJ_BeatManager.layerThreeActive)
            {
                _currStrength[0]     += _incStrengthAmount[0];
                _incStrengthAmount[0] = 1.0f / DJ_BeatManager.GetNextLayerThreeOn();
                _decStrengthAmount[0] = _incStrengthAmount[0] / 100.0f;
            }
            if ((DJ_BeatManager.synth2 /*|| DJ_BeatManager.synth2Threshold*/) && DJ_BeatManager.layerFourActive)
            {
                _currStrength[1]     += _incStrengthAmount[1];
                _incStrengthAmount[1] = 1.0f / DJ_BeatManager.GetNextLayerFourOn();
                _decStrengthAmount[1] = _incStrengthAmount[1] / 100.0f;
            }
            if ((DJ_BeatManager.snare /*|| DJ_BeatManager.snareThreshold*/) && DJ_BeatManager.layerTwoActive)
            {
                _currStrength[2]     += _incStrengthAmount[2];
                _incStrengthAmount[2] = 1.0f / DJ_BeatManager.GetNextLayerTwoOn();
                _decStrengthAmount[2] = _incStrengthAmount[2] / 100.0f;
            }

            for (int i = 0; i < _currStrength.Length; ++i)
            {
                _currStrength[i] = Mathf.Clamp(_currStrength[i], _minStrength, _maxStrength);
            }

            //update the values in the shader
            for (int i = 0; i < _currStrength.Length; ++i)
            {
                BGTileGO[i].GetComponent <Renderer>().sharedMaterial.SetFloat("_GlowStrength", _currStrength[i]);
            }

            //_rot.y += .00005f;

            //c_o_l.transform.rotation = _rot;
            campos.y = -campos.y;
            BGCamera.transform.position      = campos;
            BGCamera.transform.localRotation = Camera.main.transform.localRotation;
            //Quaternion _r = BGCamera.transform.localRotation;
            //float dist = 180 - _r.x;
            //_r.x = 180 + dist;
            //BGCamera.transform.localRotation = _r;
            Vector3 _target = DJ_PlayerManager.player.transform.position;
            _target.y = 0.0f;
            BGCamera.transform.rotation = Quaternion.LookRotation(_target - BGCamera.transform.position);
            //Quaternion _r2 = BGCamera.transform.rotation;
            //float _dist2 = 180 - _r2.x;
            //_r2.x = 180 + _dist2;
            //BGCamera.transform.rotation = _r2;
            BGCamera.fieldOfView = Camera.main.fieldOfView;

            Camera.main.clearFlags = CameraClearFlags.Nothing;
        }
        else
        {
            Camera.main.clearFlags = CameraClearFlags.Nothing;
        }
    }
コード例 #11
0
ファイル: Background.cs プロジェクト: Cur10s1ty/project2
 public Background(BGType type)
 {
     this.type = type;
     SetBackground();
 }