Пример #1
0
        /// <summary>
        /// Affects any object's within range of the player's tool.
        /// </summary>
        /// <param name="allObjects">A list of all objects in the game.</param>
        public void AffectObjectsInToolRange(List <GameObjectServer> allObjects)
        {
            // Iterate through all objects.
            for (int j = 0; j < allObjects.Count; j++)
            {
                //Get the current object.
                GameObjectServer gameObject = allObjects[j];

                if (ActiveToolMode == ToolMode.PRIMARY || ActiveToolMode == ToolMode.SECONDARY)
                {
                    // Check if it's within tool range, and that it's not the current player.
                    if (gameObject != this && gameObject.IsWithinToolRange(GetToolTransform(), ToolEquipped, ActiveToolMode))
                    {
                        // Hit the object.
                        gameObject.HitByTool(this, GetToolTransform(), ToolEquipped, ActiveToolMode);
                    }
                }
            }
        }