Пример #1
0
 // Update is called once per frame
 void Update()
 {
     Timer += Time.deltaTime;
     RotationLoop();
     if (EventSystem.current.IsPointerOverGameObject(-1))            // is the touch on the GUI
     {
         return;
     }
     else if (Input.GetMouseButton(0))
     {
         if (bombState == BombState.DRAGGING)
         {
             bombIndicator.gameObject.SetActive(true);
             bombIndicator.transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition) + Vector3.forward * 10;
         }
         else
         {
             if (Timer >= fireRate)
             {
                 SpawnBullets();
                 Timer = 0;
             }
         }
     }
     else if (Input.GetMouseButtonUp(0))
     {
         if (bombState == BombState.DRAGGING)
         {
             bombIndicator.gameObject.SetActive(false);
             Instantiate(bombPrefab, bombIndicator.transform.position, Quaternion.identity);
             bombButton.ResetCooldown();
             bombState = BombState.IDLE;
         }
     }
 }
Пример #2
0
    void ThrowEgg()
    {
        float randomTime = Random.Range(randomRangeMin, randomRangeMax);

        //generate IndexNumbers
        int indexGO     = Random.Range(0, cannonBullets);
        int indexForce  = Random.Range(0, ForceindexRange);
        int indexTorque = Random.Range(0, ForceindexRange);

        //Debug.Log(indexGO);

        //Instantiate Go and call index
        Bombprefab = Instantiate(BombPrefabs[indexGO], transform.position, transform.rotation);
        Bombprefab.GetComponent <Rigidbody>().AddForce(ForceVector[indexForce]);
        Bombprefab.GetComponent <Rigidbody>().AddTorque(TorqueVector[indexTorque]);

        Invoke("ThrowEgg", randomTime);

        // play throwing sfx

        GetComponent <AudioSource>().pitch = Random.Range(0.8f, 1.2f);
        GetComponent <AudioSource>().Play();


        //float t = Time.time - startTime;
        //rb.velocity = direction * speed + orthogonal * amplitude * Mathf.Sin (frequency * t);
        //rb.AddForce(new Vector3(forceX,forceY,0));
        //rb.velocity = Vector3.zero;
        //rb.angularVelocity = Vector3.zero;
        //rb.useGravity = true;
    }
Пример #3
0
    private void ControllBombDisplacementProgress()
    {
        if (bombState == BombState.FlyingToPlayer || bombState == BombState.FlyingToEnemy)
        {
            distanceTraveled           = bombSpeed * (Time.time - timeWhenWasThrown);
            percentualDistanceTravaled = distanceTraveled / randomlyPickedThrowDistance;
            PlayArcAnimation();

            if (percentualDistanceTravaled >= 1f)
            {
                myCollider.enabled = true;
                bombAnimationController.PrepareDetonation();
                ResetArcProgress();

                if (bombState == BombState.FlyingToPlayer)
                {
                    bombState = BombState.GroundedAtPlayerArea;
                }
                else if (bombState == BombState.FlyingToEnemy)
                {
                    bombState = BombState.GroundedAtEnemyArea;
                }
            }
        }
    }
Пример #4
0
 internal RoundNode(string JSON)
     : base(JSON)
 {
     Phase   = GetEnum <RoundPhase>("phase");
     Bomb    = GetEnum <BombState>("bomb");
     WinTeam = GetEnum <RoundWinTeam>("win_team");
 }
Пример #5
0
        void Update()
        {
            if (bombCooldown < Time.timeSinceLevelLoad)
            {
                bombCooldown            = float.MaxValue;
                bombState               = BombState.WAITING;
                bombButtonText.text     = "Bomb ready";
                bombButton.interactable = true;
            }
            else
            if (bombCooldown != float.MaxValue)
            {
                bombButtonText.text = ((int)(bombCooldown - Time.timeSinceLevelLoad)).ToString();
            }

            if (seedCooldown < Time.timeSinceLevelLoad)
            {
                seedCooldown            = float.MaxValue;
                seedState               = SeedState.WAITING;
                seedButtonText.text     = "Seed ready";
                seedButton.interactable = true;
            }
            else
            if (seedCooldown != float.MaxValue)
            {
                seedButtonText.text = ((int)(seedCooldown - Time.timeSinceLevelLoad)).ToString();
            }
        }
Пример #6
0
        public void onBombDeployed()
        {
            if (firstBombDeploy)
            {
                var au = Camera.main.GetComponents <AudioSource>();
                foreach (var a in au)
                {
                    if (a.clip.name != "music")
                    {
                        a.Stop();
                    }
                    if (a.clip.name == "deploy_bomb_launched")
                    {
                        a.Play();
                    }
                }
                firstBombDeploy = false;
            }
            _sim.attachToDrag2(null);
            _targetInstance.transform.position = new Vector3(-100f, 100f);

            bombCooldown            = Time.timeSinceLevelLoad + 3f;
            bombState               = BombState.RECHARGE;
            bombButtonText.text     = "Charging";
            bombButton.interactable = false;
        }
Пример #7
0
    /// <summary>
    /// 爆弾を投げるメソッド
    /// </summary>
    /// <param name="bomb">爆弾</param>
    /// <param name="angle">角度</param>
    void BombFly(GameObject targetObj)
    {
        //角度設定
        angle = Random.Range(30, 60);

        //ターゲットポジション設定
        Vector3 targetPosition = targetObj.transform.position;

        //初速計算
        float v0 = V0Culculater(transform.position, targetPosition, angle, Grav.y);

        //0以下なら投げない
        if (v0 <= 0)
        {
            Destroy(gameObject);
            return;
        }

        //ベクトル計算
        Vector3 velocity = VectorToVector3(v0, angle, targetPosition);

        //射出する力計算 力=速度ベクトル*重さ
        Vector3 force = velocity * GetComponent <Rigidbody>().mass;

        //射出
        GetComponent <Rigidbody>().AddForce(force, ForceMode.Impulse);

        bombState = BombState.NORMAL;
    }
