Наследование: MonoBehaviour
Пример #1
0
 public PlayerAttackStats()
 {
     ComboAttacks = new PlayerAttackStats[0];
     Name         = "New Attack";
     attackInput  = AttackInputType.Light;
     impulses     = new Impulse[0];
 }
Пример #2
0
        /*
         * Set the docked status of the ship
         */
        public void SetDocked(bool docked)
        {
            if (!this.docked && docked)
            {
                this.energyLevel = 100;
                ComsChatter("Commander Scot reports reports, 'Docking is complete, Captain.'");
            }

            if (this.docked && !docked)
            {
                ComsChatter("Lt Sulu reports, 'We're clear for maneuvering, Captain.'");
            }

            DamageControl.Docked(docked);
            Impulse.Docked(docked);
            LRS.Docked(docked);
            Phasers.Docked(docked);
            Probes.Docked(docked);
            Shields.Docked(docked);
            SRS.Docked(docked);
            Torpedoes.Docked(docked);
            Warp.Docked(docked);

            this.docked = docked;
        }
Пример #3
0
        /// <summary>
        ///     Solves the velocity constraints using the specified step
        /// </summary>
        /// <param name="step">The step</param>
        internal override void SolveVelocityConstraints(TimeStep step)
        {
            Body b = Body2;

            Vec2 r = Math.Mul(b.GetXForm().R, LocalAnchor - b.GetLocalCenter());

            // Cdot = v + cross(w, r)
            Vec2 cdot    = b.LinearVelocity + Vec2.Cross(b.AngularVelocity, r);
            Vec2 impulse = Math.Mul(Mass, -(cdot + Beta * C + Gamma * Impulse));

            Vec2 oldImpulse = Impulse;

            Impulse += impulse;
            float maxImpulse = step.Dt * MaxForce;

            if (Impulse.LengthSquared() > maxImpulse * maxImpulse)
            {
                Impulse *= maxImpulse / Impulse.Length();
            }

            impulse = Impulse - oldImpulse;

            b.LinearVelocity  += b.InvMass * impulse;
            b.AngularVelocity += b.InvI * Vec2.Cross(r, impulse);
        }
Пример #4
0
        public override void Process(Impulse impulse)
        {
            //TODO: Perception has to chew up raw data and see what to do with it. Since it te      xt communication, it can only be words, so it should start with memory.
            if (impulse is Data)
            {
                if ((impulse as Data).Content.ToLowerInvariant().StartsWith("bye!"))
                {
                    impulse.Signal  = SignalType.Terminate;
                    impulse.Outcome = Outcome.Success;

                    Transmitter.SendSignal(impulse);

                    Stop();
                    return;
                }
                else
                {
                    impulse.Signal  = SignalType.Receive;
                    impulse.Outcome = Outcome.Success;
                }
            }

            Transmitter.SendSignal(impulse);
            System.Diagnostics.Trace.WriteLine(string.Format("{0};{1};{2}", Resources.Constants.Trace.Date, this.ToString(), impulse.Signal, impulse.Outcome));
        }
Пример #5
0
        public override void Process(Impulse impulse)
        {
            //TODO: Implement search on communication.
            // Logic may also ask for information directly instead of searching for it.
            Data result = null;

            if (impulse is Word)
            {
                var word = impulse as Word;
                result = new Data
                {
                    Content = $"{word.Type}|{word.Description}",
                    Outcome = Outcome.Success,
                    Signal  = SignalType.Transmit,
                };
            }
            else if (impulse is Data)
            {
                result = impulse as Data;
            }
            else
            {
                System.Diagnostics.Trace.WriteLine(string.Format("{0};{1};{2};{3}", Trace.Date, this.ToString(), SignalType.None, Outcome.Failure));
                return;
            }

            Transmitter.SendSignal(result);
            System.Diagnostics.Trace.WriteLine(string.Format("{0};{1};{2};{3}", Trace.Date, this.ToString(), impulse.Signal, impulse.Outcome));
        }
