Пример #1
0
        public void CreateTrapPrevu()
        {
            Trap trap = Traps[(int)SelectedTrapType];

            trap.IsInPreviewMode = true;
            GameObject trapGameObject = trap.TrapPrefab;

            trapGameObject.transform.position = GetCursorPosition();
            trapGameObject = Instantiate(trapGameObject);
            ActualTrap     = (Trap)trapGameObject.GetComponentInChildren(trap.GetType());
        }
Пример #2
0
    protected override void ApplyTo(Tile source, IEnumerable <Tile> tiles, IReadOnlyDictionary <Id, List <CastArgs> > args)
    {
        foreach (var tile in tiles)
        {
            if (!tile.Entities.Any(tileable => tileable is Trap))
            {
                var direction = Vector3.Normalize(source.GetWorldPosition() - Player.Active.Navigator.Current.GetWorldPosition());
                SpawnAt(tile, direction.xy().ComputeOrientation());
            }
            else if (tile.Entities.Any(tileable => tileable.GetType() == prefab.GetType()))
            {
                TryFindSpawnPoint(tile, Vector2Int.down);
                TryFindSpawnPoint(tile, Vector2Int.right);
                TryFindSpawnPoint(tile, Vector2Int.left);
                TryFindSpawnPoint(tile, Vector2Int.up);
            }
        }

        End();
    }
Пример #3
0
 private string GetTrappedState()
 {
     return("trapped" + _trap.GetType().Name);
 }