Пример #8
0
 public void Update()
 {
     age++;
     animationTick++;
     if (animationTick > 40)
     {
         animationTick = 0;
         if (animationFrame == 1)
         {
             if (animationBool)
             {
                 animationFrame = 0;
             }
             else
             {
                 animationFrame = 2;
             }
             animationBool = !animationBool;
         }
         else
         {
             animationFrame = 1;
         }
     }
     if (age > 500)
     {
         owner.ReplenishBomb();
         state = BombState.EXPLODED;
     }
 }
Пример #9
0
 internal RoundNode(string JSON)
     : base(JSON)
 {
     Phase = GetEnum<RoundPhase>("phase");
     Bomb = GetEnum<BombState>("bomb");
     WinTeam = GetEnum<RoundWinTeam>("win_team");
 }
Пример #10
0
        private void createBomb(PlayerID _id, Ship s)
        {
            BombData data = BombManager.Instance().getNextBomb(_id);

            bombID = data.ID;

            bombsprite = data.sprite;
            spriteRef  = new Sprite_Proxy(bombsprite, (int)s.spriteRef.pos.X, (int)s.spriteRef.pos.Y, 0.5f, Color.White);

            SBNode bombBatch = SpriteBatchManager.Instance().getBatch(batchEnum.bomb);

            bombBatch.addDisplayObject(spriteRef);

            orgPos = spriteRef.pos;


            if (_id == PlayerID.one)
            {
                image1 = ImageManager.Instance().getImage(ImageEnum.bluebomb1);
                image2 = ImageManager.Instance().getImage(ImageEnum.bluebomb2);
            }
            else
            {
                image1 = ImageManager.Instance().getImage(ImageEnum.greenbomb1);
                image2 = ImageManager.Instance().getImage(ImageEnum.greenbomb2);
            }

            spriteRef.sprite.image = image1;

            curImage = 0;

            state = BombState.alive;
        }
Пример #11
0
 public void SetUpThrowAgainstPlayer()
 {
     positionWhenThrownByEnemy = transform.position;
     positionWhenLanded        = positionWhenThrownByEnemy + Vector2.down * randomlyPickedThrowDistance;
     // Get a Time reference for the moment the action begun
     timeWhenWasThrown = Time.time;
     bombState         = BombState.FlyingToPlayer;
 }
Пример #12
0
    void CreateExplosion()
    {
        bombState = BombState.Exploded;
        GameObject clone;

        clone = Instantiate(explosion, transform.position, Quaternion.identity) as GameObject;
        ExplodeAnythingNearBomb();
    }
Пример #13
0
        private void Activate()
        {
            if (this.State != BombState.Normal)
            {
                return;
            }

            this.State = BombState.Activated;
            this._taskProcessor.Add(new DetonateBombTask(this));
        }
Пример #14
0
 private void SetDefaultVariables()
 {
     // Prevent Bomb from colliding with Enemy before it is thrown
     myCollider.enabled = false;
     // Select a random distance for the Bomb to be thrown at
     randomlyPickedThrowDistance = Random.Range(minimumThrowDistance, maximumThrowDistance);
     // Modify the speed according to the distance the Bomb will travel
     bombSpeed = minimumBombSpeed * randomlyPickedThrowDistance / minimumThrowDistance;
     // Set the Bomb initial state
     bombState = BombState.NotThrown;
 }
Пример #15
0
 /// <summary>
 /// ターゲット変更
 /// </summary>
 /// <param name="newOrigin"></param>
 public void TargetChange(GameObject newOrigin)
 {
     //移動量を0に
     rigid.velocity = Vector3.zero;
     //死亡時間初期化
     deathTime = 10.0f;
     //投擲元をターゲットに
     targetObject = originObject;
     //新しい投擲元を追加
     originObject = newOrigin;
     //直線移動
     bombState = BombState.STRAIGHT;
 }
Пример #16
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Unit unit = collision.GetComponent <Unit>();


        if (unit && unit is Ninja)
        {
            State = BombState.Explode;

            unit.ResieveDamage();
            Destroy(gameObject, 1.0F);
        }
    }
Пример #17
0
        public void SetBombLogic(BaseBomb logic)
        {
            m_stBombLogic = logic;
            GameObject pfb    = Resources.Load("Spine/ZD" + logic.Config.m_iResourceID) as GameObject;
            GameObject aniObj = Instantiate <GameObject>(pfb);

            aniObj.transform.parent     = this.transform;
            aniObj.transform.position   = this.transform.position;
            m_stAnimation               = aniObj.GetComponent <SkeletonAnimation>();
            m_stAnimation.AnimationName = SkillManager.cur_fly;
            m_stAnimation.loop          = true;
            m_eState = BombState.FLY;
        }
Пример #18
0
 private void OnFly()
 {
     this.transform.localPosition = new Vector3(m_stBombLogic.Position.x / 100, m_stBombLogic.Position.y / 100, 5);
     if (m_stBombLogic.IsLiving == false && m_eState == BombState.FLY)
     {
         m_eState                    = BombState.BOMB;
         can_play_bomb               = 1;
         m_stAnimation.loop          = false;
         m_stAnimation.AnimationName = SkillManager.cur_boom;
         m_stAnimation.state.End    += OnBombEnd;
         return;
     }
 }
Пример #19
0
        public Bomb(int gridPosX, int gridPosY, int size, BombType type, Player owner)
        {
            this.gridPosX = gridPosX;
            this.gridPosY = gridPosY;
            this.size     = size;
            this.type     = type;
            this.owner    = owner;

            state = BombState.PLACED;
            age   = 0;

            animationTick  = 0;
            animationBool  = false;
            animationFrame = 0;
        }
Пример #20
0
    /// <summary>
    /// 通常動作
    /// </summary>
    void BombNormal()
    {
        //ランダム回転しながら飛んでいく
        transform.Rotate(new Vector3(Random.Range(0, 180),
                                     Random.Range(0, 180),
                                     Random.Range(0, 180)
                                     ) * Time.deltaTime);
        //自分で設定した重力を加える
        rigid.AddForce(-Grav, ForceMode.Acceleration);

        deathTime -= Time.deltaTime;
        //消滅までの時間が0になったら(時間が来たら)
        if (deathTime <= 0)
        {
            //オブジェクト消滅状態に
            bombState = BombState.DEATH;
        }
    }