Пример #6
0
        private async Task <double[]> Correlate()
        {
            var result     = new double[Reference.SliceCount];
            var tenPercent = Reference.SliceCount / 10;

            for (int d = 0; d < Reference.SliceCount; d++)
            {
                if (d % tenPercent == 0)
                {
                    Status = $"Calculating, {100 * d / Reference.Samples.Length}% done...";
                }

                double r = 0;

                for (int i = 0; i < Impulse.SliceCount; i++)
                {
                    if (Reference.SliceCount <= i + d)
                    {
                        continue;
                    }

                    r += Math.Pow(EuclideanDistance(Reference.SliceAt(d + i), Impulse.SliceAt(i)), 2);
                }

                result[d] = -Math.Sqrt(r / Impulse.SliceCount);
            }

/*            var min = result.Min();
 *          var max = result.Max();
 *
 *          for (int i = 0; i < result.Length; i++)
 *              result[i] = (result[i] - min) / (max - min);*/

            return(result);
        }
Пример #7
0
 public override void SendSignal(Impulse impulse)
 {
     if (impulse != null)
     {
         impulse.Node = Node.Perception;
         Parallel.ForEach(Pool.Internal.Receivers.Instance.List, receiver => receiver.ReceiveSignal(impulse));
     }
 }
Пример #8
0
        private Impulse GetImpulseAnswer()
        {
            var     ran            = new Random();
            var     value          = Enum.GetValues(typeof(Impulse));
            Impulse randomCategory = (Impulse)value.GetValue(ran.Next(0, value.Length));

            return(randomCategory);
        }
Пример #9
0
 public void SetUp()
 {
     _figure = new Figure()
     {
         Data = new DataPoints(x: _x, y: _y)
     };
     _scatter2D = new Scatter()
     {
         Data = new DataPoints(x: _x, y: _y)
     };
     _scatter3D = new Scatter()
     {
         Data = new DataPoints(x: _x, y: _y, z: _z)
     };
     _line2D = new Line()
     {
         Data = new DataPoints(x: _x, y: _y)
     };
     _filledCurves = new FilledCurves()
     {
         Data = new DataPoints(x: _x, y: _y, z: _z)
     };
     _linePoints2D = new LinePoints()
     {
         Data = new DataPoints(x: _x, y: _y)
     };
     _yError = new YError()
     {
         Data = new DataPoints(x: _x, y: _y, z: _z)
     };
     _line3D = new Line()
     {
         Data = new DataPoints(x: _x, y: _y, z: _z)
     };
     _linePoints3D = new LinePoints()
     {
         Data = new DataPoints(x: _x, y: _y, z: _z)
     };
     _impulse  = new Impulse();
     _function = new Function()
     {
         Properties = { Function = _f }
     };
     _bars = new Bars();
     Normal.Samples(_array, mean: 0, stddev: 1);
     _histogram = new Histogram()
     {
         Data = new DataPoints(x: _array)
     };
     _boxplot = new Boxplot()
     {
         Data = new DataPoints(x: _array)
     };
     _vector = new Vector()
     {
         Data = new DataPoints(x1: _x, x2: _y, y1: _z, y2: _z)
     };
 }
Пример #10
0
        private void MakeCurrent()
        {
            Vector3 oldAngles = _viewAngles;

            if (this.Inhibited == false)
            {
                // update toggled key states
                // TODO: toggled

                /*toggled_crouch.SetKeyState( ButtonState( UB_DOWN ), in_toggleCrouch.GetBool() );
                 * toggled_run.SetKeyState( ButtonState( UB_SPEED ), in_toggleRun.GetBool() && idAsyncNetwork::IsActive() );
                 * toggled_zoom.SetKeyState( ButtonState( UB_ZOOM ), in_toggleZoom.GetBool() );*/

                // TODO: keyboard gen
                // keyboard angle adjustment

                /*AdjustAngles();
                 *
                 * // set button bits
                 * CmdButtons();
                 *
                 * // get basic movement from keyboard
                 * KeyMove();*/

                // get basic movement from mouse
                // TODO: MouseMove();

                // get basic movement from joystick

                /*JoystickMove();
                 *
                 * // check to make sure the angles haven't wrapped
                 * if ( viewangles[PITCH] - oldAngles[PITCH] > 90 ) {
                 *      viewangles[PITCH] = oldAngles[PITCH] + 90;
                 * } else if ( oldAngles[PITCH] - viewangles[PITCH] > 90 ) {
                 *      viewangles[PITCH] = oldAngles[PITCH] - 90;
                 * } */
            }
            else
            {
                _mouseDeltaX = 0;
                _mouseDeltaY = 0;
            }

            // TODO: input

            /*for ( i = 0; i < 3; i++ ) {
             *      cmd.angles[i] = ANGLE2SHORT( viewangles[i] );
             * }*/

            _currentCommand.MouseX = (short)_mouseX;
            _currentCommand.MouseY = (short)_mouseY;

            _flags   = _currentCommand.Flags;
            _impulse = _currentCommand.Impulse;
        }
