// Make the character flash on and off. If FlashType.Renderer_Disable is
	// passed in, they will disapper and reappear. When isFlashing is false, this
	// will return you back to normal (visible or default color). You only
	// need to pass in your default color when using the Color_Change FlashType.
	public static void Flashing(this SkinnedMeshRenderer[] mySkinnedMeshes, bool isFlashing, FlashType flashType, Color myDefaultColor = default(Color))
	{
		foreach(SkinnedMeshRenderer myMesh in mySkinnedMeshes)
		{
			if(isFlashing)
			{
				if(flashType == FlashType.Color_Change)
				{
					if(mySkinnedMeshes[0].GetComponent<Renderer>().materials[0].color == myDefaultColor)
					{
						foreach(Material mat in myMesh.materials)
							mat.color = Color.cyan; // My color chosen for invulnerability.
					}
					else
					{
						foreach(Material mat in myMesh.materials)
							mat.color = myDefaultColor;
					}
				}
				// Disable or reenable our mesh to be seen based. This makes it
				// the opposite of what it currently is.
				else myMesh.enabled = !myMesh.enabled;
			}
			else
			{
				if(flashType == FlashType.Color_Change)
				{
					foreach(Material mat in myMesh.materials)
						mat.color = myDefaultColor;
				}
				else myMesh.enabled = true;
			}
		}
	}
 public void Init(Vector2Int id)
 {
     tileId       = id;
     meshRenderer = GetComponent <MeshRenderer>();
     type         = FlashType.None;
     Visualize(flashRange.min);
 }
示例#3
0
        public static void SendIndividualFlashEffect(Mobile e, FlashType flash)
        {
            if (e == null || e.NetState == null)
            {
                return;
            }
            Map map = e.Map;

            if (map == null)
            {
                return;
            }

            e.ProcessDelta();

            Packet flashEffect = null;

            NetState state = e.NetState;

            if (state.Version >= m_FlashEffectVersion)
            {
                if (flashEffect == null)
                {
                    flashEffect = Packet.Acquire(new FlashEffect(flash));
                }

                state.Send(flashEffect);
            }
            Packet.Release(flashEffect);
        }
        public void SetFlashSelect(FlashType flashType)
        {
            byte flashSel;

            if (flashType == FlashType.Rom)
            {
                flashSel = 0;
            }
            else
            {
                flashSel = 1;
            }
            Console.WriteLine(String.Format("Set FlashSel: {0}", flashSel));

            StxEtxMemoryStream stream = new StxEtxMemoryStream();

            stream.StartPacket();
            stream.WriteByte((byte)Commands.FlashSelect);
            stream.WriteByte(flashSel);
            stream.EndPacket();

            byte[]    bytes        = stream.GetBytes();
            uint      bytesWritten = 0;
            FT_STATUS status       = _Ftdi.Write(bytes, bytes.Length, ref bytesWritten);

            if (status != FT_STATUS.FT_OK)
            {
                throw new Exception("Error writing data (SetFlashSelect)");
            }
            if (bytesWritten != bytes.Length)
            {
                throw new Exception("Wrong number of bytes written (SetFlashSelect)");
            }
        }
示例#5
0
        public static string[] Get(FlashType type)
        {
            var array = Messenger.Messages[type].ToArray();

            Messenger.Messages[type].Clear();
            return(array);
        }
示例#6
0
        //Send flash effect to all clients in range (like bolt effect)
        public static void SendFlashEffect(IEntity e, FlashType flash)
        {
            Map map = e.Map;

            if (map == null)
            {
                return;
            }

            e.ProcessDelta();

            Packet flashEffect = null;

            IPooledEnumerable eable = map.GetClientsInRange(e.Location);

            foreach (NetState state in eable)
            {
                if (state.Mobile.CanSee(e) && state.Version >= m_FlashEffectVersion)
                {
                    if (flashEffect == null)
                    {
                        flashEffect = Packet.Acquire(new FlashEffect(flash));
                    }

                    state.Send(flashEffect);
                }
            }

            Packet.Release(flashEffect);

            eable.Free();
        }
示例#7
0
        private byte[] readCpuBlock(UInt16 address, int length, FlashType flashType = FlashType.FirstFlash)
        {
            var buffer = new byte[4];

            buffer[0]   = (byte)(address & 0xFF);
            buffer[1]   = (byte)((address >> 8) & 0xFF);
            buffer[2]   = (byte)(length & 0xFF);
            buffer[3]   = (byte)((length >> 8) & 0xFF);
            cpuReadDone = false;
            switch (flashType)
            {
            case FlashType.FirstFlash:
            case FlashType.Coolgirl:
                sendData(Command.COMMAND_PRG_READ_REQUEST, buffer);
                break;

            case FlashType.Coolboy:
                sendData(Command.COMMAND_COOLBOY_READ_REQUEST, buffer);
                break;
            }
            for (int t = 0; t < Timeout; t += 5)
            {
                Thread.Sleep(5);
                if (cpuReadDone)
                {
                    return(prgRecvData);
                }
            }
            throw new IOException("Read timeout");
        }
