コード例 #1
0
        /// <summary>
        /// transform.localScale tween
        /// </summary>
        /// <returns>The klocal scale to.</returns>
        /// <param name="self">Self.</param>
        /// <param name="to">To.</param>
        /// <param name="duration">Duration.</param>
        public static ITween <Vector2> TweenLocalScaleTo(this ECEntity self, Vector2 to, float duration = 0.3f)
        {
            var tween = Pool <TransformVector2Tween> .Obtain();

            tween.SetTargetAndType(self.Transform, TransformTargetType.LocalScale);
            tween.Initialize(tween, to, duration);

            return(tween);
        }
コード例 #2
0
        /// <summary>
        /// transform.localEulers tween
        /// </summary>
        /// <returns>The klocal eulers to.</returns>
        /// <param name="self">Self.</param>
        /// <param name="to">To.</param>
        /// <param name="duration">Duration.</param>
        public static ITween <Vector2> TweenLocalRotationDegreesTo(this ECEntity self, float to, float duration = 0.3f)
        {
            var tween = Pool <TransformVector2Tween> .Obtain();

            tween.SetTargetAndType(self.Transform, TransformTargetType.LocalRotationDegrees);
            tween.Initialize(tween, new Vector2(to), duration);

            return(tween);
        }
コード例 #3
0
        internal void RemoveFromTagList(ECEntity entity)
        {
            FastList <ECEntity> list = null;

            if (_entityDict.TryGetValue(entity.Tag, out list))
            {
                list.Remove(entity);
            }
        }
コード例 #4
0
        internal void AddToTagList(ECEntity entity)
        {
            var list = GetTagList(entity.Tag);

            if (!list.Contains(entity))
            {
                list.Add(entity);
                _unsortedTags.Add(entity.Tag);
            }
        }
コード例 #5
0
ファイル: RuntimeInspector.cs プロジェクト: JonSnowbd/Ash
 void Dispose(bool disposing)
 {
     if (!_disposedValue)
     {
         Core.Emitter.RemoveObserver(CoreEvents.GraphicsDeviceReset, OnGraphicsDeviceReset);
         Core.Emitter.RemoveObserver(CoreEvents.SceneChanged, OnSceneChanged);
         _entity        = null;
         _disposedValue = true;
     }
 }
コード例 #6
0
        /// <summary>
        /// removes an Entity from the list. All lifecycle methods will be called in the next frame.
        /// </summary>
        /// <param name="entity">Entity.</param>
        public void Remove(ECEntity entity)
        {
            Debug.WarnIf(_entitiesToRemove.Contains(entity),
                         "You are trying to remove an entity ({0}) that you already removed", entity.Name);

            // guard against adding and then removing an Entity in the same frame
            if (_entitiesToAdd.Contains(entity))
            {
                _entitiesToAdd.Remove(entity);
                return;
            }

            if (!_entitiesToRemove.Contains(entity))
            {
                _entitiesToRemove.Add(entity);
            }
        }
コード例 #7
0
ファイル: FollowCamera.cs プロジェクト: JonSnowbd/Ash
        public void Follow(ECEntity targetEntity, CameraStyle cameraStyle = CameraStyle.CameraWindow)
        {
            _targetEntity = targetEntity;
            _cameraStyle  = cameraStyle;
            var cameraBounds = Camera.Bounds;

            switch (_cameraStyle)
            {
            case CameraStyle.CameraWindow:
                var w = (cameraBounds.Width / 6);
                var h = (cameraBounds.Height / 3);
                Deadzone = new RectangleF((cameraBounds.Width - w) / 2, (cameraBounds.Height - h) / 2, w, h);
                break;

            case CameraStyle.LockOn:
                Deadzone = new RectangleF(cameraBounds.Width / 2, cameraBounds.Height / 2, 10, 10);
                break;
            }
        }
コード例 #8
0
ファイル: EntityExt.cs プロジェクト: JonSnowbd/Ash
 public static ECEntity SetScale(this ECEntity self, Vector2 scale)
 {
     self.Transform.SetScale(scale);
     return(self);
 }