Пример #21
0
    // 保持中
    void Holding()
    {
        transform.position = m_BombHolder.transform.position;

        // RBボタンが押されてなかったら消滅
        if (!Input.GetButton("Bomb_Hold"))
        {
            Destroy(gameObject);
        }

        // 着弾点を表示

        // LBボタンを押して投擲
        if (Input.GetButtonDown("Bomb_Throw"))
        {
            Throw();
            m_State = BombState.Thrown;
        }
    }
Пример #22
0
        public void Detonate()
        {
            if (this.State == BombState.Detonated)
            {
                return;
            }

            this.State = BombState.Detonated;
            this._map.RemoveEntity(this);

            var pointsToFire = this.ListPointsToFire();

            pointsToFire.ForEach(point =>
                                 point.AddEntity(
                                     this._entityFactory.Create(
                                         EntityType.Fire,
                                         point.X,
                                         point.Y)));
        }
Пример #23
0
    public void SetUpThrowAgainstCaster()
    {
        // Adjusts the start position so that the Bomb falls in the same y coordinate
        // as the enemy, when thrown back by the player, blocking his horizontal movements
        positionWhenThrownByEnemy += Vector2.down * 0.5f;
        // Check if the Enemy in in front of the Bomb and, if positive, return his position
        Vector2 _newPositionWhenThrownByEnemy = LaunchRaycast(positionWhenThrownByEnemy);

        // Select the adaquete destination Vector2 for the Bomb
        if (_newPositionWhenThrownByEnemy != Vector2.zero)
        {
            positionWhenThrownByEnemy = _newPositionWhenThrownByEnemy;
        }
        // Get a Time reference for the moment the action begun
        timeWhenWasThrown = Time.time;
        // travelBack = true;
        bombState = BombState.FlyingToEnemy;
        // Suspend Bomb detonation
        bombAnimationController.HoldDetonation();
    }
Пример #24
0
        public void Update(GameTime gameTime)
        {
            switch (state)
            {
            case BombState.CountDown:
                elapsedGameTime += (int)gameTime.ElapsedGameTime.TotalMilliseconds;
                countDownTime   -= (int)gameTime.ElapsedGameTime.TotalMilliseconds;
                if (elapsedGameTime > 25)
                {
                    elapsedGameTime = 0;
                    sprite.Next();
                }
                if (countDownTime <= 0)
                {
                    elapsedGameTime = 0;
                    state           = BombState.Explosion;
                    SoundManager.Instance.PlaySound(SoundManager.SoundType.Explosion);
                    Explose();
                }
                break;

            case BombState.Explosion:
                if (explosionLevel == 10)
                {
                    state = BombState.End;
                    break;
                }
                explosionLevelIncreaseTime -= (int)gameTime.ElapsedGameTime.TotalMilliseconds;
                if (explosionLevelIncreaseTime <= 0)
                {
                    explosionLevelIncreaseTime = 25;
                    explosionLevel++;
                    Explose();
                }

                break;

            case BombState.End:
                break;
            }
        }
Пример #25
0
        public void onBombClick()
        {
            if (firstBombClick)
            {
                var au = Camera.main.GetComponents <AudioSource>();
                foreach (var a in au)
                {
                    if (a.clip.name != "music")
                    {
                        a.Stop();
                    }
                    if (a.clip.name == "deploy_bomb_hint")
                    {
                        a.Play();
                    }
                }
                firstBombClick = false;
            }
            switch (bombState)
            {
            case BombState.WAITING:
                bombButtonText.text = "Cancel deploy";
                bombState           = BombState.BOMB_DEPLOY;
                _sim.attachToDrag2(_targetInstance);
                break;

            case BombState.BOMB_DEPLOY:
                bombButtonText.text = "Bomb ready";
                bombState           = BombState.WAITING;
                _sim.attachToDrag2(null);
                _targetInstance.transform.position = new Vector3(-100f, 100f);
                break;

            case BombState.RECHARGE:
                Debug.LogWarning("recharge");
                break;
            }
        }
Пример #26
0
        public Bomb(int i, int j, Rectangle rect, Rectangle leftLimit, Rectangle rightLimit, Rectangle topLimit, Rectangle bottomLimit, Point[] explosionLogicArea)
        {
            this.ExplosionArea = explosionLogicArea;
            this.i             = i;
            this.j             = j;
            canExplosionToTop  = canExplosionToBottom = canExplosionToLeft = canExplosionToRight = true;
            explosionArea      = new List <Rectangle>();
            var unit            = Global.Instance.GameUnit;
            var explosionOffset = unit / 2;

            explosionTexture           = ResManager.Instance.Explosion;
            explosionLevelIncreaseTime = 25;
            explosionLevel             = 1;
            countDownTime    = 3000;
            this.state       = BombState.CountDown;
            this.rect        = rect;
            this.leftLimit   = leftLimit;
            this.rightLimit  = rightLimit;
            this.topLimit    = topLimit;
            this.bottomLimit = bottomLimit;
            this.texture     = ResManager.Instance.Bomb;
            sprite           = new AnimationSprite();
            sprite.Load(this.texture, this.texture.Width / 8, this.texture.Height, 8, 0);
        }
    // Update is called once per frame
    void Update()
    {
        switch (_bombState)
        {
        case BombState.primed:
            currentBombTimer -= Time.deltaTime;
            bombAnim.SetBool("IsCooking", false);
            if (currentBombTimer <= (maxBombTime / 2))    //less than half time
            {
                audioManager.PlaySound(tickSound);
                _bombState = BombState.cooking;
            }
            break;

        case BombState.cooking:
            currentBombTimer -= Time.deltaTime;
            bombAnim.SetBool("IsCooking", true);
            if (currentBombTimer <= 0)    //end of time;
            {
                audioManager.PlaySound(tickSound);
                _bombState = BombState.exploding;
            }
            break;

        case BombState.exploding:
            bombRB.velocity = Vector2.zero;
            if (!hasExploded)
            {
                StartCoroutine(Explosion());
            }
            break;

        default:
            break;
        }
    }