示例#8
0
        public void ErasePrgFlash(FlashType flashType = FlashType.FirstFlash)
        {
            switch (flashType)
            {
            case FlashType.FirstFlash:
                sendData(Command.COMMAND_PRG_FLASH_ERASE_REQUEST, new byte[0]);
                break;

            case FlashType.Coolboy:
                sendData(Command.COMMAND_COOLBOY_ERASE_REQUEST, new byte[0]);
                break;

            case FlashType.Coolgirl:
                sendData(Command.COMMAND_COOLGIRL_ERASE_SECTOR_REQUEST, new byte[0]);
                break;
            }
            cpuWriteDoneCounter = 0;
            for (int t = 0; t < Timeout; t += 5)
            {
                Thread.Sleep(5);
                if (cpuWriteDoneCounter != 0)
                {
                    return;
                }
            }
            throw new IOException("Write timeout");
        }
        void OnPuzzleFlashTile(object sender, InstantMessageArgs args)
        {
            List <TileFlashArgs> flashArgsList = (List <TileFlashArgs>)args.arg;

            if (flashArgsList != null)
            {
                foreach (TileFlashArgs flashArgs in flashArgsList)
                {
                    if (flashArgs.id.y == tileId.y && flashArgs.id.x == tileId.x)
                    {
                        if (type != FlashType.None)
                        {
                            if (flashCoroutine != null)
                            {
                                StopCoroutine(flashCoroutine);
                                flashCoroutine = null;
                            }
                            Visualize(flashRange.min);
                        }
                        type = flashArgs.type;
                        if (type != FlashType.None)
                        {
                            flashCoroutine = StartCoroutine(Flash());
                        }
                        break;
                    }
                }
            }
        }
示例#10
0
        private void AssertHasMessage(FlashType flashType, Number number, string contains)
        {
            var typeLocator = LocatorFromType(flashType);
            var elements    = this.Driver.FindElements(By.Id(typeLocator + (int)number));
            var exists      = string.IsNullOrWhiteSpace(contains) ? elements.Any() : elements.Any(x => x.Text.ToUpper().Contains(contains.ToUpper()));

            exists.Should().BeTrue("Message {0}{1} '{2}' should be present", typeLocator, (int)number, contains);
        }
 public void Start(FlashType flashType)
 {
     if (flashType == FlashType.Total)
     {
         return;
     }
     Flash[(int)flashType].Start();
 }
示例#12
0
 public FlashEffect(FlashType flashType) : base(0x70, 28)
 {
     m_Stream.Write(( byte)4);              //effectType
     m_Stream.Write(( int )0);              //fromSerial
     m_Stream.Write(( int )0);              //toSerial
     m_Stream.Write(( ushort )flashType);   //in regular 0x70 ItemID is here
     m_Stream.Fill(16);
 }
示例#13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Flash"/> class.
 /// </summary>
 /// <param name="manufacturer">The manufacturer.</param>
 /// <param name="typeReference">The type reference.</param>
 /// <param name="msrp">The MSRP.</param>
 /// <param name="type">The type.</param>
 /// <param name="brightness">The brightness.</param>
 /// <param name="interface">The interface.</param>
 /// <param name="focalDistance">The focal distance.</param>
 /// <param name="redEyeCorrectionEnabled">if set to <c>true</c> [red eye correction enabled].</param>
 public Flash(Company manufacturer, string typeReference, float msrp, FlashType type, BrightnessLevel brightness, Company @interface, int focalDistance, bool redEyeCorrectionEnabled) : base(manufacturer, typeReference, msrp)
 {
     Type                    = type;
     Brightness              = brightness;
     Interface               = @interface;
     FocalDistance           = focalDistance;
     RedEyeCorrectionEnabled = redEyeCorrectionEnabled;
 }
示例#14
0
    public void Flash(FlashDuration _duration = FlashDuration.Short)
    {
        flashType = FlashType.Hard;

        timeElapsedSinceFlashStart = 0.0f;
        flashDuration = (float)_duration * 0.01f;;

        CreateFlashTexture();

        textureAlpha = 1.0f;
    }
