예제 #1
0
파일: Trap.cs 프로젝트: Gyotek/Zellinarena
    //------------------------------------------------------------------------------------------------------------------/

    void OnTileChange(ITileable source)
    {
        if (source.Navigator.Current != Navigator.Current)
        {
            return;
        }
        Apply(source);
    }
예제 #2
0
    void OnMoveDone(ITileable tileable)
    {
        var damageable = Player.Active.GetComponent <EntityDamageable>();

        damageable.IsInvulnerable = false;

        Player.Active.onMoveDone -= OnMoveDone;
        End();
    }
예제 #3
0
파일: Push.cs 프로젝트: Gyotek/Zellinarena
    void OnMoveEnd(ITileable tileable)
    {
        tileable.onMoveDone -= OnMoveEnd;

        business--;
        if (business == 0)
        {
            End();
        }
    }
예제 #4
0
    void OnMoveDone(ITileable tileable)
    {
        isWaiting = false;

        if (shouldAttack)
        {
            Attack();
        }

        nav.Target.onMoveDone -= OnMoveDone;
        Inputs.isLocked        = false;
    }
예제 #5
0
    protected override void HandleTarget(ITileable target, IAttributeHolder attributes)
    {
        var component = (Component)target;

        if (!component.TryGetComponent <T>(out var mutable))
        {
            return;
        }

        base.HandleTarget(target, attributes);
        mutable.Dirty();
    }
예제 #6
0
    protected override void ApplyTo(Tile source, IEnumerable <Tile> tiles, IReadOnlyDictionary <Id, List <CastArgs> > args)
    {
        var entities = tiles.SelectMany(tile => tile.Entities);

        if (!entities.Any())
        {
            End();
            return;
        }

        target = entities.First();
        Routines.Start(Execute());
    }
예제 #7
0
파일: Boost.cs 프로젝트: Gyotek/Zellinarena
    protected virtual void HandleTarget(ITileable target, IAttributeHolder attributes)
    {
        var boost = GetBoost();

        if (boost is IWrapper <int> wrapper && wrapper.Value != 0)
        {
            var pool  = Repository.Get <SequencerPool>(Pools.Popup);
            var popup = pool.RequestSinglePoolable() as Popup;

            popup.transform.position = attributes.PopupAnchor.Position;

            var prefix = wrapper.Value < 0 ? '-' : '+';
            popup.Play($"{prefix}{Mathf.Abs(wrapper.Value)}", Type);
        }

        attributes.Add(boost);
    }
예제 #8
0
파일: Trap.cs 프로젝트: Gyotek/Zellinarena
    protected virtual void Apply(ITileable source)
    {
        var map  = Repository.Get <Map>(References.Map);
        var tile = map.Tilemap.WorldToCell(transform.position).ToTile();

        if (tile.Entities.Any(tileable => tileable is Tileable))
        {
            animator.SetTrigger("Explode");
        }

        AudioHandler.Play(trapSound);

        Routines.Start(Routines.DoAfter(() =>
        {
            spell.Prepare();
            spell.CastFrom(tile, Spellcaster.EmptyArgs);
        }, new YieldTime()));
    }
예제 #9
0
    protected override void Apply(ITileable source)
    {
        if (!Navigator.Current.Entities.Any(entity => entity is Tileable))
        {
            SlideDirection = Vector2Int.zero;
            return;
        }

        foreach (var entity in Navigator.Current.Entities)
        {
            if (entity is Golem golem)
            {
                if (golem.HasJustSpawned)
                {
                    return;
                }
            }
        }

        if (source is Tileable tileable)
        {
            Buffer.slideDirections.Enqueue(tileable.LastDirection.ComputeOrientation());
            if (tileable.IsMoving)
            {
                tileable.InterruptMove();
            }
        }
        else
        {
            if (SlideDirection == Vector2Int.zero)
            {
                return;
            }

            Buffer.slideDirections.Enqueue(SlideDirection);
            SlideDirection = Vector2Int.zero;
        }

        Routines.Start(Routines.DoAfter(() =>
        {
            spell.Prepare();
            spell.CastFrom(Navigator.Current, Spellcaster.EmptyArgs);
        }, new YieldFrame()));
    }
예제 #10
0
파일: Push.cs 프로젝트: Gyotek/Zellinarena
    protected virtual Vector2Int GetOrientationFor(ITileable target, int force)
    {
        var direction = Vector3.Normalize(target.Navigator.Current.GetWorldPosition() - Buffer.caster.Current.GetWorldPosition());

        return(direction.xy().ComputeOrientation() * (int)Mathf.Sign(force));
    }
예제 #11
0
 public bool visible(ITileable tile)
 {
     return(currentView.Contains(new Vector2(tile.MyPosition.X, tile.MyPosition.Y)));
 }
예제 #12
0
 protected override Vector2Int GetOrientationFor(ITileable target, int force) => Buffer.slideDirections.Dequeue();
예제 #13
0
    //------------------------------------------------------------------------------------------------------------------/

    public static bool TryGet <T>(this ITileable tileable, out T output) where T : ITag
    {
        if (tileable is Component component && component.TryGetComponent <T>(out output))
        {
            return(true);
        }
예제 #14
0
파일: Tile.cs 프로젝트: Gyotek/Zellinarena
 public virtual void Unregister(ITileable entity) => entities.Remove(entity);
예제 #15
0
파일: Tile.cs 프로젝트: Gyotek/Zellinarena
 public virtual void Register(ITileable entity) => entities.Add(entity);