Пример #28
0
            /*
            private Action guardWallsMove (FSM<BomberAgent> fsm)
            {
                State<BomberAgent> current = fsm.getCurrentState ();

                Action move = null;
                State<BomberAgent> nextState = null;

                if (current is PredictDestinationState) {
                    if (current.fail (this)) {
                        nextState = new BlastWallState (this.gs, false);
                    } else if (current.complete(this)) {
                        nextState = new BombState(this.gs);
                    }
                } else if (current is BlastWallState) {
                    if (current.fail (this) || current.complete (this)) {
                        nextState = new EvadeExplosionState(this.gs);
                    }
                } else if (current is BombState) {
                    if (current.fail (this) || current.complete (this)) {
                        nextState = new EvadeExplosionState(this.gs);
                    }
                } else if (current is EvadeExplosionState) {
                    if (current.fail (this) || current.complete (this)) {
                        nextState = new PredictDestinationState(this.gs, this.isBombPassable);
                    }
                }

                if (nextState != null) {
                    Console.WriteLine ("Agent " + this.agentId + " switching to " + nextState.GetType ().ToString ());
                    fsm.changeState (nextState);
                }
                move = fsm.getCurrentState ().getAction (this);
                Console.WriteLine ("Agent " + this.agentId + ", state " + fsm.getCurrentState ().GetType ().ToString () + ", move " + move);
                return move;
            }
            */
            private Action surroundPlayerFSM(FSM<BomberAgent> fsm)
            {
                State<BomberAgent> current = fsm.getCurrentState();

                Action move = null;
                //check if blowing up stuff and we need to evade bombs!!
                //if (current is BlastWallState) {
                //for (int i = 0; i < this.gs.NumberAIBombermen; i++) {
                Coords botCoords = this.gs.GetAgentCoords(this.agentId + 1);
                bool shouldMove = this.gs.isOnExplosionPath(botCoords);
                if (shouldMove)
                {
                    State<BomberAgent> newState = new EvadeExplosionState(this.gs);
                    Console.WriteLine("Agent " + this.agentId + " switching to EvadeExplosionState");
                    fsm.changeState(newState);
                    move = fsm.getCurrentState().getAction(this);
                    Console.WriteLine("Agent " + this.agentId + ", state " + fsm.getCurrentState().GetType().ToString() + ", move " + move);
                    return move;
                }
                //}
                //}

                if (current.fail(this))
                {
                    Console.WriteLine("Failed strategy " + current.GetType());
                    if (current is SurroundState)
                    {
                        //Chaaarrge!! Blow our way to the player!!!
                        Console.WriteLine("Switching to BlastWallState");
                        BlastWallState newState = new BlastWallState(this.gs, false);
                        fsm.changeState(newState);
                    }
                    else if (current is BombState)
                    {
                        Console.WriteLine("Switching to SurroundState");
                        //this.current = new Surround(this.gs, this.surroundIgnoreBombs);
                        //this.current = new Surround(this.gs, this.isBombPassable);
                        SurroundState newState = new SurroundState(this.gs, this.isBombPassable);
                        fsm.changeState(newState);
                    }
                    else if (current is BlastWallState)
                    {
                        //map fail.... ruh roh
                        Console.WriteLine("AI can't move... map fail");
                        //switch to BombState as last-ditch resort...
                        Console.WriteLine("Switching to BombState");
                        BombState newState = new BombState(this.gs);
                        fsm.changeState(newState);
                    }
                }

                if (current.complete(this))
                {
                    Console.WriteLine("Agent " + this.agentId + " completed strategy " + current.GetType());
                    if (current is SurroundState)
                    {
                        //this.current = new KillPlayer(this.gs);
                        Console.WriteLine("Switching to BombState");
                        BombState newState = new BombState(this.gs);
                        fsm.changeState(newState);
                    }
                    else
                    {
                        //this.current = new Surround(this.gs, this.surroundIgnoreBombs);
                        //this.current = new Surround(this.gs, this.isBombPassable);
                        SurroundState newState = new SurroundState(this.gs, this.isBombPassable);
                        Console.WriteLine("Agent " + this.agentId + " switching to SurroundState");
                        fsm.changeState(newState);
                    }
                }

                //fsm.getCurrentState().execute(this);
                //return this.current;
                move = fsm.getCurrentState().getAction(this);
                Console.WriteLine("Agent " + this.agentId + ", state " + fsm.getCurrentState().GetType().ToString() + ", move " + move);
                return move;
            }
 public void Detonate()
 {
     _bombState = BombState.exploding;
 }
Пример #30
0
        void Update()
        {
            if (bombCooldown < Time.timeSinceLevelLoad)
            {
                bombCooldown = float.MaxValue;
                bombState = BombState.WAITING;
                bombButtonText.text = "Bomb ready";
                bombButton.interactable = true;
            }
            else
            if (bombCooldown != float.MaxValue)
            {
                bombButtonText.text = ((int)(bombCooldown - Time.timeSinceLevelLoad)).ToString();
            }

            if (seedCooldown < Time.timeSinceLevelLoad)
            {
                seedCooldown = float.MaxValue;
                seedState = SeedState.WAITING;
                seedButtonText.text = "Seed ready";
                seedButton.interactable = true;
            }
            else
            if (seedCooldown != float.MaxValue)
            {
                seedButtonText.text = ((int)(seedCooldown - Time.timeSinceLevelLoad)).ToString();
            }
        }
Пример #31
0
 public void onBombClick()
 {
     if (firstBombClick)
     {
         var au = Camera.main.GetComponents<AudioSource>();
         foreach (var a in au)
         {
             if (a.clip.name != "music")
             {
                 a.Stop();
             }
             if (a.clip.name == "deploy_bomb_hint")
             {
                 a.Play();
             }
         }
         firstBombClick = false;
     }
     switch(bombState)
     {
         case BombState.WAITING:
             bombButtonText.text = "Cancel deploy";
             bombState = BombState.BOMB_DEPLOY;
             _sim.attachToDrag2(_targetInstance);
             break;
         case BombState.BOMB_DEPLOY:
             bombButtonText.text = "Bomb ready";
             bombState = BombState.WAITING;
             _sim.attachToDrag2(null);
             _targetInstance.transform.position = new Vector3(-100f, 100f);
             break;
         case BombState.RECHARGE:
             Debug.LogWarning("recharge");
             break;
     }
 }