示例#15
0
        public static bool FlashWindow(IntPtr hWnd, FlashType type)
        {
            FLASHWINFO fInfo = new FLASHWINFO();

            fInfo.cbSize    = Convert.ToUInt32(Marshal.SizeOf(fInfo));
            fInfo.hwnd      = hWnd;       //要闪烁的窗口的句柄,该窗口可以是打开的或最小化的
            fInfo.dwFlags   = (uint)type; //闪烁的类型
            fInfo.uCount    = 3;          //闪烁窗口的次数
            fInfo.dwTimeout = 0;          //窗口闪烁的频度,毫秒为单位;若该值为0,则为默认图标的闪烁频度
            return(FlashWindowEx(ref fInfo));
        }
示例#16
0
        public byte[] ReadCpu(UInt16 address, int length, FlashType flashType = FlashType.FirstFlash)
        {
            var result = new List <byte>();

            while (length > 0)
            {
                result.AddRange(readCpuBlock(address, Math.Min(MaxReadPacketSize, length), flashType));
                address += MaxReadPacketSize;
                length  -= MaxReadPacketSize;
            }
            return(result.ToArray());
        }
示例#17
0
        /// <summary>
        /// Adds a new flash message with optional message type.
        /// </summary>
        public void Message(string text, FlashType type)
        {
            var messages = GetMessages();

            messages.Enqueue(new FlashMessage
            {
                Type = type,
                Text = text
            });

            PutMessages(messages);
        }
    public void PlayScreenFlash(FlashType flashType, Color color, float duration, int loops = 1)
    {
        switch (flashType)
        {
        case FlashType.Background:
            Instance.BackgroundFlashEffectCtrl.StartFlashEffect(color, duration, loops);
            break;

        case FlashType.Foreground:
            Instance.ForegroundFlashEffectCtrl.StartFlashEffect(color, duration, loops);
            break;
        }
    }
示例#19
0
 void CheckDirection(float opacity, float maxOpacity)
 {
     //going toward 1, switches to going toward 0
     if (flash == FlashType.fIn && opacity >= (maxOpacity - 0.1f))
     {
         flash = FlashType.fOut;
     }
     //going toward 0, switches to going toward 1
     else if (flash == FlashType.fOut && opacity <= (minOpacity + 0.1f))
     {
         flash = FlashType.fIn;
     }
 }
 protected override bool IsValidPeriod(int periodCounter)
 {
     if (periodCounter < flashCount * 2)
     {
         return(true);
     }
     else
     {
         type = FlashType.None;
         GlobalManager.MInstantMessage.DeliverMessage(InstantMessageType.PuzzleTileFlashed, this);
         return(false);
     }
 }
示例#21
0
        public FxLight(string[] tokens) : base(tokens)
        {
            Corona = tokens[9].Replace("\"", "");
            Shadow = tokens[10].Replace("\"", "");

            Distance   = float.Parse(tokens[11]);
            OuterRange = float.Parse(tokens[12]);
            Size       = float.Parse(tokens[13]);
            InnerRange = float.Parse(tokens[14]);

            ShadowIntensity = byte.Parse(tokens[15]) / 255f;
            Flash           = (FlashType)int.Parse(tokens[16]);
            Wet             = int.Parse(tokens[17]) == 1;
            Flares          = int.Parse(tokens[18]) == 1;
        }
示例#22
0
        public static void Flash(this Form window,
            FlashType type = FlashType.FLASHW_TIMERNOFG | FlashType.FLASHW_ALL, UInt32 count = UInt32.MaxValue)
        {
            window.Invoke(new MethodInvoker(delegate
            {
                FLASHWINFO fw = new FLASHWINFO();

                fw.cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(FLASHWINFO)));
                fw.hwnd = window.Handle;
                fw.dwFlags = (Int32)type;
                fw.uCount = count;

                FlashWindowEx(ref fw);
            }));
        }
示例#23
0
/*
 *              private IEntity ReadEntity( GenericReader reader )
 *              {
 *                      return World.FindEntity( reader.ReadInt() );
 *              }
 */
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_FlashType = (FlashType)reader.ReadEncodedInt();
                goto case 0;
            }

            case 0:
            {
                m_EffectDelay  = reader.ReadTimeSpan();
                m_TriggerDelay = reader.ReadTimeSpan();
                m_SoundDelay   = reader.ReadTimeSpan();

                m_Source  = reader.ReadEntity();
                m_Target  = reader.ReadEntity();
                m_Trigger = reader.ReadItem() as EffectController;

                m_FixedDirection     = reader.ReadBool();
                m_Explodes           = reader.ReadBool();
                m_PlaySoundAtTrigger = reader.ReadBool();

                m_EffectType  = (ECEffectType)reader.ReadEncodedInt();
                m_EffectLayer = (EffectLayer)reader.ReadEncodedInt();
                m_TriggerType = (EffectTriggerType)reader.ReadEncodedInt();

                m_ItemID                = reader.ReadEncodedInt();
                m_Hue                   = reader.ReadEncodedInt();
                m_RenderMode            = reader.ReadEncodedInt();
                m_Speed                 = reader.ReadEncodedInt();
                m_Duration              = reader.ReadEncodedInt();
                m_ParticleEffect        = reader.ReadEncodedInt();
                m_ExplodeParticleEffect = reader.ReadEncodedInt();
                m_ExplodeSound          = reader.ReadEncodedInt();
                m_Unknown               = reader.ReadEncodedInt();
                m_SoundID               = reader.ReadEncodedInt();
                m_TriggerRange          = reader.ReadEncodedInt();

                break;
            }
            }
        }
