Beispiel #1
0
        public Entity AddVector2(UnityEngine.Vector2 newVector2)
        {
            var component = new Vector2Component();

            component.vector2 = newVector2;
            return(AddVector2(component));
        }
 public Entity ReplaceVector2(UnityEngine.Vector2 newVector2)
 {
     Vector2Component component;
     if (hasVector2) {
         WillRemoveComponent(ComponentIds.Vector2);
         component = vector2;
     } else {
         component = new Vector2Component();
     }
     component.vector2 = newVector2;
     return ReplaceComponent(ComponentIds.Vector2, component);
 }
Beispiel #3
0
        public Entity ReplaceVector2(UnityEngine.Vector2 newVector2)
        {
            Vector2Component component;

            if (hasVector2)
            {
                WillRemoveComponent(ComponentIds.Vector2);
                component = vector2;
            }
            else
            {
                component = new Vector2Component();
            }
            component.vector2 = newVector2;
            return(ReplaceComponent(ComponentIds.Vector2, component));
        }
Beispiel #4
0
 public static float Get(this Vector2 vec, Vector2Component component) => component switch
 {
Beispiel #5
0
 public Entity AddVector2(Vector2Component component)
 {
     return(AddComponent(ComponentIds.Vector2, component));
 }
 public Entity AddVector2(UnityEngine.Vector2 newVector2)
 {
     var component = new Vector2Component();
     component.vector2 = newVector2;
     return AddVector2(component);
 }
 public Entity AddVector2(Vector2Component component)
 {
     return AddComponent(ComponentIds.Vector2, component);
 }
        public static float GetComponent( this Vector2 vec2, Vector2Component com )
        {
            switch ( com )
            {
            case Vector2Component.X:
                return vec2.X;

            case Vector2Component.Y:
                return vec2.Y;

            default:
                throw new EnumException<Vector2Component>( nameof( com ), com );
            }
        }
        public static Vector2 ChangeComponent( this Vector2 vec2, Vector2Component com, float value )
        {
            switch ( com )
            {
            case Vector2Component.X:
                vec2.X = value;
                break;

            case Vector2Component.Y:
                vec2.Y = value;
                break;

            default:
                throw new EnumException<Vector2Component>( nameof( com ), com );
            }

            return vec2;
        }