示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (m_blinkState == BlinkState.NotBlinking)
        {
            m_blinkTimer += Time.deltaTime;

            if (m_blinkTimer > m_blinkTime)
            {
                m_blinkTimer = 0.0f;
                m_blinkState = BlinkState.Blinking;
                m_blinkTime  = m_blinkDuration;

                m_eyeStates [0].gameObject.SetActive(false);
                m_eyeStates [1].gameObject.SetActive(true);
            }
        }
        else
        {
            m_blinkTimer += Time.deltaTime;

            if (m_blinkTimer > m_blinkTime)
            {
                m_blinkTimer = 0.0f;
                m_blinkState = BlinkState.NotBlinking;
                m_blinkTime  = Random.Range(m_minBlinkTime, m_maxBlinkTime);

                m_eyeStates [0].gameObject.SetActive(true);
                m_eyeStates [1].gameObject.SetActive(false);
            }
        }
    }
 public BlinkInfo(BlinkState state, int recordIndex, int fieldIndex, int tickCount, ChangedFieldInfo ci)
 {
     this.BlinkState  = state;
     this.recordIndex = recordIndex;
     this.fieldIndex  = fieldIndex;
     this.tickCount   = tickCount;
     this.ci          = ci;
 }
示例#3
0
    void ResetBlinking()
    {
        foreach (var morphHelper in morphHelperDict_.Values)
        {
            morphHelper.morphSpeed  = 0.0f;
            morphHelper.morphWeight = BlinkParam.minimumWeight;
        }

        blinkState_ = BlinkState.Opened;
    }
示例#4
0
        void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
        {
            GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.Inner.Style;
            BlinkState             bs    = gridGroupingControl1.GetBlinkState(style.TableCellIdentity);

            if (bs != BlinkState.None)
            {
                if (bs == BlinkState.NewRecord)
                {
                    e.Inner.Style.BaseStyle = "CustomStyle";
                }
            }
        }
示例#5
0
        public void BlinkUpdate()
        {
            float speed    = _entity.EyeOpenSpeed / 100 * 2;
            float interval = _entity.EyeOpenInterval / 100 * 10;
            float openTime = (_entity.EyeOpenTime / 100) * interval;
            float add      = (Time.time - startTime) * speed;

            switch (state)
            {
            case BlinkState.Closing:
                blink += add;
                if (blink > 1)
                {
                    blink     = 1;
                    state     = BlinkState.Close;
                    startTime = Time.time;
                }
                break;

            case BlinkState.Close:
                if (startTime + (interval - openTime) < Time.time)
                {
                    state = BlinkState.Opening;
                }
                break;

            case BlinkState.Opening:
                blink -= add;
                if (blink < 0)
                {
                    blink     = 0;
                    state     = BlinkState.Open;
                    startTime = Time.time;
                }
                break;

            case BlinkState.Open:

                if (startTime + openTime < Time.time)
                {
                    state = BlinkState.Closing;
                }
                break;
            }

            BlinkLeft  = Mathf.Lerp(_entity.EyeOpenL, 0, blink);
            BlinkRight = Mathf.Lerp(_entity.EyeOpenR, 0, blink);
        }
示例#6
0
    void OnClosed()
    {
        if (Time.time < nextTime_)
        {
            return;
        }

        foreach (var blinkParam in blinkParams)
        {
            MMD4MecanimMorphHelper morphHelper = morphHelperDict_[blinkParam.morphName];
            morphHelper.morphSpeed  = openingTime;
            morphHelper.morphWeight = BlinkParam.minimumWeight;
        }

        nextTime_   = Time.time + openingTime;
        blinkState_ = BlinkState.Opening;
    }