示例#24
0
        /// <summary>
        /// 闪烁窗口
        /// </summary>
        /// <param name="hWnd">窗口句柄</param>
        /// <param name="type">闪烁类型</param>
        /// <returns></returns>
        public static bool FlashWindowEx(System.Windows.Window win, FlashType type)
        {
            //if (win.IsActive)
            //    return false;

            WindowInteropHelper hWnd = new WindowInteropHelper(win);

            FLASHWINFO fInfo = new FLASHWINFO();

            fInfo.cbSize    = Convert.ToUInt32(Marshal.SizeOf(fInfo));
            fInfo.hwnd      = hWnd.Handle;     //要闪烁的窗口的句柄,该窗口可以是打开的或最小化的
            fInfo.dwFlags   = (uint)type;      //闪烁的类型
            fInfo.uCount    = UInt32.MaxValue; //闪烁窗口的次数
            fInfo.dwTimeout = 0;               //窗口闪烁的频度,毫秒为单位;若该值为0,则为默认图标的闪烁频度
            return(FlashWindowEx(ref fInfo));
        }
示例#25
0
        private string LocatorFromType(FlashType flashType)
        {
            switch (flashType)
            {
            case FlashType.Info:
                return(FlashHelpers.Info);

            case FlashType.Warning:
                return(FlashHelpers.Warning);

            case FlashType.Error:
                return(FlashHelpers.Error);
            }

            throw new ArgumentException();
        }
示例#26
0
 public void switchOn(FlashType type)
 {
     switch(type) {
         case FlashType.Red: {
             switchOnRed();
             return;
         }
         case FlashType.Yellow: {
             switchOnYellow();
             return;
         }
         case FlashType.Green: {
             switchOnGreen();
             return;
         }
     }
 }
示例#27
0
        public Flash(FlashType type, int capasity)
        {
            switch (type)
            {
            case FlashType.f30:
                wRSpeed = 500;
                break;

            case FlashType.f31:
                wRSpeed = 1000;
                break;

            case FlashType.f32:
                wRSpeed = 1200;
                break;
            }
            this.capasity = capasity;
        }
示例#28
0
        public void switchOn(FlashType type)
        {
            switch (type)
            {
            case FlashType.Red: {
                switchOnRed();
                return;
            }

            case FlashType.Yellow: {
                switchOnYellow();
                return;
            }

            case FlashType.Green: {
                switchOnGreen();
                return;
            }
            }
        }
示例#29
0
        public IEnumerator ShowFlash(FlashType type)
        {
            FlashPanel.SetActive(true);
            switch (type)
            {
            case FlashType.GetDamage:
                Flash.color = new Color(GetDamageFlashColor.r, GetDamageFlashColor.g, GetDamageFlashColor.b, 0);
                break;

            case FlashType.Intoxication:
                Flash.color = new Color(IntoxicationFlashColor.r, IntoxicationFlashColor.g, IntoxicationFlashColor.b, 0);
                break;
            }

            TweenAlpha.Begin(Flash.gameObject, 0.3f, 0.6f);
            yield return(new WaitForSeconds(0.4f));

            TweenAlpha.Begin(Flash.gameObject, 0.3f, 0.0f);
            yield return(new WaitForSeconds(0.3f));

            FlashPanel.SetActive(false);
        }