コード例 #9
0
ファイル: FollowCamera.cs プロジェクト: JonSnowbd/Ash
 public FollowCamera(ECEntity targetEntity, Camera camera, CameraStyle cameraStyle = CameraStyle.LockOn)
 {
     _targetEntity = targetEntity;
     _cameraStyle  = cameraStyle;
     Camera        = camera;
 }
コード例 #10
0
 /// <summary>
 /// checks to see if the Entity is presently managed by this EntityList
 /// </summary>
 /// <param name="entity">Entity.</param>
 public bool Contains(ECEntity entity)
 {
     return(_entities.Contains(entity) || _entitiesToAdd.Contains(entity));
 }
コード例 #11
0
ファイル: FollowCamera.cs プロジェクト: JonSnowbd/Ash
 public FollowCamera(ECEntity targetEntity, CameraStyle cameraStyle = CameraStyle.LockOn) : this(targetEntity,
                                                                                                 null, cameraStyle)
 {
 }
コード例 #12
0
ファイル: EntityExt.cs プロジェクト: JonSnowbd/Ash
 public static ECEntity SetParent(this ECEntity self, ECEntity entity)
 {
     self.Transform.SetParent(entity.Transform);
     return(self);
 }
コード例 #13
0
 /// <summary>
 /// transform.localScale tween
 /// </summary>
 /// <returns>The klocal scale to.</returns>
 /// <param name="self">Self.</param>
 /// <param name="to">To.</param>
 /// <param name="duration">Duration.</param>
 public static ITween <Vector2> TweenLocalScaleTo(this ECEntity self, float to, float duration = 0.3f)
 {
     return(self.TweenLocalScaleTo(new Vector2(to), duration));
 }
コード例 #14
0
 public ComponentList(ECEntity entity)
 {
     _entity = entity;
 }
コード例 #15
0
ファイル: EntityExt.cs プロジェクト: JonSnowbd/Ash
 public static ECEntity SetPosition(this ECEntity self, float x, float y)
 {
     self.Transform.SetPosition(x, y);
     return(self);
 }
コード例 #16
0
 /// <summary>
 /// adds an Entity to the list. All lifecycle methods will be called in the next frame.
 /// </summary>
 /// <param name="entity">Entity.</param>
 public void Add(ECEntity entity)
 {
     _entitiesToAdd.Add(entity);
 }
コード例 #17
0
ファイル: EntityExt.cs プロジェクト: JonSnowbd/Ash
 public static ECEntity SetLocalRotationDegrees(this ECEntity self, float degrees)
 {
     self.Transform.SetLocalRotationDegrees(degrees);
     return(self);
 }
コード例 #18
0
ファイル: EntityExt.cs プロジェクト: JonSnowbd/Ash
 public static ECEntity SetLocalRotation(this ECEntity self, float radians)
 {
     self.Transform.SetLocalRotation(radians);
     return(self);
 }
コード例 #19
0
ファイル: EntityExt.cs プロジェクト: JonSnowbd/Ash
 public static ECEntity SetLocalPosition(this ECEntity self, Vector2 localPosition)
 {
     self.Transform.SetLocalPosition(localPosition);
     return(self);
 }
コード例 #20
0
ファイル: EntityExt.cs プロジェクト: JonSnowbd/Ash
 public static ECEntity SetParent(this ECEntity self, Transform parent)
 {
     self.Transform.SetParent(parent);
     return(self);
 }
コード例 #21
0
ファイル: EntityExt.cs プロジェクト: JonSnowbd/Ash
 public static ECEntity SetLocalScale(this ECEntity self, float scale)
 {
     self.Transform.SetLocalScale(scale);
     return(self);
 }
コード例 #22
0
ファイル: RuntimeInspector.cs プロジェクト: JonSnowbd/Ash
 /// <summary>
 /// creates an Entity inspector
 /// </summary>
 /// <param name="entity">Entity.</param>
 public RuntimeInspector(ECEntity entity)
 {
     _entity = entity;
     Initialize();
     CacheTransformInspector();
 }
コード例 #23
0
 public ColliderTriggerHelper(ECEntity entity)
 {
     _entity = entity;
 }