Пример #11
0
 public void UpdateSimulation()
 {
     if (m_Impulse == null)
     {
         DoNormalMotion();
     }
     else
     {
         ApplyImpulse();
         m_Impulse = null;
     }
 }
Пример #12
0
        public override void Run()
        {
            System.Diagnostics.Trace.WriteLine(string.Format("{0};{1};{2}", Resources.Constants.Trace.Date, this.ToString(), NodeStatus.Start));

            do
            {
                Impulse impulse = Receiver.ReceiveSignal();
                Process(impulse);
            } while (IsActive);

            System.Diagnostics.Trace.WriteLine(string.Format("{0};{1};{2}", Resources.Constants.Trace.Date, this.ToString(), NodeStatus.Stop));
        }
Пример #13
0
    /// <summary>
    /// Funcion para la creacion de los enemigos
    /// Se le asignan las diferentes caracteristicas
    /// </summary>
    public void createEnemy()
    {
        rb      = GetComponent <Rigidbody>();
        impulse = transform.GetChild(0).GetComponent <Impulse>();
        transform.localScale     = new Vector3(chromosomes[0], chromosomes[1], chromosomes[2]);
        rb.velocity              = new Vector3(chromosomes[3], 0, chromosomes[4]);
        direccion                = rb.velocity;
        impulse.impulse          = chromosomes[5];
        impulse.impulseFrequence = chromosomes[6];

        //tiempoNacimiento = Time.timeSinceLevelLoad;
    }
Пример #14
0
        private void SendImpulse()
        {
            (float minRate, float maxRate) = _spawnRate.CurrentRange;
            _timer.StartOff(Random.Range(minRate, maxRate), SendImpulse);

            (float minTime, float maxTime) = _residenceTime.CurrentRange;
            Impulse?.Invoke(Random.Range(minTime, maxTime));

            if (++_currentImpulse == _acceleratingImpulse)
            {
                Accelerate();
            }
        }
Пример #15
0
        public override void SendSignal(Impulse impulse)
        {
            List <string> dataList = null;

            if (impulse is Data)
            {
                dataList = (impulse as Data).Content.Split('|').ToList();
            }

            if (dataList != null)
            {
                dataList.ForEach(d => System.Console.WriteLine(d));
            }
        }
Пример #16
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="MouseJoint" /> class
        /// </summary>
        /// <param name="def">The def</param>
        public MouseJoint(MouseJointDef def)
            : base(def)
        {
            Target      = def.Target;
            LocalAnchor = Math.MulT(Body2.GetXForm(), Target);

            MaxForce = def.MaxForce;
            Impulse.SetZero();

            FrequencyHz  = def.FrequencyHz;
            DampingRatio = def.DampingRatio;

            Beta  = 0.0f;
            Gamma = 0.0f;
        }
Пример #17
0
        public void InitForNewMap()
        {
            _flags   = 0;
            _impulse = 0;

            // TODO

            /*toggled_crouch.Clear();
             * toggled_run.Clear();
             * toggled_zoom.Clear();
             * toggled_run.on = in_alwaysRun.GetBool();*/

            Clear();
            // TODO: ClearAngles();
        }