示例#7
0
        public void Do()
        {
            if (m_player.Properties.Blink)
            {
                return;
            }

            m_player.Properties.Blink.Set();
            m_player.Properties.MagnetDisabled.Set();
            m_player.Properties.ControlDisabled.Set();
            m_player.Properties.Invincible.Set();

            m_blinkTimer.Start();
            m_state      = BlinkState.BlinkOut;
            m_tpPosition = m_player.Position;

            var partColor       = Color.Lerp(m_player.PlayerColors[2], Color.White, 0.7f);
            var emitterDefAsset = Engine.AssetManager.GetAsset <ParticleEmitterDefinition>("Graphics/Particles/Teleport.lua::Emitter");

            emitterDefAsset.Content.Color = partColor;

            m_particleInCmp         = new ParticleComponent();
            m_particleInCmp.Emitter = new ParticleEmitter(emitterDefAsset);
            m_particleInObject.Attach(m_particleInCmp);

            m_particleOutCmp         = new ParticleComponent();
            m_particleOutCmp.Emitter = new ParticleEmitter(emitterDefAsset);
            m_particleOutObject.Attach(m_particleOutCmp);

            if (Game.Arena.LeftGoal.Team == m_player.Team)
            {
                m_targetPosition = Game.Arena.LeftGoal.Position + Vector2.UnitX * 80;
            }
            else
            {
                m_targetPosition = Game.Arena.RightGoal.Position - Vector2.UnitX * 80;
            }

            m_holeInCmp.Position  = m_player.Position;
            m_holeOutCmp.Position = m_targetPosition;

            m_holeInCmp.Visible  = true;
            m_holeInCmp.Scale    = 0;
            m_holeOutCmp.Visible = true;
            m_holeOutCmp.Scale   = 0;
        }
示例#8
0
    void OnClosing()
    {
        if (Time.time < nextTime_)
        {
            return;
        }

        foreach (var morphHelper in morphHelperDict_.Values)
        {
            if (morphHelper.isProcessing)
            {
                return;
            }
        }

        nextTime_  += closedTime;
        blinkState_ = BlinkState.Closed;
    }
示例#9
0
    void OnOpening()
    {
        if (Time.time < nextTime_)
        {
            return;
        }

        foreach (var morphHelper in morphHelperDict_.Values)
        {
            if (morphHelper.isProcessing)
            {
                return;
            }
        }

        nextTime_   = Time.time + GetNextInterval();
        blinkState_ = BlinkState.Opened;
    }
示例#10
0
    // Update is called once per frame
    void Update()
    {
        if (Time.time > lastKeyFrame + currentDuration)
        {
            switch (blinkState)
            {
            case BlinkState.ON:
                blinkState                = BlinkState.OFF;
                currentDuration           = offTime;
                currentTransitionDuration = onOffTransition;
                if (currentTransitionDuration == 0)
                {
                    updateAlpha();
                }
                break;

            case BlinkState.OFF:
                blinkState                = BlinkState.ON;
                currentDuration           = onTime;
                currentTransitionDuration = offOnTransition;
                if (currentTransitionDuration == 0)
                {
                    updateAlpha();
                }
                break;
            }
            lastKeyFrame = lastKeyFrame + currentDuration;
        }
        //Transitions
        if (currentTransitionDuration > 0)
        {
            updateAlpha(
                Mathf.Min(
                    1,
                    (Time.time - lastKeyFrame) / (currentTransitionDuration)
                    )
                );
        }
    }
