Exemplo n.º 1
0
        public void AddAttribute(string name, AttributeTypes type, string value)
        {
            Attribute attribute = null;

            switch (type)
            {
            case AttributeTypes.String: attribute = new StringAttribute(name); break;

            case AttributeTypes.Int: attribute = new IntAttribute(name); break;

            case AttributeTypes.Float: attribute = new FloatAttribute(name); break;

            case AttributeTypes.Vector2: attribute = new Vector2Attribute(name); break;

            case AttributeTypes.Vector3: attribute = new Vector3Attribute(name); break;

            case AttributeTypes.Quaternion: attribute = new QuaternionAttribute(name); break;

            case AttributeTypes.Matrix: attribute = new MatrixAttribute(name); break;

            case AttributeTypes.Bool: attribute = new BoolAttribute(name); break;

            default: throw new System.Exception("AttributeType '" + type + "' does not exist!");
            }
            attribute.Initialize(value);
            AddAttribute(attribute);
        }
Exemplo n.º 2
0
 private void VelocityChanged(
     Vector3Attribute sender,
     Vector3 oldValue,
     Vector3 newValue
     )
 {
     ChangeVector3("Direction", newValue);
 }
Exemplo n.º 3
0
 private void PositionChanged(
     Vector3Attribute sender,
     Vector3 oldValue,
     Vector3 newValue
     )
 {
     ChangeVector3("Position", newValue);
 }
Exemplo n.º 4
0
        private void IslandPositionHandler(Vector3Attribute sender, Vector3 oldValue, Vector3 newValue)
        {
//            Debug.WriteLine("@"+this.GetType()+","+Game.Instance.Simulation.Time.At+": position of " + player.Name + " changed to " + newValue);
            Vector3 delta = newValue - oldValue;

            player.SetVector3(CommonNames.PreviousPosition, player.GetVector3(CommonNames.PreviousPosition) + delta);
            player.SetVector3(CommonNames.Position, player.GetVector3(CommonNames.Position) + delta);
        }
Exemplo n.º 5
0
 private void ScaleChanged(
     Vector3Attribute sender,
     Vector3 oldValue,
     Vector3 newValue
     )
 {
     ChangeVector3("Scale", newValue);
 }
        private void PlayerPositionHandler(Vector3Attribute sender, Vector3 oldValue, Vector3 newValue)
        {
            Vector3 position = flame.GetVector3(CommonNames.Position);
            Vector3 delta    = newValue - oldValue;

            position += delta;
            flame.SetVector3(CommonNames.Position, position);
        }
Exemplo n.º 7
0
 private void OnAttachedToPositionChanged(
     Vector3Attribute positionAttribute,
     Vector3 oldPosition,
     Vector3 newPosition
     )
 {
     PositionOnIsland(ref newPosition);
 }
Exemplo n.º 8
0
        /// <summary>
        ///     Call this method before the object goes out of scope to ensure
        ///     any Object resources are destroyed.
        /// </summary>
        public override object Destroy()
        {
            m_ConstValueA = Destroy(m_ConstValueA);
            m_ConstValueB = Destroy(m_ConstValueB);

            m_CurvesA = Destroy(m_CurvesA);
            m_CurvesB = Destroy(m_CurvesB);

            return(base.Destroy());
        }
		/// <summary>
		/// 	Call this method before the object goes out of scope to ensure
		/// 	any Object resources are destroyed.
		/// </summary>
		public override object Destroy()
		{
			m_ConstValueA = Destroy(m_ConstValueA);
			m_ConstValueB = Destroy(m_ConstValueB);

			m_CurvesA = Destroy(m_CurvesA);
			m_CurvesB = Destroy(m_CurvesB);

			return base.Destroy();
		}
 private void OnIslandPositionChanged(Vector3Attribute sender,
                                      Vector3 oldValue, Vector3 newValue)
 {
     light.SetVector3(CommonNames.Position, newValue + positionOffset);
 }