private void EnemyEntity_OnDeath(DaggerfallEntity entity)
        {
            // Disable enemy gameobject
            // Do not destroy as we must still save enemy state when dead
            gameObject.SetActive(false);

            // Show death message
            string deathMessage = HardStrings.thingJustDied;
            deathMessage = deathMessage.Replace("%s", mobile.Summary.Enemy.Name);
            DaggerfallUI.Instance.PopupMessage(deathMessage);

            // Generate lootable corpse marker
            DaggerfallLoot loot = GameObjectHelper.CreateLootableCorpseMarker(
                GameManager.Instance.PlayerObject,
                entityBehaviour.gameObject,
                enemyEntity,
                mobile.Summary.Enemy.CorpseTexture,
                DaggerfallUnity.NextUID);

            // Generate items
            loot.GenerateItems();

            // Raise static event
            if (OnEnemyDeath != null)
                OnEnemyDeath(this, null);
        }
        private void EntityBehaviour_OnSetEntity(DaggerfallEntity oldEntity, DaggerfallEntity newEntity)
        {
            if (oldEntity != null)
            {
                oldEntity.OnDeath -= PlayerEntity_OnDeath;
            }

            if (newEntity != null)
            {
                playerEntity = newEntity as PlayerEntity;
                playerEntity.OnDeath += PlayerEntity_OnDeath;
            }
        }
        private void EntityBehaviour_OnSetEntity(DaggerfallEntity oldEntity, DaggerfallEntity newEntity)
        {
            if (oldEntity != null)
            {
                oldEntity.OnDeath -= EnemyEntity_OnDeath;
            }

            if (newEntity != null)
            {
                enemyEntity = newEntity as EnemyEntity;
                enemyEntity.OnDeath += EnemyEntity_OnDeath; ;
            }
        }
        void SetEntityType(EntityTypes type)
        {
            switch(type)
            {
                case EntityTypes.None:
                    Entity = null;
                    break;
                case EntityTypes.Player:
                    Entity = new PlayerEntity();
                    break;
            }

            lastEntityType = type;

            if (Entity != null)
                Entity.SetEntityDefaults();
        }
 /// <summary>
 /// Assigns default entity settings.
 /// </summary>
 public override void SetEntityDefaults()
 {
     // TODO: Add some bonus points to stats
     career = DaggerfallEntity.GetClassCareerTemplate(ClassCareers.Mage);
     if (career != null)
     {
         raceTemplate = CharacterDocument.GetRaceTemplate(Races.Breton);
         faceIndex    = 0;
         reflexes     = PlayerReflexes.Average;
         gender       = Genders.Male;
         stats.SetPermanentFromCareer(career);
         level     = testPlayerLevel;
         maxHealth = FormulaHelper.RollMaxHealth(level, career.HitPointsPerLevel);
         name      = testPlayerName;
         stats.SetDefaults();
         skills.SetDefaults();
         FillVitalSigns();
         for (int i = 0; i < ArmorValues.Length; i++)
         {
             ArmorValues[i] = 100;
         }
     }
 }
 void SetEntityValue(DaggerfallEntity value)
 {
     RaiseOnSetEntityHandler(entity, value);
     entity = value;
 }
 void RaiseOnSetEntityHandler(DaggerfallEntity oldEntity, DaggerfallEntity newEntity)
 {
     if (OnSetEntity != null)
         OnSetEntity(oldEntity, newEntity);
 }
Exemple #8
0
 void SetEntityValue(DaggerfallEntity value)
 {
     RaiseOnSetEntityHandler(entity, value);
     entity = value;
 }
        private void PlayerEntity_OnDeath(DaggerfallEntity entity)
        {
            if (deathInProgress || !mainCamera)
                return;

            // Start the death process and pause player input
            deathInProgress = true;
            timeOfDeath = Time.fixedTime;
            InputManager.Instance.IsPaused = true;

            // Start camera falling and fading to black
            startCameraHeight = mainCamera.transform.localPosition.y;
            targetCameraHeight = playerController.height - (playerController.height * 1.25f);
            currentCameraHeight = startCameraHeight;
            DaggerfallUI.Instance.FadeHUDToBlack(FadeDuration);

            if (OnPlayerDeath != null)
                OnPlayerDeath(this, null);
        }