Пример #18
0
 void DisplayImpulse(string label, Impulse impulse)
 {
     GUILayout.BeginVertical();
     GUILayout.Box(label, GUILayout.Width(500));
     GUILayout.Space(20);
     LabelInfo("impulseValue: ", impulse.impulseValue.ToString("000.00"));
     LabelInfo("velocity: ", impulse.velocity.ToString("000.00"));
     GUILayout.Space(20);
     LabelInfo("acceleration: ", impulse.acceleration.ToString("000.00"));
     LabelInfo("deceleration: ", impulse.deceleration.ToString("000.00"));
     LabelInfo("min: ", impulse.min.ToString("000.00"));
     LabelInfo("max: ", impulse.max.ToString("000.00"));
     GUILayout.EndVertical();
     GUILayout.Space(50);
 }
Пример #19
0
    public override bool InitMagicalObject(GameObject Weapon, GameObject Direction)
    {
        CharacterStatus Charstats = Weapon.GetComponentInParent <CharacterStatus>();

        CasterName = Charstats.gameObject.name;
        if (Charstats.CurrentMana >= Cost)
        {
            GameObject Flames = Instantiate(SpellPrefab);
            Flames.transform.position = Charstats.gameObject.transform.position + (new Vector3(0, .5f, 0));
            Impulse impulseWave = Flames.GetComponent <Impulse>();
            impulseWave.wave  = ImpulseDamage;
            Charstats.CurMana = -Cost;
            return(true);
        }
        return(false);
    }
Пример #20
0
        /*
         * Check for end of game conditions
         * and make sure we only process one
         * end game condition
         *
         */
        private void endGameCheck()
        {
            Debug("Endgame check");
            int endGameAction = 0;

            if (GameBoard.getKlingonCount() < 1)
            {
                Debug("YOU WON!");
                endGameAction = (GameEnd.ForTheWin() ? 1 : 2);
            }
            else if (GameBoard.TimeLeft() <= 0.0)
            {
                Debug("Out of Time");
                endGameAction = (GameEnd.OutOfTime() ? 1 : 2);
            }
            else if (this.energyLevel < .1)
            {
                Debug("Out of Energy");
                endGameAction = (GameEnd.OutOfEnergy() ? 1 : 2);
            }
            else if (this.alertLevel == REDALERT &&
                     (!(Impulse.IsHealthy() || Warp.IsHealthy() || Phasers.IsHealthy() ||
                        (Torpedoes.IsHealthy() && Torpedoes.getCurrentCount() > 0))))
            {
                Debug("No longer able to fight");
                endGameAction = (GameEnd.Destroyed() ? 1 : 2);
            }

            // take end game action if > 0
            switch (endGameAction)
            {
            case 1:
                Debug("Starting new game");
                // TODO - add 16 grid support.  If I decide to add multiplayer
                // player support (not likely) then I'll also add 24 & 32 grid sizes
                NewGame(8);
                break;

            case 2:
                Debug("Normal exit to game");
                System.Windows.Forms.Application.ExitThread();
                this.Close();
                break;
            }
        }
Пример #21
0
        /// <summary>
        /// Method that will receive raw signal
        /// </summary>
        /// <returns></returns>
        public override void ReceiveSignal(Impulse impulse)
        {
            if (impulse == null)
            {
                return;
            }

            if (impulse.Signal == SignalType.Terminate)
            {
                Processor.DataPool.CompleteAdding();
                return;
            }

            if (impulse.Node == Node.Logic && impulse.Signal == SignalType.Search)
            {
                Processor.DataPool?.Add(impulse);
            }
        }
Пример #22
0
        /// <summary>
        /// Method that will receive raw signal
        /// </summary>
        /// <returns></returns>
        public override void ReceiveSignal(Impulse impulse)
        {
            if (impulse == null)
            {
                return;
            }

            if (impulse.Signal == SignalType.Terminate)
            {
                Processor.DataPool.CompleteAdding();
                return;
            }

            if (impulse.Node == Node.Memory || impulse.Node == Node.Information || (impulse.Node == Node.Logic && impulse.Signal != SignalType.Search && impulse.Signal != SignalType.Transmit))
            {
                Processor.DataPool?.Add(impulse);
            }
        }
