Exemple #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;
		}
Exemple #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();
        }
        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;
        }
Exemple #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));
        }
Exemple #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));
        }
 internal BulletBehavior(Member shooter, Vector2 direction)
 {
     this.Bullet = new Bullet(shooter, direction);
     direction.Normalize();
     this.Velocity = direction * Bullet.GetMaxSpeed();
 }
 internal CharacterBehavior(Member member)
 {
     Requires.NotNull(member, nameof(member));
     this.Member = member;
 }
Exemple #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);
		}
Exemple #9
0
		internal Bullet(Member shooter, Vector2 direction)
		{
			this.shooter = shooter;
			this.direction = direction;
			this.Initialized = false;
		}
 internal GunnerBehavior(Member member)
     : base(member)
 {
 }