Example #1
0
        public override void Draw(GameTime gameTime)
        {
            if (this.CurrentState == HandState.Latched)
            {
                _renderComponent.LoadContent("Character_Hand_Down");
                _renderComponent.Draw(gameTime, Color.White);
            }
            else if (this.CurrentState == HandState.Shooting || this.CurrentState == HandState.Retreating)
            {
                _renderComponent.LoadContent("Character_Hand_Open");
                _renderComponent.Rotation = CalculateRotation(this.TargetDirection);
                _renderComponent.Draw(gameTime, Color.White);
            }
            else
            {
                // dont draw
            }



            //if (HandId == HandID.First)
            //{
            //    _renderComponent.Draw(gameTime, Color.Red);
            //}
            //else
            //{
            //    _renderComponent.Draw(gameTime, Color.Azure);
            //}

            // Draw chain
            Vector2 startPosition = _player.Position;
            Vector2 endPosition   = this.Position;
            Vector2 direction     = endPosition - startPosition;

            direction.Normalize();
            float   scale = 2.5f;
            Vector2 currentDrawPosition = startPosition;

            while (Vector2.Dot(direction, (endPosition - currentDrawPosition)) > 0)
            {
                Color color = Color.Lerp(Color.White, Color.Red, ((startPosition - endPosition).Length() / _maxDistanceOfHand));
                GameManager.Instance.SpriteBatch.Draw(chainTexture, new Rectangle((int)currentDrawPosition.X - 16, (int)currentDrawPosition.Y - 16, 32, 32), color);
                currentDrawPosition += direction * scale;
            }

            if (GameManager.Instance.DebugMode)
            {
                this.CollisionComponent?.DebugDraw(gameTime);
            }
        }
Example #2
0
 public ThrowAbleEntity(Vector2 Position, Entity player)
 {
     Myplayer          = player;
     MyrenderComponent = new RenderComponent("Bread", this, HandEntry.HandOrigin);
     MyrenderComponent.LoadContent();
     MyrenderComponent.Scale = HandEntry.Scale;
     this.Position           = Position;
     myState = HandState.Default;
     chain   = new Stack <Entity>();
 }
Example #3
0
        public HandEntity(PlayerEntity player)
        {
            this.CurrentState = HandState.OnPlayer;
            this._player      = player;
            this.Velocity     = new Vector2();

            // Render
            _renderComponent = new RenderComponent("Character_Hand_Down", this, HandEntry.HandOrigin);
            _renderComponent.LoadContent();
            _renderComponent.Scale = HandEntry.Scale;

            this.chainTexture = GameManager.Instance.Content.Load <Texture2D>("Chain");

            this.Width  = 32f;
            this.Height = 32f;

            this.CollisionComponent = new BoxColliderComponent(this, this.Width / 2.0f, this.Height / 2.0f, CollisionLayers.PlayerHand);
        }
Example #4
0
        //private readonly HandEntity _hand2;


        /// <summary>
        /// Initializes a new instance of the <see cref="PlayerEntity"/> class.
        /// </summary>
        /// <param name="hide">if set to <c>true</c> [hide].</param>
        public PlayerEntity(bool hide = false) : base()
        {
            //this.CurrentState = CharacterState.Standard;
            this.Velocity = new Vector2();


            _idleAnimationComponent = new AnimationComponent("Idle", this,
                                                             framNumber,
                                                             playSpeed,
                                                             Names,
                                                             RenderManager.zombieAnimatedAttribute.Width
                                                             , RenderManager.zombieAnimatedAttribute.Height
                                                             , RenderManager.zombieAnimatedAttribute.Scale);

            _noArmsRenderComponent = new RenderComponent("Character_Body_NoArms", this);
            _noArmsRenderComponent.LoadContent();
            _airNoArmsRenderComponent = new RenderComponent("Character_Grapple_InAir", this);
            _airNoArmsRenderComponent.LoadContent();
            _isGrounded         = true;
            _alreadySpawnedDust = false;

            // Hand Logic
            _hand = new HandEntity(this, HandEntity.HandID.First);
            //_hand2 = new HandEntity(this, HandEntity.HandID.Second);
            this.Anchors = new List <Entity>()
            {
                _hand
            };

            // Load Content
            _idleAnimationComponent.LoadContent();
            this.Hide = hide;
            Width     = 32f;
            Height    = 32f;

            this.CollisionComponent = new BoxColliderComponent(this, this.Width, this.Height, Layers.NonStatic, Tags.Player);
        }