Пример #23
0
        public override void Process(Impulse impulse)
        {
            Impulse result = null;

            if (impulse is Data)
            {
                //TODO: new to chew up the data before i decide what to do with it.
                //  i will only check for a definition if that is what the query requests.
                Data       query      = impulse as Data;
                Parameters parameters = ParameterGenerator.GenerateParameters(query.Content, "/api/v1/entries/en/");
                Definition definition = Collector.GatherData <Definition>(parameters).Result as Definition;

                if (definition != null)
                {
                    result = Map.DefinitionToWord(definition);

                    if (result != null)
                    {
                        result.Outcome = Outcome.Success;
                        result.Signal  = SignalType.Response;
                    }
                    else
                    {
                        Trace.WriteLine($"{Resources.Constants.Trace.Date};{this.ToString()};{SignalType.None};{Outcome.Failure}");
                    }
                }
                else
                {
                    result = new Data
                    {
                        Content = "",
                        Outcome = Outcome.Failure,
                        Signal  = SignalType.Response,
                    };
                }

                if (result != null)
                {
                    Transmitter.SendSignal(result);
                    Trace.WriteLine(string.Format("{0};{1};{2}", Resources.Constants.Trace.Date, this.ToString(), result.Signal));
                }
            }
        }
Пример #24
0
    public IEnumerator WaitForImpulse(int u, Vector3 accMove)
    {
        Impulse imp = impulses [u];

        while (imp.impLeft != Vector3.zero)
        {
            if (impulses.ContainsKey(u))
            {
                yield return(new WaitForEndOfFrame());
            }
            else
            {
                break;
            }
        }
        if (impulses.ContainsKey(u))
        {
            impulseCorrection += accMove - impulses [u].accMove;
            impulses.Remove(u);
        }
    }
Пример #25
0
    public void DoSplit(MyRigidbody toSplit, Impulse impulse)
    {
        Debug.Log("Splitting");

        var above = m_Pool.GetBody();
        var below = m_Pool.GetBody();

        toSplit.Shape.Split(impulse.WorldCollisionPoint, impulse.WorldImpulse.normalized, above.Shape, below.Shape);

        above.Init(toSplit);
        below.Init(toSplit);

        above.SetImpulse(impulse);
        below.SetImpulse(impulse);

        m_ToRemove.Add(toSplit);
        m_ToAdd.Add(above);
        m_ToAdd.Add(below);

        m_Pool.Return(toSplit);
    }
Пример #26
0
        /*
         * Routine to set everything up for a new game
         */
        public void NewGame(int gridSize)
        {
            WriteToLog.write("---- Game Start ----");

            // initialize the other classes
            GameBoard.NewGame(gridSize);
            GameMap.NewGame();
            SRS.NewGame();
            LRS.NewGame();
            Warp.NewGame();
            Torpedoes.NewGame();
            Phasers.NewGame();
            Shields.NewGame();
            Impulse.NewGame();
            DamageControl.NewGame();
            StarBases.NewGame();
            Probes.NewGame();

            ComsClear();

            // Register starbases
            for (int i = 0; i < GameBoard.GetSize() * GameBoard.GetSize(); i++)
            {
                if (GameBoard.GetGameBoard(i) > 99)
                {
                    // Register this starbase
                    StarBases.AddStarbase(i);
                    WriteToLog.write("Added starbase to loc " + i.ToString());
                }
            }

            // locate the enterprise and play the game
            GameBoard.RandomEnterpriseLocation();
            WriteToLog.write("Enteprise is in sector " + GameBoard.GetLocation());

            SRS.Execute();
            SetCondition();
        }
Пример #27
0
        public virtual void Run()
        {
            System.Diagnostics.Trace.WriteLine(string.Format("{0};{1};{2}", Constants.Trace.Date, this.ToString(), NodeStatus.Start));

            while (!DataPool.IsCompleted)
            {
                try
                {
                    Impulse newStimulus = DataPool.Take();
                    Process(newStimulus);
                }
                catch (Exception ex)
                {
                    // exception is thrown when the IsCompleted signal is sent
                    // TODO: Find a better way to terminate the processor
                    Trace.WriteLine($"{Constants.Trace.Date};{this.ToString()};{ex}");
                }
            }

            Stop();

            Trace.WriteLine(string.Format("{0};{1};{2}", Constants.Trace.Date, this.ToString(), NodeStatus.Stop));
        }
