Exemple #1
0
    int DamageCalculation(BasePlayer player, BaseNPC target)
    {
        int damage = ((player.strength ^ 3 / 32) + 32) * Random.Range(player.minAttack, player.maxAttack) / 16;
        int defense = (((target.armor - 280) ^ 2) / 110) + 16;
        int baseDamage = damage * defense / 730;
        int finalDamage = baseDamage * (730 - (defense * 51 - defense ^ 2 / 11) / 10) / 730;

        if (finalDamage <= 0)
            finalDamage = 0;
        return finalDamage * 2;
    }
Exemple #2
0
 void frameInit()
 {
     npc = transform.GetComponent<BaseNPC> ();
     if (!npc) {
         Debug.LogError("This transform has not BaseNPC component.");
         return;
     }
     player = GameObject.Find ("Player").GetComponent<BasePlayer> ();
     if (!player) {
         Debug.LogError("There is no player object.");
         return;
     }
 }
Exemple #3
0
 void Start()
 {
     baseNPC = target.GetComponent<BaseNPC>();
     if(!baseNPC)
     {
         basePlayer = target.GetComponent<BasePlayer>();
         if(!basePlayer)
         {
             Debug.LogError("Missing or wrong target!");
         }
         else
         {
             player = true;
         }
     }
     else
     {
         player = false;
     }
 }
Exemple #4
0
    // Public
    public void SetParam(GameObject currentTarget)
    {
        // Offset Count
        uint offsetCount = 0;

        // Clear Content
        RemoveAllChildren(panelContent);
        if (currentTarget.GetComponent <BaseNPC>() != null)
        {
            BaseNPC baseNPC = currentTarget.GetComponent <BaseNPC>();
            // Create Action Cell
            GameObject loockCell = Instantiate <GameObject>(actionCellPrefab, panelContent.transform);
            loockCell.GetComponent <PanelActionCell>().SetParam("Loock", currentTarget);
            offsetCount++;
            if (baseNPC.NPCParam.agresion >= 0)
            {
                // Talk
                GameObject talkCell = Instantiate <GameObject>(actionCellPrefab, panelContent.transform);
                talkCell.GetComponent <PanelActionCell>().SetParam("Talk", currentTarget);
                offsetCount++;
                // Trade
                GameObject tradeCell = Instantiate <GameObject>(actionCellPrefab, panelContent.transform);
                tradeCell.GetComponent <PanelActionCell>().SetParam("Trade", currentTarget);
                offsetCount++;
            }
            GameObject stealCell = Instantiate <GameObject>(actionCellPrefab, panelContent.transform);
            stealCell.GetComponent <PanelActionCell>().SetParam("Steal", currentTarget);
            offsetCount++;
        }
        if (currentTarget.GetComponent <BaseSceneObject>() != null)
        {
            // Create Action Cell
            GameObject loockCell = Instantiate <GameObject>(actionCellPrefab, panelContent.transform);
            loockCell.GetComponent <PanelActionCell>().SetParam("Loock", currentTarget);
            offsetCount++;
            /// Tree Object
            if (currentTarget.GetComponent <TreeObject>() != null)
            {
                TreeObject treeObject = currentTarget.GetComponent <TreeObject>();
                // Get Hurvest
                GameObject hurvestCell = Instantiate <GameObject>(actionCellPrefab, panelContent.transform);
                hurvestCell.GetComponent <PanelActionCell>().SetParam("Hurvest", currentTarget);
                offsetCount++;
                // Get Sticks
                GameObject stickCell = Instantiate <GameObject>(actionCellPrefab, panelContent.transform);
                stickCell.GetComponent <PanelActionCell>().SetParam("GetStick", currentTarget);
                offsetCount++;
                // Cut
                GameObject cutCell = Instantiate <GameObject>(actionCellPrefab, panelContent.transform);
                cutCell.GetComponent <PanelActionCell>().SetParam("CutTree", currentTarget);
                offsetCount++;
            }
            /// Barrel Object
            if (currentTarget.GetComponent <BarrelObject>() != null)
            {
                // Open
                GameObject cutCell = Instantiate <GameObject>(actionCellPrefab, panelContent.transform);
                cutCell.GetComponent <PanelActionCell>().SetParam("Open", currentTarget);
                offsetCount++;
            }
        }
        // Set Panel Height
        RectTransform rectTransform = gameObject.GetComponent <RectTransform>();

        rectTransform.sizeDelta = new Vector2(rectTransform.rect.width, rectTransform.rect.height + (offsetCount * offSet));
    }