示例#11
0
        public override void Start()
        {
            m_blinkTimer = new Timer(Engine.GameTime.Source, 200);
            m_state      = BlinkState.None;

            m_particleInObject  = new GameObject("Player Teleport In FX");
            m_particleOutObject = new GameObject("Player Teleport Out FX");

            var holeColor = Color.Lerp(m_player.PlayerColors[2], Color.White, 0.4f);

            m_holeInCmp = new SpriteComponent(Sprite.CreateFromTexture("Graphics/Teleport.png"), "ArenaOverlay3");
            m_holeInCmp.AttachedToOwner = false;
            m_holeInCmp.Visible         = false;
            m_holeInCmp.Sprite.Color    = holeColor;
            Owner.Attach(m_holeInCmp);

            m_holeOutCmp = new SpriteComponent(Sprite.CreateFromTexture("Graphics/Teleport.png"), "ArenaOverlay3");
            m_holeOutCmp.AttachedToOwner = false;
            m_holeOutCmp.Visible         = false;
            m_holeOutCmp.Sprite.Color    = holeColor;
            Owner.Attach(m_holeOutCmp);
        }
        protected override void OnPrepareRenderCell(GridPrepareRenderCellEventArgs e)
        {
            base.OnPrepareRenderCell(e);
            if (e.Handled)
            {
                return;
            }

            if (e.Cell.RowIndex > 0 && e.Cell.ColumnIndex > 1)
            {
                BlinkState bs = GetBlinkState(e.Cell.RowIndex - 1, e.Cell.ColumnIndex - 1);
                switch (bs)
                {
                case BlinkState.Increased:
                    e.Style.Background = _increaseBrush;
                    break;

                case BlinkState.Reduced:
                    e.Style.Background = _reducedBrush;
                    break;
                }
            }
        }
示例#13
0
    void OnOpened()
    {
        if (Time.time < nextTime_) { return; }

        foreach (var blinkParam in blinkParams) {
            MMD4MecanimMorphHelper morphHelper = morphHelperDict_[blinkParam.morphName];
            morphHelper.morphSpeed = closingTime;
            morphHelper.morphWeight = BlinkParam.maximumWeight;
        }

        nextTime_ = Time.time + closingTime;
        blinkState_ = BlinkState.Closing;
    }
示例#14
0
    void OnOpening()
    {
        if (Time.time < nextTime_) { return; }

        foreach (var morphHelper in morphHelperDict_.Values) {
            if (morphHelper.isProcessing) { return; }
        }

        nextTime_ = Time.time + GetNextInterval();
        blinkState_ = BlinkState.Opened;
    }
示例#15
0
    void ResetBlinking()
    {
        foreach (var morphHelper in morphHelperDict_.Values) {
            morphHelper.morphSpeed = 0.0f;
            morphHelper.morphWeight = BlinkParam.minimumWeight;
        }

        blinkState_ = BlinkState.Opened;
    }
示例#16
0
    /// <summary>
    /// まばたき
    /// </summary>
    private void Blink()
    {
        if (!blendShapeProxy)
        {
            return;
        }

        float now = Time.timeSinceLevelLoad;
        float span;

        BlendShapeKey blinkShapeKey = BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink);

        // 表情が笑顔の時は目が閉じられるため、まばたきは無効とする
        if (EmotionPresets[emotionIndex] == BlendShapePreset.Joy)
        {
            blinkState = BlinkState.None;
            blendShapeProxy.ImmediatelySetValue(blinkShapeKey, 0f);
        }

        // まばたきの状態遷移
        switch (blinkState)
        {
        case BlinkState.Closing:
            span = now - lastBlinkTime;
            if (span > BlinkTime)
            {
                blinkState = BlinkState.Opening;
                blendShapeProxy.ImmediatelySetValue(blinkShapeKey, 1f);
            }
            else
            {
                blendShapeProxy.ImmediatelySetValue(blinkShapeKey, (span / BlinkTime));
            }
            break;

        case BlinkState.Opening:
            span = now - lastBlinkTime - BlinkTime;
            if (span > BlinkTime)
            {
                blinkState = BlinkState.None;
                blendShapeProxy.ImmediatelySetValue(blinkShapeKey, 0f);
            }
            else
            {
                blendShapeProxy.ImmediatelySetValue(blinkShapeKey, (1f - span) / BlinkTime);
            }
            break;

        default:
            if (now >= nextBlinkTime)
            {
                lastBlinkTime = now;
                if (Random.value < 0.2f)
                {
                    nextBlinkTime = now;        // 20%の確率で連続まばたき
                }
                else
                {
                    nextBlinkTime = now + Random.Range(1f, 10f);
                }
                blinkState = BlinkState.Closing;
            }
            break;
        }
    }
 /// <summary></summary>
 public void Finished()
 {
     blinkState = BlinkState.Finished;
 }