Пример #28
0
    void Hit(Collision2D col)
    {
        col.gameObject.GetComponent <Rigidbody2D>().isKinematic = false;

        Instantiate(Particles, new Vector3(col.contacts[0].point.x, col.contacts[0].point.y, -597), transform.rotation);
        Instantiate(ParticlesTEST, new Vector3(col.contacts[0].point.x, col.contacts[0].point.y, -598), transform.rotation);
        Instantiate(ParticlesTEST2, new Vector3(col.contacts[0].point.x, col.contacts[0].point.y, -599), transform.rotation);

        if (Light != null)
        {
            Instantiate(Light, new Vector3(transform.position.x, transform.position.y, transform.position.z - 20), transform.rotation);
        }


        if (ExplosionImpulse && col.transform.parent != null)
        {
            for (int i = 0; i < col.transform.parent.childCount; i++)
            {
                Impulse impulse = col.transform.parent.GetChild(i).GetComponent <Impulse>();

                if (impulse != null)
                {
                    impulse.ImpulsePowerMin *= ImpulseCoif;
                    impulse.ImpulsePowerMax *= ImpulseCoif;
                    impulse.IsCollision      = true;
                }
            }
        }

        Destroy(gameObject);
        Destroy(col.gameObject, 0.1f);

        if (IsExplosionDebris)
        {
            ExplosionDebris(col);
        }
    }
Пример #29
0
        public void SublightControls()
        {
            int distance;
            int direction;

            if (this.Movement.InvalidCourseCheck(out direction))
            {
                return;
            }

            if (this.Impulse.InvalidSublightFactorCheck(this.MaxWarpFactor, out distance))
            {
                return;
            }

            int lastRegionY;
            int lastRegionX;

            if (!Impulse.Engage(direction, distance, out lastRegionY, out lastRegionX, this.Game.Map))
            {
                return;
            }

            this.RepairOrTakeDamage(lastRegionX, lastRegionY);

            var crs = CombinedRangeScan.For(this.ShipConnectedTo);

            if (crs.Damaged())
            {
                ShortRangeScan.For(this.ShipConnectedTo).Controls();
            }
            else
            {
                crs.Controls();
            }
        }
Пример #30
0
        public override void Process(Impulse impulse)
        {
            Impulse response = null;

            switch (impulse.Signal)
            {
            case SignalType.Receive:
                // Information is being received from perception. Lets see if I know what it means.
                if (impulse is Data)
                {
                    var         query  = impulse as Data;
                    Entity.Word dbWord = null;
                    try
                    {
                        dbWord = RepositoryManager.Language.GetWordByName(query.Content).FirstOrDefault();
                    }
                    catch (Exception ex)
                    {
                        Trace.WriteLine(string.Format($"{Resources.Constants.Trace.Date},{this.ToString()};{Resources.Constants.Trace.GetWord};{NodeStatus.Exception};{ex.Message}"));
                    }
                    if (dbWord != null)
                    {
                        // I know what it means.
                        response         = Map.EntityToSignal(dbWord);
                        response.Signal  = SignalType.Response;
                        response.Outcome = Outcome.Success;
                    }
                    else
                    {
                        // Don't know what it means.
                        response         = new Data(impulse as Data);
                        response.Signal  = SignalType.Response;
                        response.Outcome = Outcome.Failure;
                    }
                }
                break;

            case SignalType.Request:
                //TODO: Logic requests a word from memory.
                break;

            case SignalType.Response:
                // A response is coming from logic. Lets memorize it.
                if (impulse.Outcome == Outcome.Success)
                {
                    if (impulse is Word)
                    {
                        Entity.Word dbWord = Map.SignalToEntity(impulse as Word);

                        if (dbWord == null)
                        {
                            Trace.WriteLine($"{Resources.Constants.Trace.Date};{this.ToString()};{Resources.Constants.Trace.AddWord};{Outcome.Failure.ToString()};{Resources.Constants.Trace.NoWordType}");
                        }
                        else
                        {
                            int wordId = RepositoryManager.Language.AddWord(dbWord);
                            if (wordId == 0)
                            {
                                Trace.WriteLine(string.Format("{0};{1};{2};{3};{4}", Resources.Constants.Trace.Date, this.ToString(), Resources.Constants.Trace.AddWord, Outcome.Failure.ToString(), wordId));
                            }
                            else
                            {
                                Trace.WriteLine(string.Format("{0};{1};{2};{3};{4}", Resources.Constants.Trace.Date, this.ToString(), Resources.Constants.Trace.AddWord, Outcome.Success.ToString(), wordId));
                            }
                        }
                    }
                }
                break;

            default:
                System.Diagnostics.Trace.WriteLine(string.Format("{0};{1};{2}", Resources.Constants.Trace.Date, this.ToString(), Resources.Constants.Trace.Default));
                return;
            }

            if (response != null)
            {
                Transmitter.SendSignal(response);
                System.Diagnostics.Trace.WriteLine(string.Format("{0};{1};{2}", Resources.Constants.Trace.Date, this.ToString(), response.Signal));
            }
        }