示例#30
0
        public void WritePrgFlash(UInt16 address, byte[] data, FlashType flashType = FlashType.FirstFlash, bool accelerated = false)
        {
            int wlength      = data.Length;
            int pos          = 0;
            int writeCounter = 0;

            cpuWriteDoneCounter = 0;
            while (wlength > 0)
            {
                var wdata = new byte[Math.Min(MaxWritePacketSize, wlength)];
                Array.Copy(data, pos, wdata, 0, wdata.Length);
                if (containsNotFF(data))
                {
                    writePrgFlashBlock(address, wdata, !accelerated, flashType);
                    writeCounter++;
                    if (accelerated)
                    {
                        Thread.Sleep(40);
                    }
                }
                address += MaxWritePacketSize;
                pos     += MaxWritePacketSize;
                wlength -= MaxWritePacketSize;
                //Console.WriteLine("{0} / {1}", writeCounter, prgWriteDoneCounter);
            }
            if (accelerated)
            {
                for (int t = 0; t < Timeout; t += 5)
                {
                    Thread.Sleep(5);
                    if (cpuWriteDoneCounter >= writeCounter)
                    {
                        return;
                    }
                }
                throw new IOException("Write timeout");
            }
        }
		public FlashEffect( FlashType flashType ) : base( 0x70, 28 )
		{
			m_Stream.Write( (byte) 4 ); //effectType
			m_Stream.Write( (int) 0 ); //fromSerial
			m_Stream.Write( (int) 0 ); //toSerial
			m_Stream.Write( (ushort) flashType ); //in regular 0x70 ItemID is here
		
			m_Stream.Fill( 16 );

			/* all this properties below are not used in Flash
			m_Stream.Write( ( short )0 );//fromX
			m_Stream.Write( ( short )0 );//fromY
			m_Stream.Write( ( sbyte )0 );//fromZ
			m_Stream.Write( ( short )0 );//toX
			m_Stream.Write( ( short )0 );//toY
			m_Stream.Write( ( sbyte )0 );//toZ
			m_Stream.Write( ( byte )0 );//speed 
			m_Stream.Write( ( byte )0 );//duration
			m_Stream.Write( ( short )0 );
			m_Stream.Write( ( bool )0 );//fixeddirection
			m_Stream.Write( ( bool )0 );//explodes
			*/
		}
示例#32
0
        public FlashEffect(FlashType flashType) : base(0x70, 28)
        {
            m_Stream.Write((byte)4);               //effectType
            m_Stream.Write((int)0);                //fromSerial
            m_Stream.Write((int)0);                //toSerial
            m_Stream.Write((ushort)flashType);     //in regular 0x70 ItemID is here

            m_Stream.Fill(16);

            /* all this properties below are not used in Flash
             * m_Stream.Write( ( short )0 );//fromX
             * m_Stream.Write( ( short )0 );//fromY
             * m_Stream.Write( ( sbyte )0 );//fromZ
             * m_Stream.Write( ( short )0 );//toX
             * m_Stream.Write( ( short )0 );//toY
             * m_Stream.Write( ( sbyte )0 );//toZ
             * m_Stream.Write( ( byte )0 );//speed
             * m_Stream.Write( ( byte )0 );//duration
             * m_Stream.Write( ( short )0 );
             * m_Stream.Write( ( bool )0 );//fixeddirection
             * m_Stream.Write( ( bool )0 );//explodes
             */
        }
示例#33
0
 static string GetCssClassFor(FlashType type)
 {
     switch (type)
     {
         case FlashType.Error: return "alert alert-error";
         case FlashType.Notice: return "alert";
         case FlashType.Info: return "alert alert-info";
         case FlashType.Success: return "alert alert-success";
         default: return "flashInfo";
     }
 }
示例#34
0
 /// <summary>
 /// Pass a certain key to the view to signify certain message intention. It's up to the view to decide what string to display
 /// </summary>
 /// <param name="self"></param>
 /// <param name="key"></param>
 /// <param name="type"></param>
 public static void FlashKey(this Controller self, string key, FlashType type = FlashType.Notice)
 {
     Flash(self, type, key, "");
 }
示例#35
0
        /// <summary>
        /// Interrogate whether a certain flash type exists
        /// </summary>
        /// <param name="self"></param>
        /// <param name="type"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public static bool IfFlash(this WebViewPage self, FlashType type, string key = null)
        {
            var tmpData = self.TempData["FlashMessage_" + key];
            var tmpType = self.TempData["FlashMessageType_" + key];

            if (tmpData != null)
            {
                FlashType tp;

                if (Enum.TryParse(tmpType + "", out tp))
                {
                    return tp == type;
                }
                else
                    return false;
            }
            else
                return false;
        }
 /// <summary>
 /// The set flash.
 /// </summary>
 /// <param name="message">
 /// The message.
 /// </param>
 /// <param name="type">
 /// The type.
 /// </param>
 protected void SetFlash(string message, FlashType type)
 {
     this.Session["flash"] = new Flash(message, type);
 }
示例#37
0
        private string LocatorFromType(FlashType flashType)
        {
            switch (flashType) {
                case FlashType.Info:
                    return FlashHelpers.Info;
                    case FlashType.Warning:
                    return FlashHelpers.Warning;
                    case FlashType.Error:
                    return FlashHelpers.Error;
            }

            throw new ArgumentException();
        }