Exemple #5
0
 /// <summary>
 /// Event method called when checking if a button should be visible
 /// </summary>
 /// <param name="npc">Npc on who to cache the function</param>
 /// <param name="dialog">DialogId to check (as in defined in DialogTypes)</param>
 /// <param name="target">Target who to check</param>
 /// <returns>True if the button should be visible</returns>
 protected internal virtual bool OnCheckDialogIsVisible(BaseNPC npc, DialogType dialog, Character target)
 {
     return(true);
 }
Exemple #6
0
 /// <summary>
 /// Event method called when refreshing the npcfunction on the npc
 /// </summary>
 /// <param name="npc">Npc on who to refresh the function</param>
 protected internal virtual void OnRefresh(BaseNPC npc)
 {
 }
Exemple #7
0
        /// <summary>
        /// Called from <c>BaseNPC.OnKilled(HitInfo)</c> .
        /// </summary>
        public static void On_NPCKilled(BaseNPC baseNPC, HitInfo info)
        {
            if (info.Initiator != null && info.Initiator.ToPlayer() != null) {
                Server.GetPlayer(info.Initiator as BasePlayer).Stats.AddKill(false, true);
            }

            NPC npc = new NPC(baseNPC);

            OnNext("On_NPCKilled", new NPCDeathEvent(npc, info));
        }
Exemple #8
0
        // BaseAnimal.Die()
        public static void NPCDied(BaseNPC bnpc, HitInfo info)
        {
            if (info.Initiator != null && info.Initiator.ToPlayer() != null) {
                Server.GetPlayer(info.Initiator as BasePlayer).Stats.AddKill(false, true);
            }

            var npc = new NPC(bnpc);
            OnNPCDied.OnNext(new Events.NPCDeathEvent(npc, info));
        }
Exemple #9
0
 /// <summary>
 /// Loads all dialog dialog information.
 /// </summary>
 /// <remarks>
 /// The information is loaded from the data folder in dialogtemplates/{npcmodelid}.xml
 /// </remarks>
 /// <param name="npc">Npc who requires caching</param>
 /// <param name="name">Name of the found string</param>
 /// <param name="value">Value of the found string</param>
 protected virtual void OnLocationGuide(BaseNPC npc, Character target)
 {
     target.Tag = _guidelist;
     Common.Actions.OpenLocationGuide(target, _locmenuid);
 }
 /// <summary>
 /// Registers all the menu's and buttons on the npc.
 /// </summary>
 /// <param name="npc">Npc who to register with</param>
 protected internal override void OnRegister(BaseNPC npc)
 {
     RegisterDialog(npc, DialogType.Shop, new FunctionCallback(OnShop));
     OnCacheShop(npc);
 }
 /// <summary>
 /// Return all the wap locations availabel of the current npc.
 /// </summary>
 /// <param name="npc">Npc which to find the warps for</param>
 /// <returns></returns>
 protected virtual IEnumerable <ushort> GetWarpLocations(BaseNPC npc)
 {
     return(Common.Special.GetWarperTable(npc.ModelId));
 }
 /// <summary>
 /// Shows all warp function of the current npc.
 /// </summary>
 /// <param name="npc">Npc to hold the dialog</param>
 protected virtual void OnWarp(BaseNPC npc, Character target)
 {
     CommonFunctions.ShowWarpOptions(target, npc,
                                     GetWarpLocations(npc)
                                     );
 }
 /// <summary>
 /// Registers all dialogs for the npc.
 /// </summary>
 /// <param name="npc">Npc to hold the dialog</param>
 protected internal override void OnRegister(BaseNPC npc)
 {
     RegisterDialog(npc, DialogType.Warp, new FunctionCallback(OnWarp));
 }