Пример #31
0
 /// <summary>
 /// Removes an object from the manager
 /// </summary>
 /// <param name="obj">The object to remove</param>
 public static void Remove(Impulse.Base.xObject obj)
 {
     m_xObjects.Remove(obj);
 }
Пример #32
0
 /// <summary>
 /// Adds a created object into the ArrayList
 /// </summary>
 /// <param name="obj">The object to add</param>
 public static void Add(Impulse.Base.xObject obj)
 {
     m_xObjects.Add(obj);
 }
		private void MakeCurrent()
		{
			Vector3 oldAngles = _viewAngles;

			if(this.Inhibited == false)
			{
				// update toggled key states
				// TODO: toggled
				/*toggled_crouch.SetKeyState( ButtonState( UB_DOWN ), in_toggleCrouch.GetBool() );
				toggled_run.SetKeyState( ButtonState( UB_SPEED ), in_toggleRun.GetBool() && idAsyncNetwork::IsActive() );
				toggled_zoom.SetKeyState( ButtonState( UB_ZOOM ), in_toggleZoom.GetBool() );*/

				// TODO: keyboard gen
				// keyboard angle adjustment
				/*AdjustAngles();

				// set button bits
				CmdButtons();

				// get basic movement from keyboard
				KeyMove();*/

				// get basic movement from mouse
				// TODO: MouseMove();

				// get basic movement from joystick
				/*JoystickMove();

				// check to make sure the angles haven't wrapped
				if ( viewangles[PITCH] - oldAngles[PITCH] > 90 ) {
					viewangles[PITCH] = oldAngles[PITCH] + 90;
				} else if ( oldAngles[PITCH] - viewangles[PITCH] > 90 ) {
					viewangles[PITCH] = oldAngles[PITCH] - 90;
				} */
			}
			else
			{
				_mouseDeltaX = 0;
				_mouseDeltaY = 0;
			}

			// TODO: input
			/*for ( i = 0; i < 3; i++ ) {
				cmd.angles[i] = ANGLE2SHORT( viewangles[i] );
			}*/

			_currentCommand.MouseX = (short) _mouseX;
			_currentCommand.MouseY = (short) _mouseY;

			_flags = _currentCommand.Flags;
			_impulse = _currentCommand.Impulse;
		}
		public void InitForNewMap()
		{
			_flags = 0;
			_impulse = 0;

			// TODO
			/*toggled_crouch.Clear();
			toggled_run.Clear();
			toggled_zoom.Clear();
			toggled_run.on = in_alwaysRun.GetBool();*/

			Clear();
			// TODO: ClearAngles();
		}
Пример #35
0
 public void SetActiveCamera(Impulse.Scene.xCamera c)
 {
     D3DDevice.Transform.Projection = c.matProjection;
     if(c.Type == Impulse.Scene.CameraType.THREEDIMENSIONAL)
     {
         D3DDevice.Transform.View = c.matView;
     }
 }