示例#38
0
		//Send flash effect to all clients in range (like bolt effect)
		public static void SendFlashEffect( IEntity e, FlashType flash )
		{
			Map map = e.Map;

			if ( map == null )
				return;

			e.ProcessDelta();

			Packet flashEffect = null;

			IPooledEnumerable eable = map.GetClientsInRange( e.Location );

			foreach ( NetState state in eable )
			{
				if ( state.Mobile.CanSee( e ) && state.Version >= m_FlashEffectVersion )
				{
					if ( flashEffect == null )
						flashEffect = Packet.Acquire( new FlashEffect( flash ) );

					state.Send( flashEffect );
				}
			}

			Packet.Release( flashEffect );

			eable.Free();
		}
示例#39
0
        public static void SendIndividualFlashEffect(Mobile e, FlashType flash)
        {
            if (e == null || e.NetState == null) return;
            Map map = e.Map;

            if (map == null)
                return;

            e.ProcessDelta();

            Packet flashEffect = null;

            NetState state = e.NetState;

            if (state.Version >= m_FlashEffectVersion)
            {
                if (flashEffect == null)
                    flashEffect = Packet.Acquire(new FlashEffect(flash));

                state.Send(flashEffect);
            }
            Packet.Release(flashEffect);
        }
示例#40
0
	void Update ()
	{
		// Easy access to our state info. Many scripts use this.
		BaseStateInfo = anim.GetCurrentAnimatorStateInfo (0);
		BaseNextStateInfo = anim.GetNextAnimatorStateInfo (0);
		// Keep our stun amount clamped to certain values while slowly decreasing
		// it if it is over 0.
		_stunAmount = Mathf.Clamp (_stunAmount - 0.25f * Time.deltaTime, 0, 8.5f);
		// If we are currently changing color or flashing in some way.
		if(_matOrFlashChange)
		{
			if(_matOrFlashChangeTimer > 0)
				_matOrFlashChangeTimer -= Time.deltaTime;
			else
			{
				_matOrFlashChangeTimer = 0;
				_matOrFlashChange = false;
				if(IsEnemy || anim.GetInteger("Health") > 0
					|| playerLives > 0)
				{
					// I just use this one to end color changing and flashing.
					mySkinnedMeshes.Flashing(false, _myFlashType, _myDefaultColor);
					_myFlashType = FlashType.None;
					if(anim.GetInteger("Health") > 0)
						Vulnerable = true;
				}
				else
				{
					// We flash after dieing so if health isn't greater than 0
					// here, then we have lost our last life and get disabled.
					// This is only done when there is more than one player
					// remaining.
					gameObject.SetActive(false);
				}
			}
		}
		else
		{
			// In case the skinned mesh renderers for some reason don't get
			// reenabled. I only noticed this for Unity guy since he doesn't
			// have a ragdoll.  It happened randomly but this will fix it.
			if(!mySkinnedMeshes[mySkinnedMeshes.Length - 1].enabled && anim.GetInteger("Health") > 0 && !Busy)
			{
				mySkinnedMeshes.Flashing(false, _myFlashType, _myDefaultColor);
				_myFlashType = FlashType.None;
			}
		}
		// Return if in a cutscene.
		if(Manager_Cutscene.instance.inCutscene)
			return;

		if(!anim.IsInTransition(0))
		{
			if(BaseStateInfo.IsTag("NotBusy"))
			{
				// Here is where we randomly go into another Idle animation when
				// in idle long enough. Can't be done with low health
				// which is shown when layer(1)'s weight is set to 1.
				if(BaseStateInfo.IsName("Idle"))
				{
					if(anim.GetLayerWeight(1) == 0)
					{
						if(BaseStateInfo.IsName("Idle"))
						{
							// After the animation has ended for a while.
							if(BaseStateInfo.normalizedTime > Random.Range(1.5f, 2.5f))
								anim.CrossFade("Idle_2", 0.2f);
						}
					}
				}
			}
			// Air evade attemption! If we are hurt we wait until most of the animation has finished (> 0.6f)
			if(!_charMotor.onGround && myRigidbody.velocity.y < 2.5f && Vulnerable
				&& ((BaseStateInfo.IsTag("Hurt") && anim.GetInteger("HurtOther") < 2 && BaseStateInfo.normalizedTime > 0.6f)
					|| BaseStateInfo.IsTag("NotBusy")))
			{
				bool escaped = false;
				if(AIOn || IsEnemy)
				{
					escaped = _characterAI.AttemptAirEvade();
				}
				else
				{
					escaped = _playerInput.enabled ? _playerInput.AttemptAirEvade() : _playerInputMobile.AttemptAirEvade();
				}
				if(escaped)
				{
					// We will go into a dodge animation, either left or right.
					if(Random.value > 0.5f)
						anim.CrossFade("Dodging.DodgeRight", 0.1f);
					else anim.CrossFade("Dodging.DodgeLeft", 0.1f);
				}
			}
		}
	}
