예제 #1
0
 public bool IsDead()
 {
     return(buildingEntity.IsDead());
 }
        private void FindEntity(GameObject other,
                                out BasePlayerCharacterEntity player,
                                out BaseMonsterCharacterEntity monster,
                                out NpcEntity npc,
                                out ItemDropEntity itemDrop,
                                out BuildingEntity building,
                                bool findWithAdvanceOptions = true)
        {
            player = null;
            if (findPlayer)
            {
                player = other.GetComponent <BasePlayerCharacterEntity>();
                if (player == BasePlayerCharacterController.OwningCharacter)
                {
                    player = null;
                }
                if (findWithAdvanceOptions)
                {
                    if (findOnlyAlivePlayers && player != null && player.IsDead())
                    {
                        player = null;
                    }
                    if (findPlayerToAttack && player != null && player.IsAlly(BasePlayerCharacterController.OwningCharacter))
                    {
                        player = null;
                    }
                }
            }

            monster = null;
            if (findMonster)
            {
                monster = other.GetComponent <BaseMonsterCharacterEntity>();
                if (findWithAdvanceOptions)
                {
                    if (findOnlyAliveMonsters && monster != null && monster.IsDead())
                    {
                        monster = null;
                    }
                    if (findMonsterToAttack && monster != null && monster.IsAlly(BasePlayerCharacterController.OwningCharacter))
                    {
                        monster = null;
                    }
                }
            }

            npc = null;
            if (findNpc)
            {
                npc = other.GetComponent <NpcEntity>();
            }

            itemDrop = null;
            if (findItemDrop)
            {
                itemDrop = other.GetComponent <ItemDropEntity>();
            }

            building = null;
            if (findBuilding)
            {
                BuildingMaterial buildingMaterial = other.GetComponent <BuildingMaterial>();
                if (buildingMaterial != null)
                {
                    building = buildingMaterial.buildingEntity;
                }
                if (findWithAdvanceOptions)
                {
                    if (findOnlyAliveBuildings && building != null && building.IsDead())
                    {
                        building = null;
                    }
                    if (findOnlyActivatableBuildings && building != null && !building.Activatable)
                    {
                        building = null;
                    }
                }
            }
        }