Exemple #14
0
 void UpdateAction()
 {
     if (npc != null && input.IsDown(SecondButton))
     {
         if (npc.action == Act.Follow)
         {
             owner.ChatMessage(UnFollowMsg);
             npc.action = Act.None;
         }
         else
         {
             owner.ChatMessage(FollowMsg);
             npc.Attack(owner.GetComponent <BaseCombatEntity>(), Act.Follow);
         }
     }
     else
     {
         RaycastHit hit;
         if (Physics.SphereCast(owner.eyes.position, 0.5f, Quaternion.Euler(input.current.aimAngles) * Vector3.forward, out hit) && hit.transform != transform)
         {
             if (npc == null)
             {
                 BaseNPC hited = hit.transform.GetComponent <BaseNPC>();
                 if (hited != null)
                 {
                     NpcAI OwnedNpc = hited.GetComponent <NpcAI>();
                     if (OwnedNpc != null && OwnedNpc.owner != this)
                     {
                         owner.ChatMessage(NoOwn);
                     }
                     else if (NextTimeToControl < Time.realtimeSinceStartup)
                     {
                         if (!UsePermission || PluginInstance.HasPermission(owner, "can" + hited.modelPrefab.Remove(0, 12).Replace("_skin", "")))
                         {
                             if (hit.distance < MaxControlDistance)
                             {
                                 NextTimeToControl = Time.realtimeSinceStartup + ReloadControl;
                                 owner.ChatMessage(NewPetMsg);
                                 npc       = hited.gameObject.AddComponent <NpcAI>();
                                 npc.owner = this;
                             }
                             else
                             {
                                 owner.ChatMessage(CloserMsg);
                             }
                         }
                         else
                         {
                             owner.ChatMessage(NoPermPetMsg);
                         }
                     }
                     else
                     {
                         owner.ChatMessage(ReloadMsg);
                     }
                 }
             }
             else
             {
                 BaseCombatEntity targetentity = hit.transform.GetComponent <BaseCombatEntity>();
                 if (targetentity == null)
                 {
                     npc.targetpoint = hit.point;
                     npc.action      = Act.Move;
                 }
                 else
                 {
                     if (targetentity == (BaseCombatEntity)npc.Base)
                     {
                         if (hit.distance <= LootDistance)
                         {
                             owner.inventory.loot.StartLootingEntity((BaseEntity)npc.Base, true);
                             owner.inventory.loot.AddContainer(npc.inventory);
                             owner.inventory.loot.SendImmediate();
                             owner.ClientRPC(owner.net.connection, owner, "RPC_OpenLootPanel", "smallwoodbox");
                         }
                     }
                     else if (targetentity is BaseCorpse)
                     {
                         owner.ChatMessage(EatMsg);
                         npc.Attack(targetentity, Act.Eat);
                     }
                     else
                     {
                         owner.ChatMessage(AttackMsg);
                         npc.Attack(targetentity);
                     }
                 }
             }
         }
     }
 }
 private void OnNpcExitZone(Zone zone, BaseNPC entity)
 {
     HashSet<Zone> zones;
     if (npcZones.TryGetValue(entity, out zones))
     {
         if (!zones.Remove(zone)) return;
         if (zones.Count <= 0) npcZones.Remove(entity);
     }
     if (HasZoneFlag(zone, ZoneFlags.NpcFreeze))
         npcNextTick.SetValue(entity, Time.time);
     //Puts("OnNpcExitZone: {0}", entity.GetType());
 }
 private void OnNpcEnterZone(Zone zone, BaseNPC entity)
 {
     HashSet<Zone> zones;
     if (!npcZones.TryGetValue(entity, out zones))
         npcZones[entity] = zones = new HashSet<Zone>();
     if (!zones.Add(zone)) return;
     if (HasZoneFlag(zone, ZoneFlags.NpcFreeze))
         npcNextTick.SetValue(entity, 999999999999f);
     //Puts("OnNpcEnterZone: {0}", entity.GetType());
 }
