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); }
private void VelocityChanged( Vector3Attribute sender, Vector3 oldValue, Vector3 newValue ) { ChangeVector3("Direction", newValue); }
private void PositionChanged( Vector3Attribute sender, Vector3 oldValue, Vector3 newValue ) { ChangeVector3("Position", newValue); }
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); }
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); }
private void OnAttachedToPositionChanged( Vector3Attribute positionAttribute, Vector3 oldPosition, Vector3 newPosition ) { PositionOnIsland(ref newPosition); }
/// <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); }