Example #1
0
        /// <summary>
        /// Determines if one player can damage another, which is affected by FFA, teams they belong to, friendly fire.
        /// </summary>
        public static bool    CanPlayerDamagePlayer(Player attacker, Player target)
        {
            if (target != null)
            {
                if (TeamManager.ArePlayersFriendly(target, attacker))
                {
                    // check if friendly fire is allowed
                    if (!TeamManager.IsFriendlyFireOn())
                    {
                        // players are in the same team, and friendly fire is not allowed
                        return(false);
                    }
                }
            }

            return(true);
        }