Exemple #17
0
 public override void HasDied(BaseNPC Sender)
 {
     PetDead = true;
     base.HasDied(Sender);
 }
 /// <summary>
 /// Refreshes the bookstore
 /// </summary>
 /// <param name="npc">Target npc</param>
 protected internal override void OnRefresh(BaseNPC npc)
 {
     OnCacheShop(npc);
 }
 public override DialogStatus QuestStatus(Mobile questOwner, Character c)
 {
     return(BaseNPC.QDS(questOwner, c, this));
 }
 /// <summary>
 /// When overriden this will open the shoplist
 /// </summary>
 /// <param name="character">Character to open the list</param>
 /// <param name="basenpc">Npc who shows the list</param>
 public virtual void Open(Character character, BaseNPC basenpc)
 {
 }
Exemple #21
0
 public NPC(BaseNPC npc) : base(npc)
 {
     baseNPC = npc;
 }
Exemple #22
0
 private void OnNpcEnterZone(Zone zone, BaseNPC entity)
 {
     HashSet<Zone> zones;
     if (!npcZones.TryGetValue(entity, out zones))
         npcZones[entity] = zones = new HashSet<Zone>();
     zones.Add(zone);
     if (HasZoneFlag(zone, ZoneFlags.NpcFreeze))
         npcNextTick.SetValue(entity, 999999999999f);
 }
Exemple #23
0
        private void CreateHouse(Cord cord, BaseTile Wall)
        {
            List <Cord> CheckList = new List <Cord> {
                new Cord {
                    X = Location.X - 1, Y = Location.Y
                }, new Cord {
                    X = Location.X - 2, Y = Location.Y
                }, new Cord {
                    X = Location.X - 2, Y = Location.Y - 1
                }, new Cord {
                    X = Location.X - 2, Y = Location.Y - 2
                }, new Cord {
                    X = Location.X - 2, Y = Location.Y - 3
                }, new Cord {
                    X = Location.X - 2, Y = Location.Y - 4
                }, new Cord {
                    X = Location.X - 1, Y = Location.Y - 4
                }, new Cord {
                    X = Location.X, Y = Location.Y - 4
                }, new Cord {
                    X = Location.X + 1, Y = Location.Y - 4
                }, new Cord {
                    X = Location.X + 2, Y = Location.Y - 4
                }, new Cord {
                    X = Location.X + 2, Y = Location.Y - 3
                }, new Cord {
                    X = Location.X + 2, Y = Location.Y - 2
                }, new Cord {
                    X = Location.X + 2, Y = Location.Y - 1
                }, new Cord {
                    X = Location.X + 2, Y = Location.Y
                }, new Cord {
                    X = Location.X + 1, Y = Location.Y
                }
            };

            foreach (Cord element in CheckList)
            {
                Tiles[element.X, element.Y] = Wall;
            }
            if (NPCS.Count >= 2)
            {
                int rand = SingleTon.GetRandomNum(0, 3);
                if (rand != 0)
                {
                    for (int b = 0; b < rand; ++b)
                    {
                        BaseNPC npc = NPCS[SingleTon.GetRandomNum(0, NPCS.Count)];
                        Cord    pos = new Cord {
                            X = SingleTon.GetRandomNum(Location.X - 1, Location.X + 2), Y = SingleTon.GetRandomNum(Location.Y - 3, Location.Y)
                        };
                        Tiles[pos.X, pos.Y] = new TileNPC(npc.Name, true, pos);
                        AllNPCs.Add((TileNPC)Tiles[pos.X, pos.Y]);
                        NPCS.Remove(npc);
                    }
                }
            }
            else if (NPCS.Count == 1)
            {
                Cord pos = new Cord {
                    X = SingleTon.GetRandomNum(Location.X - 1, Location.X + 2), Y = SingleTon.GetRandomNum(Location.Y - 3, Location.Y)
                };
                Tiles[pos.X, pos.Y] = new TileNPC(NPCS[0].Name, true, pos);
                NPCS.RemoveAt(0);
            }
        }
