Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace BaseDuel
- {
- public class Base2
- {
- private string m_BaseName;
- public string BaseName
- { get { return m_BaseName; } }
- private ushort[] m_AlphaBaseRegion;
- private ushort[] m_AlphaStart;
- public ushort AlphaStartX
- { get { return m_AlphaStart[0]; } }
- public ushort AlphaStartY
- { get { return m_AlphaStart[1]; } }
- public bool PlayerInAlphaBase(ushort x, ushort y)
- {
- return m_Collision(0, x, y);
- }
- private ushort[] m_BravoBaseRegion;
- private ushort[] m_BravoStart;
- public ushort BravoStartX
- { get { return m_BravoStart[0]; } }
- public ushort BravoStartY
- { get { return m_BravoStart[1]; } }
- public bool PlayerInBravoBase(ushort x, ushort y)
- {
- return m_Collision(1, x, y);
- }
- private ushort[] m_MainRegion; // stored in pixels
- public bool PlayerInBase(ushort x, ushort y)
- {
- return m_Collision(2, x, y);
- }
- private bool m_Collision(byte type, ushort x, ushort y)
- {
- ushort[] region = new ushort[4];
- switch (type)
- {
- case 0:
- region = m_AlphaBaseRegion;
- break;
- case 1:
- region = m_BravoBaseRegion;
- break;
- case 2:
- region = m_MainRegion;
- break;
- }
- if (x > region[0] && x < region[2] && y > region[1] && y < region[3])
- return true;
- return false;
- }
- private ushort[] m_BotSpecCoords; // stored in tiles
- public ushort BotSpecX
- { get { return m_BotSpecCoords[0]; } }
- public ushort BotSpecY
- { get { return m_BotSpecCoords[1]; } }
- public Base2(string BaseName,ushort[] BaseCoords)
- {
- this.m_BaseName = BaseName;
- this.m_BotSpecCoords = new ushort[] {
- (ushort)Math.Floor((double)(BaseCoords[2] - BaseCoords[0])/2),
- (ushort)Math.Floor((double)(BaseCoords[3] - BaseCoords[1])/2)
- };
- this.m_MainRegion = new ushort[] {
- (ushort)(BaseCoords[0] * 16),
- (ushort)(BaseCoords[1] * 16),
- (ushort)(BaseCoords[2] * 16),
- (ushort)(BaseCoords[3] * 16)
- };
- this.m_AlphaStart = new ushort[] {
- (ushort)Math.Floor((double)(BaseCoords[6] - BaseCoords[4])/2),
- (ushort)Math.Floor((double)(BaseCoords[7] - BaseCoords[5])/2)
- };
- this.m_AlphaBaseRegion = new ushort[] {
- (ushort)(BaseCoords[4] * 16),
- (ushort)(BaseCoords[5] * 16),
- (ushort)(BaseCoords[6] * 16),
- (ushort)(BaseCoords[7] * 16)
- };
- this.m_BravoStart = new ushort[] {
- (ushort)Math.Floor((double)(BaseCoords[10] - BaseCoords[8])/2),
- (ushort)Math.Floor((double)(BaseCoords[11] - BaseCoords[9])/2)
- };
- this.m_BravoBaseRegion = new ushort[] {
- (ushort)(BaseCoords[8] * 16),
- (ushort)(BaseCoords[9] * 16),
- (ushort)(BaseCoords[10] * 16),
- (ushort)(BaseCoords[11] * 16)
- };
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement