Пример #1
0
        public virtual void updateMe(GameTime gt, Rectangle gameBounds, SessionManager SessionManager)
        {
            if (gameBounds.Contains(new Point((int)m_boundingSphere.Center.X, (int)m_boundingSphere.Center.Y)))
            {
                if ((this.GetType() == typeof(PlasmaBolt)) && ((m_velocity.Y > 1) || (m_velocity.Y < -1)))
                {
                    doBouncingCollision();
                }
                else
                {
                    doNormalCollision();
                }

                foreach (NetworkGamer player in SessionManager.NetSession.AllGamers)
                {
                    SpaceMarine playerCharacter = player.Tag as SpaceMarine;
                    doCollisionCheck(playerCharacter);
                }

                base.updateMe(gt);
            }
            else
            {
                m_state = EntityState.Dead;
            }
        }
Пример #2
0
        private void doCollisionCheck(SpaceMarine Player)
        {
            if (m_boundingSphere.Intersects(Player.Sphere))
            {
                if (Player != m_user)
                {
                    Vector2 vel = Player.Velocity;
                    CalculationFunctions.cResponse(m_pos, Player.Position, ref m_velocity, ref vel, m_mass, Player.Mass);
                    Player.Velocity     = vel;
                    Player.Health      -= m_Damage;
                    Player.DamageTicker = 15;
                    m_state             = EntityState.Dead;

                    if ((Player.Health <= 0) && Player.State != ActorState.Dying)
                    {
                        if (m_currMatch != MatchType.DM)
                        {
                            if (Player.Team != m_user.Team)
                            {
                                ((SpaceMarine)m_user).Score++;
                            }
                            else
                            {
                                ((SpaceMarine)m_user).Score--;
                            }
                        }
                        else
                        {
                            ((SpaceMarine)m_user).Score++;
                        }

                        Player.Killer = (string)((SpaceMarine)m_user).PlayerName;
                    }
                }
            }
        }