Exemple #24
0
 private void OnNpcExitZone(Zone zone, BaseNPC entity)
 {
     npcZones[entity]?.Remove(zone);
     if (HasZoneFlag(zone, ZoneFlags.NpcFreeze))
         npcNextTick.SetValue(entity, Time.time);
 }
Exemple #25
0
 /// <summary>
 /// Registers all the menu's and buttons on the npc.
 /// </summary>
 /// <param name="npc">Npc who to register with</param>
 protected internal override void OnRegister(BaseNPC npc)
 {
     RegisterDialog(npc, DialogType.EverydayConversation, new FunctionCallback(OnConversation));
 }
Exemple #26
0
 private void EnableEnemyRun(BaseNPC Sender)
 {
     IsAtTarget = false;
 }
Exemple #27
0
 /// <summary>
 /// Event method called when registering the npcfunction on the npc
 /// </summary>
 /// <param name="npc">Npc on who to register the function</param>
 protected internal virtual void OnRegister(BaseNPC npc)
 {
 }
Exemple #28
0
 /// <summary>
 /// Registers all dialogs for the npc.
 /// </summary>
 /// <param name="npc">Npc to hold the dialog</param>
 protected internal override void OnRegister(BaseNPC npc)
 {
     RegisterDialog(npc, DialogType.Market, new FunctionCallback(OnAuction));
     RegisterDialog(npc, DialogType.Market, 21, new FunctionCallback(OnAuctionOpen));
 }
Exemple #29
0
 /// <summary>
 /// Event method called when cashing dialog information
 /// </summary>
 /// <param name="npc">Npc on who to cache the function</param>
 /// <param name="name">Propertyname of the associated value</param>
 /// <param name="value">Value of the associated propertyname</param>
 protected internal virtual void OnCacheDialogInfo(BaseNPC npc, string name, uint value)
 {
 }
Exemple #30
0
 /// <summary>
 /// Registers all the menu's and buttons on the npc.
 /// </summary>
 /// <param name="npc">Npc who to register with</param>
 protected internal override void OnRegister(BaseNPC npc)
 {
     RegisterDialog(npc, DialogType.TradeItems, new FunctionCallback(OnTradeDialog));
     OnCacheTrader(npc);
 }
        /// <summary>
        /// Caches the shop items.
        /// </summary>
        /// <remarks>
        /// This will load all shop items from the data directory from read from
        /// file shops/cathelya.xml.
        /// </remarks>
        /// <param name="npc">Npc who requires caching</param>
        protected virtual void OnCacheShop(BaseNPC npc)
        {
            string filename = Server.SecurePath("~/shops/Catheleya.xml");

            _shoplist = ShopCollection.FromFile(filename);
        }
Exemple #32
0
        /// <summary>
        /// Caches the trader object form a file.
        /// </summary>
        /// <param name="npc"></param>
        protected virtual void OnCacheTrader(BaseNPC npc)
        {
            string filename = Server.SecurePath("~/traders/{0}.xml", npc.ModelId);

            _container = TradelistContainer.FromFile(filename);
        }
        /// <summary>
        /// Caches the shop
        /// </summary>
        /// <param name="npc">Npc who requires his shop to be cached</param>
        protected virtual void OnCacheShop(BaseNPC npc)
        {
            string filename = Server.SecurePath("~/bookstore/{0}.xml", npc.ModelId);

            _shoplist = BookstoreCollection.FromFile(filename);
        }
