public Actor(Texture2D tex, int width, int height, int texWidth, int texHeight) { texture = tex; animationList = new ActionList(this); animations = new Dictionary<String, AnimationInfo>(); walkAnimation = new Walk(this.animationList, this); color = new Color(255, 255, 255, 255); attackBox = new Rectangle(0, 0, 0, 0); hitBox = new Rectangle(0, 0, width, height); body = new Rectangle(0, 0, texWidth, texHeight); acceleration = new Vector2(0, 0); friction = new Vector2(0, 0); movementIntent = new Vector2(0, 0); sightVector = new Vector2(0, 0); velocity = new Vector2(0, 0); curAnimFrame = new Point(0, 0); maxSpeed = 6; minSpeed = 3; bodyRotation = 0; targetRotation = 0; rotationVelocity = 0; health = 100; maxRotationVelocity = MathHelper.Pi / 16f; isAttacking = false; isPlayer = false; lockedMovement = false; Actor.Attack += new EventHandler<AttackEventArgs>(Actor_Attack); }
public void update(float dt) { for (int i = 0; i < actors.Count; i++) { curActor = actors.ElementAt(i); if ((curActor.velocity.X != 0 || curActor.velocity.Y != 0) && curActor.isWalking && !actionLists[curActor].has(walk)) { walk = new Walk(actionLists[curActor], curActor); if (actionLists[curActor].getSize() == 0 || (actionLists[curActor].getSize() > 0 && !actionLists[curActor].begin().isBlocking)) actionLists[curActor].pushFront(walk); } curActor.update(dt); actionLists[curActor].update(dt); } }