示例#41
0
	// Flashing setup. You can choose to flash a certain color, or disable
	// and reenable your skinned mesh renderers.
	void StartFlash(float delay, float repeatRate, float flashLength, FlashType myFlashType)
	{
		// When this timer reaches 0 in update, the flashing will end and
		// you will be vulnerable again.
		_matOrFlashChangeTimer = flashLength;
		_myFlashType = myFlashType;
		_matOrFlashChange = true;
		// This will keep going for as long as you specified for flash length.
		InvokeRepeating ("FlashEffect", delay, repeatRate);
	}
示例#42
0
 public static string[] Get(FlashType type)
 {
     var array = Messenger.Messages[type].ToArray();
     Messenger.Messages[type].Clear();
     return array;
 }
 /// <summary>
 ///     Setting a flash that will be show on the next request.
 /// </summary>
 protected void SetFlash(string message, FlashType type)
 {
     // BUG Flash must be saved in 2 seperate sessions and can be saved a object.
     this.Session["flash"] = message;
     this.Session["type"] = type.ToString().ToLower();
 }
示例#44
0
 public FlashEffect( FlashType flashType )
     : base(0x70, 28)
 {
     m_Stream.Write( (byte) 4 ); // EffectType
     m_Stream.Write( (int) 0 );
     m_Stream.Write( (int) 0 );
     m_Stream.Write( (ushort) flashType );
     m_Stream.Fill( 16 );
 }
示例#45
0
 public void AssertHasAdditionalMessage(FlashType flashType = FlashType.Info)
 {
     this.AssertHasMessage(flashType, Number.Four, "ADDITIONAL MESSAGES EXIST BUT HAVE BEEN SUPPRESSED.");
 }
示例#46
0
        private void AssertHasMessage(FlashType flashType, Number number, string contains)
        {
            var typeLocator = LocatorFromType(flashType);
            var elements = this.Driver.FindElements(By.Id(typeLocator + (int)number));
            var exists = string.IsNullOrWhiteSpace(contains) ? elements.Any() : elements.Any(x => x.Text.ToUpper().Contains(contains.ToUpper()));

            exists.Should().BeTrue("Message {0}{1} '{2}' should be present", typeLocator, (int)number, contains);
        }
示例#47
0
 /// <summary>
 /// Enable flash message in three different types and specific key channel on which it will be displayed
 /// </summary>
 /// <param name="self"></param>
 /// <param name="type"></param>
 /// <param name="key"></param>
 /// <param name="message"></param>
 /// <param name="values"></param>
 public static void Flash(this Controller self, FlashType type, string key, string message, params object[] values)
 {
     self.TempData["FlashMessage_" + key] = message.F(values);
     self.TempData["FlashMessageType_" + key] = type.ToString();
 }
示例#48
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Flash"/> class.
 /// </summary>
 /// <param name="message">
 /// The message.
 /// </param>
 /// <param name="type">
 /// The type.
 /// </param>
 public Flash(string message, FlashType type)
 {
     this.Message = message;
     this.Type = type;
 }
示例#49
0
        /// <summary>
        /// Show the flash message in general channel or specific channel. The output uses .flashError, .flashNotice and .flashSuccess css class. If key is found, show message.
        /// </summary>
        /// <param name="self"></param>
        /// <param name="key"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static IHtmlString Flash(this WebViewPage self, string key, string message, FlashType type)
        {
            var tmpData = self.TempData["FlashMessage_" + key];//ignore
            var flush = self.TempData["FlashMessageType_" + key]; //ignore

            if (tmpData != null)
            {
                string cssClass = GetCssClassFor(type);
                return @"<div class=""{0}"">{1}</div>".F(cssClass, message).ToHtmlString();
            }
            else
                return "".ToHtmlString();
        }
示例#50
0
 public static IHtmlString FlashFormat(this WebViewPage self, string message, FlashType type)
 {
     string cssClass = GetCssClassFor(type);
     return @"<div class=""{0}"">{1}</div>".F(cssClass, message).ToHtmlString();
 }
示例#51
0
 private void OnFlashComplete()
 {
     textureAlpha = 0.0f;
     GUI.color    = new Color(255, 255, 255, textureAlpha);
     flashType    = FlashType.None;
 }
