コード例 #1
0
ファイル: AbstractEntity.cs プロジェクト: cfo82/Magmageddon
        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);
        }
コード例 #2
0
 private void VelocityChanged(
     Vector3Attribute sender,
     Vector3 oldValue,
     Vector3 newValue
     )
 {
     ChangeVector3("Direction", newValue);
 }
コード例 #3
0
 private void PositionChanged(
     Vector3Attribute sender,
     Vector3 oldValue,
     Vector3 newValue
     )
 {
     ChangeVector3("Position", newValue);
 }
コード例 #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);
        }
コード例 #5
0
 private void ScaleChanged(
     Vector3Attribute sender,
     Vector3 oldValue,
     Vector3 newValue
     )
 {
     ChangeVector3("Scale", newValue);
 }
コード例 #6
0
        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);
        }
コード例 #7
0
 private void OnAttachedToPositionChanged(
     Vector3Attribute positionAttribute,
     Vector3 oldPosition,
     Vector3 newPosition
     )
 {
     PositionOnIsland(ref newPosition);
 }
コード例 #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());
        }
コード例 #9
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();
		}
コード例 #10
0
 private void OnIslandPositionChanged(Vector3Attribute sender,
                                      Vector3 oldValue, Vector3 newValue)
 {
     light.SetVector3(CommonNames.Position, newValue + positionOffset);
 }