Пример #36
0
 /// <summary>
 /// This removes an object from the manager
 /// </summary>
 /// <param name="actor">The object to remove</param>
 public void Remove(Impulse.Base.xSceneNode node)
 {
     m_xObjects.Remove(node);
 }
Пример #37
0
 /// <summary>
 /// This adds a LinkedList of objects
 /// </summary>
 /// <param name="actorList">The list of objects</param>
 public void Add(Impulse.Base.xSceneNode[] nodes)
 {
     foreach(Impulse.Base.xSceneNode node in nodes)
     {
         Add(node);
     }
 }
Пример #38
0
 /// <summary>
 /// This adds an object to the manager
 /// </summary>
 /// <param name="actor">The object to add</param>
 public void Add(Impulse.Base.xSceneNode node)
 {
     m_xObjects.Add(node);
 }
Пример #39
0
        /// <summary>
        /// Fades the composite form (i.e., the frame window and the main form) 
        /// in or out
        /// </summary>
        /// <param name="duration">
        /// Fade duration milliseconds
        /// </param>
        /// <param name="ft">
        /// Fade in or out
        /// </param>
        /// <param name="frameWinOnly">
        /// True if fade the frame window only
        /// </param>
        /// <param name="startSteep">
        /// <para>
        /// True if fading starts with steep ramp and ends flat 
        /// </para>
        /// <para>
        /// False if fading starts flat and ends steep
        /// </para>
        /// </param>
        /// <remarks>
        /// NOTE: If fading out and <paramref name="frameWinOnly"/> is true, the main form's <c>Visible</c>
        /// property will be false on exit.
        /// </remarks>
        public void Fade(FadeType ft, bool startSteep, bool frameWinOnly, int duration)
        {
            if (m_alphaBitmap != null && m_lwin != null)
            {
            m_fading = true;
            if (ft == FadeType.FadeIn && !frameWinOnly)
              {
              SetFormOpacity(ParentForm, 0);
              ParentForm.Update();
              }

            if (ft == FadeType.FadeOut && frameWinOnly)
              {
                // We get faster background updating by setting visibility
                // as opposed to opacity
                ParentForm.Visible = false;
              ParentForm.Update();
            }

            Impulse imp = new Impulse(8.0);
            int op = 0;
            int uop = 0;
            // 30 fps is a reasonable median starting value (it will
            // be adjusted, on-the-fly, up or down to give
            // the greatest frame rate for the requested duration)
            int frames = Math.Max((30 * duration)/1000,1);
            int inc = Math.Max(255/frames,1);
            int frameDur = duration/frames;

            while (uop != 255)
            {
              if (startSteep)
            uop = (int)Math.Round(imp.Evaluate(op / 255.0) * 255.0);
              else
            uop = 255 - (int)Math.Round(imp.Evaluate(1.0 - op / 255.0) * 255.0);

              if (uop > 255)
            uop = 255;

              DateTime sf = DateTime.Now;

              // If fading in, we want the layered window to lead
              // If fading out, want the main form to lead (to reduce revealing of
              // the stair-stepped region boundary).
              for (int i = 0; i < 2; i++)
            {
            if (((ft == FadeType.FadeIn ? 0 : 1) ^ i) == 0)
              m_lwin.SetBits(m_alphaBitmap, (byte)(ft == FadeType.FadeIn ? uop : 255 - uop));
            else if (!frameWinOnly)
              SetFormOpacity(ParentForm, (byte)(ft == FadeType.FadeIn ? uop : 255 - uop));
            }

              TimeSpan ts = DateTime.Now - sf;
              int wait = frameDur - ts.Milliseconds;

              // We either wait or speed up to maintain requested duration
              if (wait > 0)
              {
            System.Threading.Thread.Sleep(wait);
            if (wait <= frameDur/2 && inc > 1)
            {
              inc = Math.Max(1,inc/2);
              frameDur /= 2;
            }
              }
              else if (Math.Abs(wait) >= frameDur)
              {
            inc *= 2;
            frameDur *= 2;
              }

              op += inc;
            }

              // Keep the Opacity property in sync as we bypass it above.
              ParentForm.Opacity = ft == FadeType.FadeIn ? 1.0 : 0.0;

            m_fading = false;
            }
        }