示例#18
0
    void OnClosing()
    {
        if (Time.time < nextTime_) { return; }

        foreach (var morphHelper in morphHelperDict_.Values) {
            if (morphHelper.isProcessing) { return; }
        }

        nextTime_ += closedTime;
        blinkState_ = BlinkState.Closed;
    }
 /// <summary></summary>
 public void BuildingWithErrors()
 {
     blinkState = BlinkState.BuildingWithErrors;
 }
 /// <summary></summary>
 public void Building()
 {
     blinkState = BlinkState.Building;
 }
        protected override void OnDoWork(DoWorkEventArgs e)
        {
            ushort fadeTime = 1000;
            ushort fadeTime2 = 2500;
            ushort finalStateCounter = 0;

            while(blinkState != BlinkState.Exit)
            {
                switch(blinkState)
                {
                    case BlinkState.Boot:
                        blink1.FadeToColor(fadeTime, 255, 255, 255, true);
                        blink1.FadeToColor(fadeTime, 16, 16, 16, true);
                        blinkState = BlinkState.Idle;
                        break;

                    case BlinkState.Idle:
                        if (FadeIn == true)
                        {
                            blink1.FadeToColor(fadeTime2, 16, 16, 32, true);
                        }
                        else
                        {
                            blink1.FadeToColor(fadeTime2, 16, 32, 16, true);
                        }
                        break;

                    case BlinkState.Clean:
                        if (FadeIn == true)
                        {
                            blink1.FadeToColor(fadeTime, ColorClean[0], ColorClean[1], ColorClean[2], true);
                        }
                        else
                        {
                            blink1.FadeToColor(fadeTime, 0, 0, 0, true);
                        }
                        break;
                    case BlinkState.Building:
                        if (FadeIn == true)
                        {
                            blink1.FadeToColor(fadeTime, ColorBuilding[0], ColorBuilding[1], ColorBuilding[2], true);
                        }
                        else
                        {
                            blink1.FadeToColor(fadeTime, 0, 32, 0, true);
                        }
                        break;
                    case BlinkState.BuildingWithErrors:
                        if (FadeIn == true)
                        {
                            blink1.FadeToColor(fadeTime, ColorBuildingWithErrors[0], ColorBuildingWithErrors[1], ColorBuildingWithErrors[2], true);
                        }
                        else
                        {
                            blink1.FadeToColor(fadeTime, 32, 0, 32, true);
                        }
                        break;
                    case BlinkState.Finished:
                        if (FadeIn == true)
                        {
                            blink1.FadeToColor(fadeTime, ColorFinished[0], ColorFinished[1], ColorFinished[2], true);
                        }
                        else
                        {
                            blink1.FadeToColor(fadeTime, ColorFinished[0], ColorFinished[2], ColorFinished[1], true);
                        }
                        finalStateCounter++;
                        break;
                    case BlinkState.FinishedWithErrors:
                        if (FadeIn == true)
                        {
                            blink1.FadeToColor(fadeTime, ColorFinishedWithErrors[0], ColorFinishedWithErrors[1], ColorFinishedWithErrors[2], true);
                        }
                        else
                        {
                            blink1.FadeToColor(fadeTime, ColorFinishedWithErrors[0], ColorFinishedWithErrors[2], ColorFinishedWithErrors[1], true);
                        }
                        break;
                        finalStateCounter++;
                    case BlinkState.Exit:
                        break;
                }

                FadeIn = !FadeIn;

                if(finalStateCounter == 128)
                {
                    finalStateCounter = 0;
                    blinkState = BlinkState.Idle;
                }
            }

            blink1.Close();
        }
		void UpdateBlinking()
		{
			if ( blinkState != BlinkState.Idle )
			{
				blinkStateTime += Time.deltaTime;
			
				if ( blinkStateTime >= blinkDuration )
				{
					blinkStateTime = 0;

					if ( blinkState == BlinkState.Closing )
					{
						if ( isShortBlink )
						{
							blinkState = BlinkState.Opening;
							blinkDuration = isShortBlink ? kBlinkOpenTimeShort : kBlinkOpenTimeLong;
							blink01 = 1;
						}
						else
						{
							blinkState = BlinkState.KeepingClosed;
							blinkDuration = kBlinkKeepingClosedTime;
							blink01 = 1;
						}
					}
					else if ( blinkState == BlinkState.KeepingClosed )
					{
						blinkState = BlinkState.Opening;
						blinkDuration = isShortBlink ? kBlinkOpenTimeShort : kBlinkOpenTimeLong;
					}
					else if ( blinkState == BlinkState.Opening )
					{
						blinkState = BlinkState.Idle;
						float minTime = Mathf.Max( 0.1f, Mathf.Min(kMinNextBlinkTime, kMaxNextBlinkTime));
						float maxTime = Mathf.Max( 0.1f, Mathf.Max(kMinNextBlinkTime, kMaxNextBlinkTime));
						timeOfNextBlink = Time.time + Random.Range( minTime, maxTime);
						blink01 = 0;
					}
				}
				else
					blink01 = Utils.EaseSineIn(	blinkStateTime,
																blinkState == BlinkState.Closing ? 0 : 1,
																blinkState == BlinkState.Closing ? 1 : -1,
																blinkDuration );
			}
		
		
			if ( Time.time >= timeOfNextBlink && blinkState == BlinkState.Idle )
				Blink();
		}
 /// <summary></summary>
 public void FinishedWithErrors()
 {
     blinkState = BlinkState.FinishedWithErrors;
 }
		public void Blink( bool isShortBlink =true)
		{
			if ( blinkState != BlinkState.Idle )
				return;

			this.isShortBlink = isShortBlink;
			blinkState = BlinkState.Closing;
			blinkStateTime = 0;
			blinkDuration = isShortBlink ? kBlinkCloseTimeShort : kBlinkCloseTimeLong;
		}
 /// <summary></summary>
 public void Clean()
 {
     blinkState = BlinkState.Clean;
 }
        void Blink(ListChangedEventArgs e)
        {
            if (BlinkTime <= 0)
            {
                return;
            }

            ChangedFieldInfoCollection changeFields = GetChangedFields();
            bool anyCellInvalidated = false;

            if (changeFields != null)
            {
                foreach (ChangedFieldInfo ci in changeFields)
                {
                    PropertyDescriptor pd   = _pdc[ci.Name];
                    object             item = SourceList[e.NewIndex];
                    DataRow            row  = item as DataRow;
                    BlinkState         bs   = BlinkState.None;

                    if (e.ListChangedType == ListChangedType.ItemAdded)
                    {
                        bs = BlinkState.NewRecord;
                    }
                    else
                    {
                        object value    = ci.NewValue;
                        object oldValue = ci.OldValue;
                        int    cmp      = CompareColumns.CompareNullableObjects(value, oldValue);
                        if (cmp > 0)
                        {
                            bs = BlinkState.Increased;
                            if (oldValue == null || oldValue is DBNull)
                            {
                                bs = BlinkState.NewValue;
                            }
                        }
                        else if (cmp < 0)
                        {
                            bs = BlinkState.Reduced;
                            if (value == null || value is DBNull)
                            {
                                bs = BlinkState.NullValue;
                            }
                        }
                    }

                    if (bs != BlinkState.None)
                    {
                        RowColumnIndex key = BlinkInfo.GetKey(e.NewIndex, ci.FieldIndex);
                        BlinkInfo      biOld;
                        if (_blinkTable.TryGetValue(key, out biOld))
                        {
                            int n = _blinkQueue.IndexOf(biOld);
                            if (n != -1)
                            {
                                _blinkQueue.RemoveAt(n);
                            }
                        }

                        BlinkInfo bi = new BlinkInfo(bs, e.NewIndex, ci.FieldIndex, Environment.TickCount, ci);
                        _blinkQueue.Add(bi);
                        _blinkTable[key] = bi;

                        int            record             = e.NewIndex;
                        int            rowIndex           = record + 1;
                        int            columnIndex        = bi.fieldIndex + 1;
                        RowColumnIndex cellRowColumnIndex = new RowColumnIndex(rowIndex, columnIndex);

                        RenderStyles.Clear(cellRowColumnIndex);
                        if (IsCellVisible(cellRowColumnIndex))
                        {
                            InvalidateCellRenderStyleBackground(cellRowColumnIndex);
                            anyCellInvalidated = true;
                        }
                    }
                }
            }
            if (anyCellInvalidated)
            {
                InvalidateVisual(false);
            }
        }
 /// <summary></summary>
 public void Exit()
 {
     blinkState = BlinkState.Exit;
 }
 /// <summary></summary>
 public void Idle()
 {
     blinkState = BlinkState.Idle;
 }