Пример #32
0
 public virtual void Explode(float updatePeriod)
 {
     Console.WriteLine("Explode");
     state = BombState.EXPLODE;
 }
Пример #33
0
        public void onBombDeployed()
        {
            if (firstBombDeploy)
            {
                var au = Camera.main.GetComponents<AudioSource>();
                foreach (var a in au)
                {
                    if (a.clip.name != "music")
                    {
                        a.Stop();
                    }
                    if (a.clip.name == "deploy_bomb_launched")
                    {
                        a.Play();
                    }
                }
                firstBombDeploy = false;
            }
            _sim.attachToDrag2(null);
            _targetInstance.transform.position = new Vector3(-100f, 100f);

            bombCooldown = Time.timeSinceLevelLoad + 3f;
            bombState = BombState.RECHARGE;
            bombButtonText.text = "Charging";
            bombButton.interactable = false;
        }
Пример #34
0
        private void createBomb(PlayerID _id, Ship s)
        {
            BombData data = BombManager.Instance().getNextBomb(_id);

            bombID = data.ID;

            bombsprite = data.sprite;
            spriteRef = new Sprite_Proxy(bombsprite, (int)s.spriteRef.pos.X, (int)s.spriteRef.pos.Y, 0.5f, Color.White);

            SBNode bombBatch = SpriteBatchManager.Instance().getBatch(batchEnum.bomb);
            bombBatch.addDisplayObject(spriteRef);

            orgPos = spriteRef.pos;

            if (_id == PlayerID.one)
            {
                image1 = ImageManager.Instance().getImage(ImageEnum.bluebomb1);
                image2 = ImageManager.Instance().getImage(ImageEnum.bluebomb2);
            }
            else
            {
                image1 = ImageManager.Instance().getImage(ImageEnum.greenbomb1);
                image2 = ImageManager.Instance().getImage(ImageEnum.greenbomb2);
            }

            spriteRef.sprite.image = image1;

            curImage = 0;

            state = BombState.alive;
        }
Пример #35
0
            private Action blockEscapeMove(FSM<BomberAgent> fsm)
            {
                State<BomberAgent> current = fsm.getCurrentState();

                Action move = null;
                State<BomberAgent> nextState = null;

                if (current is PursueState)
                {
                    if (current.fail(this))
                    {
                        nextState = new BlastWallState(this.gs, false);
                    }
                    else
                    {

                        //check for four adjacent locations open near player
                        Coords playerCoords = this.gs.GetAgentCoords(0);
                        List<Coords> adj = this.gs.GetAdjacentAccessibleTiles(playerCoords.getTileNum(), this.isBombPassable, false);
                        if (adj.Count == 4)
                        {
                            nextState = new SurroundState(this.gs, this.isBombPassable);
                        }
                        else
                        {
                            Coords choke = this.chokepoints.findChokePoint(this.isBombPassable, this);
                            if (choke != null)
                            {
                                nextState = new CutOffChokePointState(this.gs, this.isBombPassable, choke);
                            }
                        }
                    }
                }
                else if (current is BlastWallState)
                {
                    if (current.fail(this) || current.complete(this))
                    {
                        nextState = new EvadeExplosionState(this.gs);
                    }
                }
                else if (current is CutOffChokePointState)
                {
                    //Coords choke = this.chokepoints.findChokePoint(this.isBombPassable, this);
                    //if ((choke == null) || current.fail(this)) {
                    if (current.fail(this))
                    {
                        nextState = new PursueState(this.gs, this.isBombPassable);
                    }
                    else if (current.complete(this))
                    {
                        nextState = new BombState(this.gs);
                    }
                }
                else if (current is BombState)
                {
                    if (current.fail(this) || current.complete(this))
                    {
                        nextState = new EvadeExplosionState(this.gs);
                    }
                }
                else if (current is EvadeExplosionState)
                {
                    if (current.fail(this) || current.complete(this))
                    {
                        Coords choke = this.chokepoints.findChokePoint(this.isBombPassable, this);
                        if (choke == null)
                        {
                            nextState = new PursueState(this.gs, this.isBombPassable);
                        }
                        else
                        {
                            nextState = new CutOffChokePointState(this.gs, this.isBombPassable, choke);
                        }
                    }
                }
                else if (current is SurroundState)
                {
                    if (current.fail(this))
                    {
                        nextState = new PursueState(this.gs, this.isBombPassable); //move to default state
                    }
                    else if (current.complete(this))
                    {
                        nextState = new BombState(this.gs);
                    }
                }

                if (nextState != null)
                {
                    Console.WriteLine("Agent " + this.agentId + " switching to " + nextState.GetType().ToString());
                    fsm.changeState(nextState);
                }
                move = fsm.getCurrentState().getAction(this);
                Console.WriteLine("Agent " + this.agentId + ", state " + fsm.getCurrentState().GetType().ToString() + ", move " + move);
                return move;
            }
