Exemplo n.º 1
0
        private static bool CanShout(IMyObjectToDetect detectedObject)
        {
            MyEntity detectedEntity = detectedObject as MyEntity;

            if (detectedEntity != null)
            {
                MyFactionRelationEnum factionRelation = MyFactions.GetFactionsRelation(MySession.PlayerShip, detectedEntity);
                if (detectedEntity is MySmallShipBot && factionRelation != MyFactionRelationEnum.Friend)
                {
                    MySmallShipBot bot = detectedEntity as MySmallShipBot;
                    return(!bot.IsParked() && !bot.IsPilotDead());
                }
                if (detectedEntity is MyPrefabLargeWeapon && factionRelation == MyFactionRelationEnum.Enemy)
                {
                    MyPrefabLargeWeapon largeWeapon = detectedEntity as MyPrefabLargeWeapon;
                    return(largeWeapon.IsWorking());
                }
            }
            return(false);
        }