Exemplo n.º 1
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Message"/> class.
		/// </summary>
		/// <param name="sender">The <see cref="Member"/> sending the <see cref="Message"/></param>
		/// <param name="reciever">The <see cref="Member"/> recieving the <see cref="Message"/></param>
		/// <param name="messageSubject">The <see cref="Subject"/> to be delivered</param>
		public Message(Member sender, Member reciever, Subject messageSubject)
		{
			Requires.NotNull(sender, nameof(sender));
			Requires.NotNull(reciever, nameof(reciever));

			this.Sender = sender;
			this.reciever = reciever;
			this.subject = messageSubject;
		}
Exemplo n.º 2
0
        private static CharacterBehavior CreateCharacterBehaviorFromMember(Member member)
        {
            Requires.NotNull(member, nameof(member));

            switch (member.GetClass())
            {
                case Class.Gunner:
                    {
                        return new GunnerBehavior(member);
                    }
            }

            throw new NotImplementedException();
        }
Exemplo n.º 3
0
        internal bool DealDamageToMemberOrFail(Member sender, string tag)
        {
            if (sender == null)
            {
                return false;
            }

            if (!sender.GetTeam().GetMembers().Array.Contains(this.Member))
            {
                // Here I'd use the tag to calculate the correct amount of damage (given the weapon)
                this.Member.Heal(-1);
                return true;
            }

            return false;
        }
Exemplo n.º 4
0
        internal static Entity CreateCharacter(Member member)
        {
            Requires.NotNull(member, nameof(member));

            return new Entity()
            {
                Tag = Constants.Tags.Member
            }
            .AddComponent(new RectangleCollider())
            .AddComponent(new Transform2D()
            {
                XScale = 3,
                YScale = 3,
            })
            .AddComponent(new SpriteRenderer(DefaultLayers.Alpha, samplerMode: AddressMode.PointClamp))
            .AddComponent(new Sprite(ClassToSpritePath[member.GetClass()]))
            .AddComponent(CreateCharacterBehaviorFromMember(member));
        }
Exemplo n.º 5
0
        internal static Entity CreateBullet(Member shooter, Vector2 position, float rotation, Vector2 direction)
        {
            Requires.NotNull(shooter, nameof(shooter));

            return new Entity()
            {
                Tag = Constants.Tags.Bullet
            }
                .AddComponent(new RectangleCollider())
                .AddComponent(new Transform2D()
                {
                    Position = position,
                    Rotation = rotation
                })
                .AddComponent(new SpriteRenderer(DefaultLayers.Alpha, samplerMode: AddressMode.PointClamp))
                .AddComponent(new Sprite("Content/bullet"))
                .AddComponent(new BulletBehavior(shooter, direction));
        }
Exemplo n.º 6
0
 internal BulletBehavior(Member shooter, Vector2 direction)
 {
     this.Bullet = new Bullet(shooter, direction);
     direction.Normalize();
     this.Velocity = direction * Bullet.GetMaxSpeed();
 }
Exemplo n.º 7
0
 internal CharacterBehavior(Member member)
 {
     Requires.NotNull(member, nameof(member));
     this.Member = member;
 }
Exemplo n.º 8
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Healing"/> class.
		/// </summary>
		/// <param name="reciever">The reciever of the <see cref="Healing"/></param>
		public Healing(Member reciever)
		{
			Requires.NotNull(reciever, nameof(reciever));
			this.message = new Message(null, reciever, Subject.Heal);
		}
Exemplo n.º 9
0
		internal Bullet(Member shooter, Vector2 direction)
		{
			this.shooter = shooter;
			this.direction = direction;
			this.Initialized = false;
		}
Exemplo n.º 10
0
 internal GunnerBehavior(Member member)
     : base(member)
 {
 }