Пример #1
0
 public CollisioinTreeNode()
 {
     AABB = new Bounds();
     AABB.Clear();
     LstCDBrush = new List <CDBrush>();
     Children   = new CollisioinTreeNode[8];
 }
Пример #2
0
//	Build AABB from vertices
    public static void Build(this Bounds aabb, Vector3[] lstVerPos)
    {
        aabb.Clear();
        for (int i = 0; i < lstVerPos.Length; i++)
        {
            aabb.Encapsulate(lstVerPos[i]);
        }
    }
Пример #3
0
    public CapsuleTraceBrushInfo()
    {
        Start.Init(Vector3.zero, 0, 0, Quaternion.identity);
        Delta = Vector3.zero;
        Bound.Clear();
        ChkFlags = 0u;
        Epsilon  = 1E-5f;

        StartSolid     = false;
        Fraction       = 1.0f;
        HitObject      = null;
        HitFlags       = 0u;
        HitPoints.size = 0;
        HitPoints.a    = 0;
        HitPoints.b    = 0;
        HitPoints.c    = 0;
        Normal         = Vector3.zero;
    }
 public void ClearTopoTable()
 {
     Log.InfoStart("ClearTopoTable");
     Archors.Clear();
     DevInfos.Clear();
     Maps.Clear();
     PhysicalTopologys.Clear();
     TransformMs.Clear();
     NodeKKSs.Clear();
     Points.Clear();
     Bounds.Clear();
     Log.InfoEnd("ClearTopoTable");
 }
Пример #5
0
 public void Dispose()
 {
     Nodes.Clear();
     MarkerGroups.Clear();
     Regions.Clear();
     Materials.Clear();
     Bounds.Clear();
     foreach (var mesh in Meshes)
     {
         mesh.Dispose();
     }
     Meshes.Clear();
 }
Пример #6
0
    public void Release()
    {
        AABB.Clear();
        LstCDBrush.Clear();

        for (int i = 0; i < 8; ++i)
        {
            if (Children[i] == null)
            {
                continue;
            }
            Children[i].Release();
        }
    }
Пример #7
0
            public void Update(bool extraSurrounding)
            {
                ulong steamId;

                if (SteamId == null || !ulong.TryParse(SteamId, out steamId))
                {
                    throw new InvalidDataException(
                              $"The Steam ID ({SteamId ?? "NULL"}) for the zone '{Name}' is invalid.");
                }
                var identity = GameManager.Instance.GetIdentity(steamId);

                if (identity == null)
                {
                    throw new InvalidDataException($"Couldn't find the Identity for {SteamId} in the zone '{Name}'.");
                }
                if (MainCell <= 0)
                {
                    throw new InvalidDataException(
                              $"The Cell ({SteamId ?? "NULL"}) for the zone '{Name}' is invalid.");
                }
                var cluster = BuildConnectedOwnedCellCluster(identity, MainCell);

                Stakes.Clear();
                foreach (var cell in cluster)
                {
                    var stake = GetStakeOnCell(cell);
                    if (stake != null)
                    {
                        Stakes.Add(stake);
                    }
                }
                if (extraSurrounding)
                {
                    var surroundingCells = GetUniqueSurroundingUnownedCells(cluster);
                    foreach (var surroundingCell in surroundingCells)
                    {
                        cluster.Add(surroundingCell);
                    }
                }
                Bounds.Clear();
                AllCells.Clear();
                foreach (var cell in cluster)
                {
                    Bounds.Add(GetCellBounds(cell));
                    AllCells.Add(cell);
                }
            }
Пример #8
0
        public override void Update(GameTime gameTime)
        {
            if (!(Game as Main).Started)
            {
                return;
            }

            var dt = (float)gameTime.ElapsedGameTime.TotalSeconds;

            var keys = Keyboard.GetState().GetPressedKeys();

            if (Arma.Municao <= 0)
            {
                Arma = new CanhaoSimples();
            }

            if (keys.Contains(Keys.Up))
            {
                Animation.Start();
                Inercia -= Direcao * dt * Aceleracao;
            }
            else if (keys.Contains(Keys.Down))
            {
                Inercia += Direcao * dt * Aceleracao / 5;
            }
            else
            {
                Animation.Stop().SelectIndex(6);
            }

            Animation.Update(gameTime);

            if (keys.Contains(Keys.Right))
            {
                Direcao = Direcao.Rotate(0.1f);
            }
            else if (keys.Contains(Keys.Left))
            {
                Direcao = Direcao.Rotate(-0.1f);
            }

            if (Posicao.X > Game.Window.ClientBounds.Width)
            {
                Posicao = new Vector2(0, Posicao.Y);
            }
            if (Posicao.X < 0)
            {
                Posicao = new Vector2(Game.Window.ClientBounds.Width, Posicao.Y);
            }

            if (Posicao.Y > Game.Window.ClientBounds.Height)
            {
                Posicao = new Vector2(Posicao.X, 0);
            }
            if (Posicao.Y < 0)
            {
                Posicao = new Vector2(Posicao.X, Game.Window.ClientBounds.Height);
            }

            var angle = -Direcao.Angle();

            Bounds.Clear();

            Bounds.Add(Posicao);
            Bounds.Add(new Vector2(Posicao.X, Posicao.Y - Animation.Source.Height / 2).Rotate(angle, Posicao));
            Bounds.Add(new Vector2(Posicao.X - Animation.Source.Width / 2 + 5, Posicao.Y - Animation.Source.Height / 2 + 5).Rotate(angle, Posicao));
            Bounds.Add(new Vector2(Posicao.X + Animation.Source.Width / 2 - 5, Posicao.Y - Animation.Source.Height / 2 + 5).Rotate(angle, Posicao));


            if (Keyboard.GetState().IsKeyDown(Keys.Space))
            {
                Arma.Atira(Game, gameTime, new [] { Bounds[2], Bounds[3] }, -Direcao);
            }

            if (Keyboard.GetState().IsKeyUp(Keys.Space))
            {
                Arma.Reset();
            }

            Posicao += Inercia;

            var meteoros = Game.Components.OfType <Meteoro>();

            // if (meteoros.Any(p => p.Contem(Bounds)))
            //     (Game as Main).End();
        }