Пример #36
0
        public void UpdateKeyboard()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            //update background
            if (Global.Configuration.bg_team_enabled)
            {
                if (this.current_team == PlayerTeam.T)
                {
                    SetAllKeys(Global.Configuration.t_color);
                    if (Global.Configuration.bg_peripheral_use)
                        SetOneKey(Devices.DeviceKeys.Peripheral, Global.Configuration.t_color);
                }
                else if (this.current_team == PlayerTeam.CT)
                {
                    SetAllKeys(Global.Configuration.ct_color);
                    if (Global.Configuration.bg_peripheral_use)
                        SetOneKey(Devices.DeviceKeys.Peripheral, Global.Configuration.ct_color);
                }
                else
                {
                    SetAllKeys(Global.Configuration.ambient_color);
                    if (Global.Configuration.bg_peripheral_use)
                        SetOneKey(Devices.DeviceKeys.Peripheral, Global.Configuration.ambient_color);
                }
            }
            else
            {
                SetAllKeys(Color.Black);
            }

            //Not initialized
            if (this.current_team != PlayerTeam.Undefined)
            {
                //Update Health
                if(Global.Configuration.health_enabled)
                    PercentEffect(Global.Configuration.healthy_color, Global.Configuration.hurt_color, Global.Configuration.healthKeys.ToArray(), (double)this.health, (double)this.health_max, Global.Configuration.health_effect_type);

                //Update Ammo
                if (Global.Configuration.ammo_enabled)
                    PercentEffect(Global.Configuration.ammo_color, Global.Configuration.noammo_color, Global.Configuration.ammoKeys.ToArray(), (double)this.clip, (double)this.clip_max, Global.Configuration.ammo_effect_type);


                //Update Bomb
                if (Global.Configuration.bomb_enabled)
                {
                    Devices.DeviceKeys[] _bombkeys = Global.Configuration.bombKeys.ToArray();

                    if (this.bombstate == BombState.Planted)
                    {
                        if (!bombtimer.IsRunning)
                        {
                            bombtimer.Restart();
                            bombflashcount = 0;
                            bombflashtime = 0;
                            bombflashedat = 0;
                        }

                        double bombflashamount = 1.0;
                        bool isCritical = false;


                        if (bombtimer.ElapsedMilliseconds < 38000)
                        {

                            if (bombtimer.ElapsedMilliseconds >= bombflashtime)
                            {
                                bombflash = true;
                                bombflashedat = bombtimer.ElapsedMilliseconds;
                                bombflashtime = bombtimer.ElapsedMilliseconds + (1000 - (bombflashcount++ * 13));
                                //Console.WriteLine("Next flash at: " + bombflashtime + ", deviation: " + (1000 - (bombflashcount * 13)));
                            }

                            bombflashamount = Math.Pow(Math.Sin((bombtimer.ElapsedMilliseconds - bombflashedat) / 80.0 + 0.25), 2.0);
                            //Console.WriteLine("Flash amount: " + bombflashamount);

                        }
                        else if (bombtimer.ElapsedMilliseconds >= 38000)
                        {
                            isCritical = true;
                            bombflashamount = (double)bombtimer.ElapsedMilliseconds / 40000.0;
                        }
                        else if (bombtimer.ElapsedMilliseconds >= 45000)
                        {
                            bombtimer.Stop();
                            this.bombstate = BombState.Undefined;
                        }

                        if (!isCritical)
                        {
                            if (bombflashamount <= 0.05 && bombflash)
                                bombflash = false;

                            if (!bombflash)
                                bombflashamount = 0.0;
                        }

                        if (!Global.Configuration.bomb_gradual)
                            bombflashamount = Math.Round(bombflashamount);

                        foreach (Devices.DeviceKeys key in _bombkeys)
                        {
                            if (isCritical)
                            {
                                Color bombcolor_critical = Color.FromArgb(
                                    (Int32)((Int32)Global.Configuration.bomb_primed_color.R * Math.Min(bombflashamount, 1.0)),
                                    (Int32)((Int32)Global.Configuration.bomb_primed_color.G * Math.Min(bombflashamount, 1.0)),
                                    (Int32)((Int32)Global.Configuration.bomb_primed_color.B * Math.Min(bombflashamount, 1.0))
                                    );

                                SetOneKey(key, bombcolor_critical);

                                if (Global.Configuration.bomb_peripheral_use)
                                {
                                    SetOneKey(Devices.DeviceKeys.Peripheral, bombcolor_critical);
                                }
                            }
                            else
                            {
                                Color bombcolor = Color.FromArgb(
                                    (Int32)((Int32)Global.Configuration.bomb_flash_color.R * Math.Min(bombflashamount, 1.0)),
                                    (Int32)((Int32)Global.Configuration.bomb_flash_color.G * Math.Min(bombflashamount, 1.0)),
                                    (Int32)((Int32)Global.Configuration.bomb_flash_color.B * Math.Min(bombflashamount, 1.0))
                                    );

                                SetOneKey(key, bombcolor);
                                if (Global.Configuration.bomb_peripheral_use)
                                {
                                    SetOneKey(Devices.DeviceKeys.Peripheral, bombcolor);
                                }
                            }
                        }
                    }
                    else if (this.bombstate == BombState.Defused)
                    {
                        bombtimer.Stop();
                        if (Global.Configuration.bomb_display_winner_color)
                        {
                            foreach (Devices.DeviceKeys key in _bombkeys)
                                SetOneKey(key, Global.Configuration.ct_color);

                            if (Global.Configuration.bomb_peripheral_use)
                                SetOneKey(Devices.DeviceKeys.Peripheral, Global.Configuration.ct_color);
                        }
                    }
                    else if (this.bombstate == BombState.Exploded)
                    {
                        bombtimer.Stop();
                        if (Global.Configuration.bomb_display_winner_color)
                        {
                            foreach (Devices.DeviceKeys key in _bombkeys)
                                SetOneKey(key, Global.Configuration.t_color);
                            if (Global.Configuration.bomb_peripheral_use)
                                SetOneKey(Devices.DeviceKeys.Peripheral, Global.Configuration.t_color);
                        }
                    }
                    else
                    {
                        bombtimer.Stop();
                    }
                }
            }

            //Restore Saved Keys
            if (Global.Configuration.statickeys_enabled)
            {
                Devices.DeviceKeys[] _statickeys = Global.Configuration.staticKeys.ToArray();
                foreach (Devices.DeviceKeys key in _statickeys)
                    SetOneKey(key, Global.Configuration.statickeys_color);
            }

            //Update Burning
            if (Global.Configuration.burning_enabled && burnamount > 0)
            {
                double burning_percent = (double)this.burnamount / 255.0;
                Color burncolor = Global.Configuration.burning_color;

                if (Global.Configuration.burning_animation)
                {
                    int green_adjusted = (int)(Global.Configuration.burning_color.G + (Math.Cos((animations_time.ElapsedMilliseconds + randomizer.Next(150)) / 75.0) * 0.15 * 255));
                    byte green = 0;

                    if(green_adjusted > 255)
                        green = 255;
                    else if(green_adjusted < 0)
                        green = 0;
                    else 
                        green = (byte)green_adjusted;

                    burncolor = Color.FromArgb(burncolor.R, green, burncolor.B);
                }

                SetAllKeysEffect(burncolor, burning_percent);

                if (Global.Configuration.burning_peripheral_use)
                    SetOneKey(Devices.DeviceKeys.Peripheral, BlendColors(GetOneKey(Devices.DeviceKeys.Peripheral), burncolor, burning_percent));
            }

            //Update Flashed
            if (Global.Configuration.flashbang_enabled && flashamount > 0)
            {
                double flash_percent = (double)this.flashamount / 255.0;
                SetAllKeysEffect(Global.Configuration.flash_color, flash_percent);

                if (Global.Configuration.flashbang_peripheral_use)
                    SetOneKey(Devices.DeviceKeys.Peripheral, BlendColors(GetOneKey(Devices.DeviceKeys.Peripheral), Global.Configuration.flash_color, flash_percent));
            }

            //Update Typing Keys
            if (Global.Configuration.typing_enabled && current_activity == PlayerActivity.TextInput)
            {
                Devices.DeviceKeys[] _typingkeys = Global.Configuration.typingKeys.ToArray();
                foreach (Devices.DeviceKeys key in _typingkeys)
                    SetOneKey(key, Global.Configuration.typing_color);
            }

            keyboard_updated = dev_manager.UpdateDevices(keyColors, this.isForced);
            this.isForced = false;

            final_keyColors = keyColors;

            stopwatch.Stop();
            //Console.WriteLine("Execution time: " + stopwatch.ElapsedMilliseconds);
        }