示例#52
0
 /// <summary>
 /// Enable flash message in three different types.
 /// </summary>
 /// <param name="self"></param>
 /// <param name="type"></param>
 /// <param name="message"></param>
 /// <param name="values"></param>
 public static void Flash(this Controller self, FlashType type, string message, params object[] values)
 {
     Flash(self, type, "", message, values);
 }
示例#53
0
/*
		private IEntity ReadEntity( GenericReader reader )
		{
			return World.FindEntity( reader.ReadInt() );
		}
*/
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 1:
				{
					m_FlashType = (FlashType)reader.ReadEncodedInt();
					goto case 0;
				}
				case 0:
				{
					m_EffectDelay = reader.ReadTimeSpan();
					m_TriggerDelay = reader.ReadTimeSpan();
					m_SoundDelay = reader.ReadTimeSpan();

					m_Source = reader.ReadEntity();
					m_Target = reader.ReadEntity();
					m_Trigger = reader.ReadItem() as EffectController;

					m_FixedDirection = reader.ReadBool();
					m_Explodes = reader.ReadBool();
					m_PlaySoundAtTrigger = reader.ReadBool();

					m_EffectType = (ECEffectType)reader.ReadEncodedInt();
					m_EffectLayer = (EffectLayer)reader.ReadEncodedInt();
					m_TriggerType = (EffectTriggerType)reader.ReadEncodedInt();

					m_ItemID = reader.ReadEncodedInt();
					m_Hue = reader.ReadEncodedInt();
					m_RenderMode = reader.ReadEncodedInt();
					m_Speed = reader.ReadEncodedInt();
					m_Duration = reader.ReadEncodedInt();
					m_ParticleEffect = reader.ReadEncodedInt();
					m_ExplodeParticleEffect = reader.ReadEncodedInt();
					m_ExplodeSound = reader.ReadEncodedInt();
					m_Unknown = reader.ReadEncodedInt();
					m_SoundID = reader.ReadEncodedInt();
					m_TriggerRange = reader.ReadEncodedInt();

					break;
				}
			}
		}
示例#54
0
 public static IHtmlString FlashFormat(this ViewUserControl self, bool condition, string message, FlashType type)
 {
     if (condition)
     {
         string cssClass = GetCssClassFor(type);
         return @"<div class=""{0}"">{1}</div>".F(cssClass, message).ToHtmlString();
     }
     else
         return "".ToHtmlString();
 }
示例#55
0
        private void writePrgFlashBlock(UInt16 address, byte[] data, bool wait = true, FlashType flashType = FlashType.FirstFlash)
        {
            //Console.WriteLine("{0:X8}", address);
            int length = data.Length;
            var buffer = new byte[4 + length];

            buffer[0] = (byte)(address & 0xFF);
            buffer[1] = (byte)((address >> 8) & 0xFF);
            buffer[2] = (byte)(length & 0xFF);
            buffer[3] = (byte)((length >> 8) & 0xFF);
            Array.Copy(data, 0, buffer, 4, length);
            if (wait)
            {
                cpuWriteDoneCounter = 0;
            }
            switch (flashType)
            {
            case FlashType.FirstFlash:
                sendData(Command.COMMAND_PRG_FLASH_WRITE_REQUEST, buffer);
                break;

            case FlashType.Coolboy:
                sendData(Command.COMMAND_COOLBOY_WRITE_REQUEST, buffer);
                break;

            case FlashType.Coolgirl:
                sendData(Command.COMMAND_COOLGIRL_WRITE_REQUEST, buffer);
                break;
            }
            if (wait)
            {
                for (int t = 0; t < Timeout; t += 5)
                {
                    Thread.Sleep(5);
                    if (cpuWriteDoneCounter != 0)
                    {
                        return;
                    }
                }
                throw new IOException("Write timeout");
            }
        }
示例#56
0
 public static int Count(FlashType type)
 {
     return Messenger.Messages[type].Count;
 }
示例#57
0
 public static void Add(string message, FlashType type)
 {
     Messenger.Messages[type].Enqueue(message);
 }
示例#58
0
	// Setup for changing color. I make the character change to a light blue
	// when they aren't vulnerable to show that.
	public void StartMaterialColorChange(float timeToChangeFor, ColorChangeTypes colorType)
	{
		// When this timer reaches 0, we will go back to our normal color
		// and be vulnerable again.
		_matOrFlashChangeTimer = timeToChangeFor;
		_matOrFlashChange = true;
		_myFlashType = FlashType.Color_Change;
		// Check MyExtensionMethods to see this method.
		mySkinnedMeshes.MaterialColorChange (colorType, _myDefaultColor, colorType == ColorChangeTypes.Is_Vulnerable && Vulnerable);
	}