Exemple #34
0
        /// <summary>
        /// Checks if certain buttons should be visible.
        /// </summary>
        /// <param name="npc"></param>
        /// <param name="dialog"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        protected internal override bool OnCheckDialogIsVisible(BaseNPC npc, DialogType dialog, Character target)
        {
            bool PersonalQuest = false;
            bool OfficialQuest = false;
            bool ScenarioQuest = false;

            /*
             * System.Predicate<Saga.Quests.Objectives.ObjectiveList.Activation> pred = delegate(Saga.Quests.Objectives.ObjectiveList.Activation act)
             * {
             *  //act.Quest
             *  if (act.NpcId != npc.ModelId) return false;
             *  QuestBase baseQ = target.QuestObjectives[act.Quest];
             *  if( baseQ != null )
             *      switch (baseQ.questtype)
             *      {
             *          case 1: OfficialQuest = true; break;
             *          case 2: PersonalQuest = true; break;
             *          case 3: ScenarioQuest = true;break;
             *      }
             *  return true;
             * };*/

            System.Predicate <Saga.Quests.Objectives.ObjectiveList.Waypoint> FindActivatedQuests = delegate(Saga.Quests.Objectives.ObjectiveList.Waypoint objective)
            {
                if (objective.NpcId != npc.ModelId)
                {
                    return(false);
                }

                System.Predicate <Saga.Quests.Objectives.ObjectiveList.SubStep> FindSubstep = delegate(Saga.Quests.Objectives.ObjectiveList.SubStep substepobjective)
                {
                    return(substepobjective.Quest == objective.Quest &&
                           substepobjective.StepId == objective.StepId &&
                           substepobjective.SubStepId == objective.SubStepId);
                };

                if (target.QuestObjectives.Substeps.Find(FindSubstep).Completed == false)
                {
                    QuestBase baseQ = target.QuestObjectives[objective.Quest];
                    if (baseQ != null)
                    {
                        switch (baseQ.questtype)
                        {
                        case 1: OfficialQuest = true; break;

                        case 2: PersonalQuest = true; break;

                        case 3: ScenarioQuest = true; break;
                        }
                    }
                    return(true);
                }
                else
                {
                    return(false);
                }
            };


            uint val = 0;

            //target.QuestObjectives.ActivatedNpc.Find(pred);
            target.QuestObjectives.GuidancePoints.Find(FindActivatedQuests);
            switch (dialog)
            {
            case DialogType.PersonalQuest:
                return(PersonalQuest);

            case DialogType.OfficialQuest:
                return(OfficialQuest);

            case DialogType.ScenarioQuest:
                return(ScenarioQuest);

            case DialogType.AcceptPersonalRequest:
                return(target.client.AvailablePersonalRequests.TryGetValue(npc.ModelId, out val));

            default:
                return(true);
            }
        }
    void Awake()
    {
        //Korenova pozicia a rotacia
        initPosition = transform.position;
        initRotation = Quaternion.Euler(0f, transform.eulerAngles.y, 0f);
        deadNPC = false;
        goingHome = false;
        speed = 8;
        minAgro = 800;

        if (GameObject.Find("Player"))
        {
            target = GameObject.Find("Player");
            targetAnimator = target.GetComponent<Animator>();
            if (!targetAnimator)
            {
                Debug.LogError("Missing player animator!");
            }

            targetScript = target.GetComponent<BasePlayer>();
            if (!targetScript)
            {
                Debug.LogError("Missing BasePlayer script on player character!");
            }
        }
        else
        {
            Debug.LogError("No player founded!");
        }

        //Priradenie a kontrola komponent
        controller = GetComponent<CharacterController>();
        if (!controller)
        {
            Debug.LogError("Missing controller!");
        }

        animator = GetComponent<Animator>();
        if (!animator)
        {
            Debug.LogError("Missing animator!");
        }

        rigid = GetComponent<Rigidbody>();
        if (!rigid)
        {
            Debug.LogError("Missing rigidbody!");
        }
        rigid.constraints = RigidbodyConstraints.FreezeAll;

        baseNPC = GetComponent<BaseNPC>();
        if (!baseNPC)
        {
            Debug.LogError("Missing BaseNPC script!");
        }

        if (targetScript.storyCheckpoint >= 25 && targetScript.storyCheckpoint < 29)
        {
            gameObject.layer = 10;
        }
        else
        {
            gameObject.layer = 9;
        }
    }
 /// <summary>
 /// Occurs after the Event button is pressed.
 /// </summary>
 /// <param name="npc">Npc who called the event</param>
 /// <param name="target">Character who requirs interaction</param>
 protected virtual void OnEvents(BaseNPC npc, Character target)
 {
     Common.Actions.ShowEvents(target);
 }