Пример #37
0
 public void SetBombState(BombState state)
 {
     this.bombstate = state;
 }
Пример #38
0
 public void PlaceBomb(int x, int y)
 {
     if (field[x][y] == ObjectType.SPACE)
     {
         field[x][y] = ObjectType.BOMB;
         bombPositions[new Point(x, y)] = new BombState();
         view.SetTile(x, y, SpriteType.BIGBOMB);
     }
 }
Пример #39
0
 public static void SetBombState(BombState state)
 {
     GameEvent_CSGO.bombstate = state;
 }
Пример #40
0
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            //update background
            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bg_team_enabled)
            {
                EffectLayer bg_layer = new EffectLayer("CSGO - Background");

                Color bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ambient_color;

                if (current_team == PlayerTeam.T)
                {
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).t_color;
                }
                else if (current_team == PlayerTeam.CT)
                {
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ct_color;
                }

                if (current_team != PlayerTeam.Undefined)
                {
                    if (dim_bg_at <= general_timer.ElapsedMilliseconds)
                    {
                        isDimming = true;
                        bg_color  = Utils.ColorUtils.MultiplyColorByScalar(bg_color, getDimmingValue());
                    }
                    else
                    {
                        isDimming = false;
                        dim_value = 1.0;
                    }
                }

                bg_layer.Fill(bg_color);

                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bg_peripheral_use)
                {
                    bg_layer.Set(Devices.DeviceKeys.Peripheral, bg_color);
                }
                layers.Enqueue(bg_layer);
            }

            //Not initialized
            if (current_team != PlayerTeam.Undefined)
            {
                //Update Health
                EffectLayer hpbar_layer = new EffectLayer("CSGO - HP Bar");
                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).health_enabled)
                {
                    hpbar_layer.PercentEffect((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).healthy_color,
                                              (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).hurt_color,
                                              (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).health_sequence,
                                              (double)health,
                                              (double)health_max,
                                              (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).health_effect_type);
                }

                layers.Enqueue(hpbar_layer);

                //Update Ammo
                EffectLayer ammobar_layer = new EffectLayer("CSGO - Ammo Bar");
                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ammo_enabled)
                {
                    ammobar_layer.PercentEffect((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ammo_color,
                                                (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).noammo_color,
                                                (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ammo_sequence,
                                                (double)clip,
                                                (double)clip_max,
                                                (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ammo_effect_type);
                }

                layers.Enqueue(ammobar_layer);


                //Update Bomb
                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_enabled)
                {
                    EffectLayer bomb_effect_layer = new EffectLayer("CSGO - Bomb Effect");

                    Devices.DeviceKeys[] _bombkeys = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_sequence.keys.ToArray();

                    if (bombstate == BombState.Planted)
                    {
                        if (!bombtimer.IsRunning)
                        {
                            bombtimer.Restart();
                            bombflashcount = 0;
                            bombflashtime  = 0;
                            bombflashedat  = 0;
                        }

                        double bombflashamount = 1.0;
                        bool   isCritical      = false;


                        if (bombtimer.ElapsedMilliseconds < 38000)
                        {
                            if (bombtimer.ElapsedMilliseconds >= bombflashtime)
                            {
                                bombflash     = true;
                                bombflashedat = bombtimer.ElapsedMilliseconds;
                                bombflashtime = bombtimer.ElapsedMilliseconds + (1000 - (bombflashcount++ *13));
                            }

                            bombflashamount = Math.Pow(Math.Sin((bombtimer.ElapsedMilliseconds - bombflashedat) / 80.0 + 0.25), 2.0);
                        }
                        else if (bombtimer.ElapsedMilliseconds >= 38000)
                        {
                            isCritical      = true;
                            bombflashamount = (double)bombtimer.ElapsedMilliseconds / 40000.0;
                        }
                        else if (bombtimer.ElapsedMilliseconds >= 45000)
                        {
                            bombtimer.Stop();
                            bombstate = BombState.Undefined;
                        }

                        if (!isCritical)
                        {
                            if (bombflashamount <= 0.05 && bombflash)
                            {
                                bombflash = false;
                            }

                            if (!bombflash)
                            {
                                bombflashamount = 0.0;
                            }
                        }

                        if (!(Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_gradual)
                        {
                            bombflashamount = Math.Round(bombflashamount);
                        }

                        foreach (Devices.DeviceKeys key in _bombkeys)
                        {
                            if (isCritical)
                            {
                                Color bombcolor_critical = Utils.ColorUtils.MultiplyColorByScalar((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_primed_color, Math.Min(bombflashamount, 1.0));

                                bomb_effect_layer.Set(key, bombcolor_critical);

                                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_peripheral_use)
                                {
                                    bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, bombcolor_critical);
                                }
                            }
                            else
                            {
                                Color bombcolor = Utils.ColorUtils.MultiplyColorByScalar((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_flash_color, Math.Min(bombflashamount, 1.0));

                                bomb_effect_layer.Set(key, bombcolor);
                                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_peripheral_use)
                                {
                                    bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, bombcolor);
                                }
                            }
                        }
                    }
                    else if (bombstate == BombState.Defused)
                    {
                        bombtimer.Stop();
                        if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_display_winner_color)
                        {
                            foreach (Devices.DeviceKeys key in _bombkeys)
                            {
                                bomb_effect_layer.Set(key, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ct_color);
                            }

                            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_peripheral_use)
                            {
                                bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ct_color);
                            }
                        }
                    }
                    else if (bombstate == BombState.Exploded)
                    {
                        bombtimer.Stop();
                        if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_display_winner_color)
                        {
                            foreach (Devices.DeviceKeys key in _bombkeys)
                            {
                                bomb_effect_layer.Set(key, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).t_color);
                            }
                            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_peripheral_use)
                            {
                                bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).t_color);
                            }
                        }
                    }
                    else
                    {
                        bombtimer.Stop();
                    }

                    layers.Enqueue(bomb_effect_layer);
                }
            }

            //Kills Indicator
            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).kills_indicator && isLocal)
            {
                EffectLayer          kills_indicator_layer = new EffectLayer("CSGO - Kills Indicator");
                Devices.DeviceKeys[] _killsKeys            = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).kills_sequence.keys.ToArray();
                for (int pos = 0; pos < _killsKeys.Length; pos++)
                {
                    if (pos < roundKills.Count)
                    {
                        switch (roundKills[pos])
                        {
                        case (RoundKillType.Regular):
                            kills_indicator_layer.Set(_killsKeys[pos], (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).kills_regular_color);
                            break;

                        case (RoundKillType.Headshot):
                            kills_indicator_layer.Set(_killsKeys[pos], (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).kills_headshot_color);
                            break;
                        }
                    }
                }
                layers.Enqueue(kills_indicator_layer);
            }

            //ColorZones
            EffectLayer cz_layer = new EffectLayer("CSGO - Color Zones");

            cz_layer.DrawColorZones((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).lighting_areas.ToArray());
            layers.Enqueue(cz_layer);

            //Update Burning

            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_enabled && burnamount > 0)
            {
                EffectLayer burning_layer   = new EffectLayer("CSGO - Burning");
                double      burning_percent = (double)burnamount / 255.0;
                Color       burncolor       = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_color;

                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_animation)
                {
                    int  red_adjusted = (int)((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_color.R + (Math.Cos((general_timer.ElapsedMilliseconds + randomizer.Next(75)) / 75.0) * 0.15 * 255));
                    byte red          = 0;

                    if (red_adjusted > 255)
                    {
                        red = 255;
                    }
                    else if (red_adjusted < 0)
                    {
                        red = 0;
                    }
                    else
                    {
                        red = (byte)red_adjusted;
                    }

                    int  green_adjusted = (int)((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_color.G + (Math.Sin((general_timer.ElapsedMilliseconds + randomizer.Next(150)) / 75.0) * 0.15 * 255));
                    byte green          = 0;

                    if (green_adjusted > 255)
                    {
                        green = 255;
                    }
                    else if (green_adjusted < 0)
                    {
                        green = 0;
                    }
                    else
                    {
                        green = (byte)green_adjusted;
                    }

                    int  blue_adjusted = (int)((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_color.B + (Math.Cos((general_timer.ElapsedMilliseconds + randomizer.Next(225)) / 75.0) * 0.15 * 255));
                    byte blue          = 0;

                    if (blue_adjusted > 255)
                    {
                        blue = 255;
                    }
                    else if (blue_adjusted < 0)
                    {
                        blue = 0;
                    }
                    else
                    {
                        blue = (byte)blue_adjusted;
                    }

                    burncolor = Color.FromArgb(burnamount, red, green, blue);
                }

                burning_layer.Fill(burncolor);

                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_peripheral_use)
                {
                    burning_layer.Set(Devices.DeviceKeys.Peripheral, burncolor);
                }
                layers.Enqueue(burning_layer);
            }

            //Update Flashed
            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).flashbang_enabled && flashamount > 0)
            {
                EffectLayer flashed_layer = new EffectLayer("CSGO - Flashed");
                double      flash_percent = (double)flashamount / 255.0;

                Color flash_color = Color.FromArgb(flashamount, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).flash_color);

                flashed_layer.Fill(flash_color);

                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).flashbang_peripheral_use)
                {
                    flashed_layer.Set(Devices.DeviceKeys.Peripheral, flash_color);
                }
                layers.Enqueue(flashed_layer);
            }

            //Update Typing Keys
            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).typing_enabled && current_activity == PlayerActivity.TextInput)
            {
                EffectLayer          typing_keys_layer = new EffectLayer("CSGO - Typing Keys");
                Devices.DeviceKeys[] _typingkeys       = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).typing_sequence.keys.ToArray();
                foreach (Devices.DeviceKeys key in _typingkeys)
                {
                    typing_keys_layer.Set(key, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).typing_color);
                }

                layers.Enqueue(typing_keys_layer);
            }


            if (general_timer.Elapsed.Seconds % this.updateRate == 0 && (general_timer.Elapsed.Seconds != this.lastUpdate))
            {
                this.lastUpdate = general_timer.Elapsed.Seconds;
            }

            //Scripts
            Global.Configuration.ApplicationProfiles[profilename].UpdateEffectScripts(layers, _game_state);

            frame.AddLayers(layers.ToArray());
        }