Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        FocusZone = new ScreenZone(FocusX, FocusY, FocusWidth, FocusHeight);
        PanicZone = new ScreenZone(PanicX, PanicY, PanicWidth, PanicHeight);

        _PlayerScript = Player.GetComponent <Player>();
    }
Esempio n. 2
0
    private Vector2 DirectionRelativeToScreenZone(ScreenZone zone, GameObject obj)
    {
        Vector2 direction    = new Vector2(0, 0);
        Vector2 objScreenPos = Camera.main.WorldToScreenPoint(obj.transform.position);

        if (objScreenPos.x < zone.X) // Left of zone
        {
            direction.x = -1;
        }
        else if (objScreenPos.x > zone.X + zone.Width) // right of zone
        {
            direction.x = 1;
        }
        else
        {
            direction.x = 0;
        }

        if (objScreenPos.y > zone.Y + zone.Height)
        {
            direction.y = 1;
        }
        else if (objScreenPos.y < zone.Y)
        {
            direction.y = -1;
        }
        else
        {
            direction.y = 0;
        }

        return(direction);
    }
Esempio n. 3
0
    public void TranslateZoneBasedOnVelocity(ScreenZone zone, float XVelocity)
    {
        if (_PlayerScript.PlayerLookDirection.x > 0)
        {
            float targetX = zone.NormalX;
            targetX -= XVelocity * 7;

            if (XVelocity > .1f)
            {
                zone.X = Mathf.Lerp(zone.X, targetX, XVelocity * Time.deltaTime);
            }
            else
            {
                zone.X = Mathf.Lerp(zone.X, zone.NormalX, 5 * Time.deltaTime);
            }
        }
        else if (_PlayerScript.PlayerLookDirection.x < 0)
        {
            float targetX = zone.InvertX;
            targetX += XVelocity * -7;

            if (XVelocity < -.1f)
            {
                zone.X = Mathf.Lerp(zone.X, targetX, -XVelocity * Time.deltaTime);
            }
            else
            {
                zone.X = Mathf.Lerp(zone.X, zone.InvertX, 5 * Time.deltaTime);
            }
        }
    }
Esempio n. 4
0
        public void Render(ScreenZone zone)
        {
            var consoleRect = new SmallRect((short)zone.Left, (short)zone.Top, (short)(zone.Width + zone.Left - 1),
                                            (short)(zone.Height + zone.Top - 1));

            WriteConsoleOutput(consoleHandle, frameBuffer, new Coord((short)Width, (short)Height),
                               new Coord((short)zone.Left, (short)zone.Top), ref consoleRect);
        }
Esempio n. 5
0
 public void Fill(ScreenZone zone, ConsoleCharacter character)
 {
     for (int i = 0; i < zone.Width; i++)
     {
         for (int j = 0; j < zone.Height; j++)
         {
             Put(zone.Left + i, zone.Top + j, character);
         }
     }
 }
Esempio n. 6
0
        public static int UploadScreenLayout(string m_screenName, byte[] file, string[] screenZones)
        {
            List <ScreenZone> data2 = new List <ScreenZone>();
            var path     = string.Empty;
            var fileName = m_screenName;

            if (!Directory.Exists(ScreenLayoutFilePath))
            {
                System.IO.Directory.CreateDirectory(ScreenLayoutFilePath);
            }

            path = Path.Combine(ScreenLayoutFilePath, m_screenName);

            ScreenModel data = new ScreenModel
            {
                ScreenName           = m_screenName,
                ScreenLayoutLocation = path.ToString(),
                seatZones            = screenZones
            };

            foreach (string zone in screenZones)
            {
                ScreenZone screenZone = new ScreenZone
                {
                    ScreenName = m_screenName,
                    SeatZone   = zone
                };
                data2.Add(screenZone);
            }

            try
            {
                System.IO.File.WriteAllBytes(path, file);
            }
            catch (Exception e)
            {
                return(0);
            }

            string sql  = @"insert into dbo.Screens(ScreenName, ScreenLayoutLocation) values (@ScreenName, @ScreenLayoutLocation);";
            string sql2 = @"insert into dbo.SeatZones(ScreenName, SeatZone) values (@ScreenName, @SeatZone);";

            int result = SQLDataAccess.SaveData(sql2, data2);

            if (result == data2.Count)
            {
                return(SQLDataAccess.SaveData(sql, data));
            }
            else
            {
                return(0);
            }
        }
Esempio n. 7
0
    private void FlipScreenZoneOnX(ScreenZone zone, Vector2 direction)
    {
        if (LastLookDirection == direction)
        {
            return;
        }

        if (zone.X == zone.InvertX)
        {
            zone.X = zone.NormalX;
        }
        else
        {
            zone.X = zone.InvertX;
        }
    }
Esempio n. 8
0
 protected Panel(ScreenZone zone, ITextScreen screen)
 {
     Screen     = screen;
     Zone       = zone;
     ClientZone = new ScreenZone(zone.Left + 1, zone.Top + 1, zone.Width - 2, zone.Height - 2);
 }
Esempio n. 9
0
 public MessagesPanel(ScreenZone zone, ITextScreen screen)
     : base(zone, screen)
 {
     messages = new List <ConsoleMessage>();
 }
Esempio n. 10
0
 public LevelViewportPanel(ScreenZone zone, ITextScreen screen, Func <Level> levelProvider)
     : base(zone, screen)
 {
     this.levelProvider = levelProvider;
 }
Esempio n. 11
0
 public InfoPanel(ScreenZone zone, ITextScreen screen, Func <Level> levelProvider, Func <Location> locationProvider)
     : base(zone, screen)
 {
     this.levelProvider    = levelProvider;
     this.locationProvider = locationProvider;
 }
Esempio n. 12
0
 public StatsPanel(ScreenZone zone, ITextScreen screen, Func <Player> playerProvider)
     : base(zone, screen)
 {
     this.playerProvider = playerProvider;
 }