Exemple #37
0
 public void TargetDied(BaseNPC Sender)
 {
     Sender.OnDeath -= TargetDied;
     Target          = null;
 }
Exemple #38
0
 public NPC(BaseNPC npc) : base(npc)
 {
     baseNPC = npc;
 }
Exemple #39
0
 /// <summary>
 /// Registers all the menu's and buttons on the npc.
 /// </summary>
 /// <param name="npc">Npc who to register with</param>
 protected internal override void OnRegister(BaseNPC npc)
 {
     RegisterDialog(npc, DialogType.LocationGuide, new FunctionCallback(OnLocationGuide));
     CacheLocations(npc);
 }
Exemple #40
0
    void Start()
    {
        //Korenova pozicia a rotacia
        initPosition = transform.position;
        initRotation = Quaternion.Euler(0f, transform.eulerAngles.y, 0f);
        goingHome = false;
        deadNPC = false;
        timer = 0f;
        finalDamage = 0;

        //Vyhladanie hraca
        if (GameObject.Find("Player"))
        {
            target = GameObject.Find("Player");
            targetAnimator = target.GetComponent<Animator>();
            if(!targetAnimator)
            {
                Debug.LogError("Missing player animator!");
            }

            targetScript = target.GetComponent<BasePlayer>();
            if (!targetScript)
            {
                Debug.LogError("Missing BasePlayer script on player character!");
            }
        } else
        {
            Debug.LogError("No player founded!");
        }

        if(!damageText)
        {
            Debug.LogError("Missing damageText!");
        }

        //Priradenie a kontrola komponent
        controller = GetComponent<CharacterController>();
        if(!controller)
        {
            Debug.LogError("Missing controller!");
        }

        animator = GetComponent<Animator>();
        if (!animator)
        {
            Debug.LogError("Missing animator!");
        }

        rigid = GetComponent<Rigidbody>();
        if(!rigid)
        {
            Debug.LogError("Missing rigidbody!");
        }
        rigid.constraints = RigidbodyConstraints.FreezeAll;

        navigation = transform.GetComponent<NavMeshAgent>();
        if(!navigation)
        {
            Debug.LogError("Missing NavMeshAgent!");
        }
        else
        {
            navigation.speed = speed;
            navigation.acceleration = 16f;
        }

        baseNPC = GetComponent<BaseNPC>();
        if (!baseNPC)
        {
            Debug.LogError("Missing BaseNPC script!");
        }
    }
Exemple #41
0
 /// <summary>
 /// Refreshes the bookstore
 /// </summary>
 /// <param name="npc">Target npc</param>
 protected internal override void OnRefresh(BaseNPC npc)
 {
     CacheLocations(npc);
 }
 public virtual void Open(Character character, BaseNPC basenpc, uint buttonId)
 {
 }