コード例 #1
0
ファイル: Slime.cs プロジェクト: scerdam/Maze
        public override void Use(Unit user)
        {
            if (user.UnitSide != UnitSides.Good)
                user.CastEffect(ViscousSlime, user);

            base.Use(user);
        }
コード例 #2
0
ファイル: MovementGenerator.cs プロジェクト: scerdam/Maze
        /// <summary>
        /// Initializes a new instance of the MovementGenerator class.
        /// </summary>
        /// <param name="unit">The owner of the generator instance.</param>
        public MovementGenerator(Unit unit)
        {
            this.mover = unit;
            generatorType = MovementGeneratorType.None;

            this.mover.LocationChanged += OnLocationChanged;
            this.mover.Relocated += mover_Relocated;
        }
コード例 #3
0
ファイル: Portal.cs プロジェクト: scerdam/Maze
        public override void Use(Unit user)
        {
            if (!user.IsVisible)
                return;
            user.TeleportTo(destinationCell);

            base.Use(user);
        }
コード例 #4
0
ファイル: ChasingMovement.cs プロジェクト: scerdam/Maze
 /// <summary>
 /// Initializes a new instance of the ChasingMovement class.
 /// </summary>
 /// <param name="unit">The owner of the generator instance.</param>
 public ChasingMovement(Unit unit)
     : base(unit)
 {
     this.pathFindingTimer = PATHFINDING_TIME;
     this.state = MotionStates.None;
     this.victim = World.PlayForm.Player;
     this.pathFinder = new PathFinder(Map.Instance.GetCell(this.mover.Position.Location),
         Map.Instance.GetCell(this.victim.Position.Location));
 }
コード例 #5
0
ファイル: OozeDrop.cs プロジェクト: scerdam/Maze
        public override void Use(Unit user)
        {
            if (!IsActive || user.ObjectType != ObjectTypes.Slug || !user.IsVisible || !user.IsAlive)
                return;

            ((Slug)user).CollectDrop(this);

            base.Use(user);
        }
コード例 #6
0
ファイル: Unit.cs プロジェクト: scerdam/Maze
        public void CastEffect(ushort effectID, Unit target)
        {
            EffectEntry effectEntry = DBStores.EffectStore[effectID];

            Effect effect = new Effect(effectEntry, target, this);
            effect.Cast();
        }
コード例 #7
0
ファイル: Unit.cs プロジェクト: scerdam/Maze
 /// <summary>
 /// Initializes a new instance of the EffectCollection class.
 /// </summary>
 /// <param name="owner">The <see cref="Unit"/> instance whom all these effect will belong to.</param>
 public EffectCollection(Unit owner)
 {
     this.owner = owner;
     effectList = new List<EffectHolder>();
 }
コード例 #8
0
ファイル: Bonus.cs プロジェクト: scerdam/Maze
        /// <summary>
        /// Ovverrides <see cref="GridObject.Use"/>.
        /// </summary>
        public override void Use(Unit user)
        {
            if (!user.IsVisible || !user.IsAlive)
                return;

            if (!bonusEffect.IsOpen)
            {

                if (user.UnitType == UnitTypes.Slug)
                    ((Slug)user).CollectHiddenBonus(bonusEffect.EffectID);
                else
                    return;
            }
            else
            {
                user.CastEffect(bonusEffect.EffectID, user);
            }

            base.Use(user);
        }
コード例 #9
0
ファイル: Effect.cs プロジェクト: scerdam/Maze
        public Effect(EffectEntry effectEntry, Unit target, Unit caster)
        {
            this.effectInfo = effectEntry;
            this.target = target;
            this.caster = caster;

            targetsList = new List<Unit>();
        }
コード例 #10
0
ファイル: CustomMovement.cs プロジェクト: scerdam/Maze
 public CustomMovement(Unit unit)
     : base(unit)
 {
 }
コード例 #11
0
ファイル: Unit.cs プロジェクト: scerdam/Maze
 /// <summary>
 /// Called when the unit goes away from the collision with another unit.
 /// </summary>
 /// <param name="unit">The source of the collision.</param>
 protected virtual void UnitCollisionEnds(Unit unit)
 {
 }
コード例 #12
0
ファイル: Slug.cs プロジェクト: scerdam/Maze
 protected override void UnitCollision(Unit unit)
 {
     // Do not kill with shield effect
     if (!this.HasEffectType(EffectTypes.Shield))
         unit.KillUnit(this);
 }
コード例 #13
0
 /// <summary>
 /// Initializes a new instance of the RandomMovementGenerator class.
 /// </summary>
 /// <param name="unit">The owner of the generator</param>
 public RandomMovementGenerator(Unit unit)
     : base(unit)
 {
     this.generatorType = MovementGeneratorType.Random;
 }
コード例 #14
0
ファイル: PictureManager.cs プロジェクト: scerdam/Maze
        public static Image GetUnitImage(Unit unit)
        {
            // Separate method for Slug
            if (unit.ObjectType == ObjectTypes.Slug)
                return GetSlugImage((Slug)unit);

            // Do not draw Invisible and Dead units
            if (!unit.IsVisible || !unit.IsAlive)
                return null;

            switch (unit.UnitType)
            {
                case UnitTypes.Deimos:
                    return DeimosImage;
                case UnitTypes.Phobos:
                    return PhobosImage;
                case UnitTypes.SlugClone:
                    return SlugImage;
            }

            // Else nothing to draw
            return null;
        }
コード例 #15
0
ファイル: SlugClone.cs プロジェクト: scerdam/Maze
 protected override void UnitCollision(Unit unit)
 {
     unit.KillUnit(this);
 }
コード例 #16
0
ファイル: Unit.cs プロジェクト: scerdam/Maze
        /// <summary>
        /// The unit changes the death state of another unit by force, getting a reward for it.
        /// </summary>
        /// <param name="victim">The target unit</param>
        /// <returns><c>true</c>, if a victim bacame dead; otherwise, <c>false</c>.</returns>
        public bool KillUnit(Unit victim)
        {
            if (victim.HasUnitFlags(UnitFlags.CanNotBeKilled))
                return false;

            victim.SetDeathState(DeathStates.Dead);

            // TODO:
            // Kind of reward for the killer

            return true;
        }
コード例 #17
0
ファイル: Unit.cs プロジェクト: scerdam/Maze
 /// <summary>
 /// Called when the unit first time came in contact with another unit.
 /// </summary>
 /// <param name="unit">The source of the collision.</param>
 protected virtual void UnitCollisionBegins(Unit unit)
 {
 }
コード例 #18
0
ファイル: Slug.cs プロジェクト: scerdam/Maze
 protected override void UnitCollisionEnds(Unit unit)
 {
     if (this.HasEffectType(EffectTypes.Shield))
     {
         EffectHolder holder = this.effectList.GetHolder(11);
         if (holder != null)
             RemoveEffect(holder);
     }
 }
コード例 #19
0
ファイル: Effect.cs プロジェクト: scerdam/Maze
 private bool AddTarget(Unit target)
 {
     if (targetsList.Contains(target))
     {
         return false;
     }
     else
     {
         targetsList.Add(target);
         return true;
     }
 }
コード例 #20
0
ファイル: GridObject.cs プロジェクト: scerdam/Maze
 public virtual void Use(Unit user)
 {
     // Deactivate if needed
     if (!HasFlags(GridObjectFlags.AlwaysActive))
     {
         GridObjectState = GridObjectStates.Inactive;
         this.recentlyUsed = true;
         activationTimer = activationTime;
     }
 }