示例#29
0
        public override void Update()
        {
            Engine.Log.Debug("State", m_state);
            if (m_state == BlinkState.None)
            {
                return;
            }

            var angle = m_holeAngularSpeed * 0.001f * Engine.GameTime.TimeMS;

            m_holeInCmp.Orientation  = angle;
            m_holeOutCmp.Orientation = 1 - angle; //Rotate in ohter direction, and add offset

            m_particleInObject.Orientation  = angle;
            m_particleOutObject.Orientation = 1 - angle; //Rotate in ohter direction, and add offset

            if (m_state == BlinkState.BlinkOut)
            {
                m_particleInObject.Position  = m_player.Position;
                m_particleOutObject.Position = m_targetPosition;

                m_holeInCmp.Position  = m_player.Position;
                m_holeOutCmp.Position = m_targetPosition;

                m_player.SpritePlayerCmp.Sprite.Alpha = 1 - m_blinkTimer.Completion;
                m_player.SpritePlayerCmp.Scale        = 1 - m_blinkTimer.Completion;

                if (m_blinkTimer.Active)
                {
                    var holeSize = m_holeScale * LBE.MathHelper.Clamp(0, 1, 1.2f * m_blinkTimer.Completion);
                    m_holeInCmp.Scale  = holeSize;
                    m_holeOutCmp.Scale = holeSize;
                }

                if (!m_blinkTimer.Active)
                {
                    m_player.SpritePlayerCmp.Sprite.Alpha = 0;
                    m_player.SpritePlayerCmp.Scale        = 0;
                    m_state = BlinkState.Blink;
                }
            }
            else if (m_state == BlinkState.Blink)
            {
                m_tpPosition = m_targetPosition;
                m_state      = BlinkState.BlinkIn;
                m_blinkTimer.Start();

                m_player.Owner.Position = m_targetPosition;
            }
            else if (m_state == BlinkState.BlinkIn)
            {
                m_player.SpritePlayerCmp.Sprite.Alpha = m_blinkTimer.Completion;
                m_player.SpritePlayerCmp.Scale        = m_blinkTimer.Completion;

                m_particleOutObject.Position = m_player.Position;

                if (m_blinkTimer.Active)
                {
                    var holeSize = LBE.MathHelper.Clamp(0, 1, 1.2f - 1.2f * m_blinkTimer.Completion);
                    m_holeInCmp.Scale  = m_holeScale * holeSize;
                    m_holeOutCmp.Scale = m_holeScale * holeSize;
                }

                if (!m_blinkTimer.Active)
                {
                    m_player.SpritePlayerCmp.Sprite.Alpha = 1;
                    m_player.SpritePlayerCmp.Scale        = 1;
                    m_state = BlinkState.None;

                    m_player.Properties.Blink.Unset();
                    m_player.Properties.MagnetDisabled.Unset();
                    m_player.Properties.ControlDisabled.Unset();
                    m_player.Properties.Invincible.Unset();

                    m_particleInCmp.Emitter.Active  = false;
                    m_particleInCmp.DestroyOnEnd    = true;
                    m_particleOutCmp.Emitter.Active = false;
                    m_particleOutCmp.DestroyOnEnd   = true;

                    m_holeInCmp.Visible  = false;
                    m_holeOutCmp.Visible = false;
                }
            }
        }