コード例 #1
0
ファイル: DummyPNJ.cs プロジェクト: Titwin/TinyWorld
    void Start()
    {
        controller  = GetComponent <CharacterController>();
        animator    = GetComponent <Animator>();
        audiosource = GetComponent <AudioSource>();
        animator.runtimeAnimatorController = animatorOverrideController;
        clipOverrides = new AnimationClipOverrides(animatorOverrideController.overridesCount);
        animatorOverrideController.GetOverrides(clipOverrides);
        pivot.SetActive(true);

        if (horse)
        {
            horse.Equip(horse.equipedItem.type, true);
        }
        weapon.Equip(weapon.equipedItem.type, true);
        secondHand.Equip(secondHand.equipedItem.type, true);
        head.Equip(head.equipedItem.type, true);
        shield.Equip(shield.equipedItem.type, true);

        bool mounted = horse ? horse.equipedItem.type != HorseItem.Type.None : false;

        body.Equip(body.equipedItem.type, mounted, true);
        backpack.Equip(backpack.equipedItem.type, true);

        AnimationParameterRefresh();
        animator.SetFloat("loadFactor", 1f);
        target = interestPoints[interestIndex].location;

        nameLabel.text = pnjName;
    }
コード例 #2
0
    void Start()
    {
        OnValidate();

        animatorOverrideController         = new AnimatorOverrideController(animator.runtimeAnimatorController);
        animator.runtimeAnimatorController = animatorOverrideController;
        clipOverrides = new AnimationClipOverrides(animatorOverrideController.overridesCount);
        animatorOverrideController.GetOverrides(clipOverrides);
        emitParams = new ParticleSystem.EmitParams();

        if (equipOnStart)
        {
            weapon.Equip(character.mainWeapon, true);
            secondHand.Equip(character.SecondaryWeapon, true);
            head.Equip(character.head, true);
            shield.Equip(character.shield, true);
            body.Equip(character.body, true);
            backpack.Equip(character.backpack, true);
        }
        attacking = false;
        AnimationParameterRefresh();
    }
コード例 #3
0
    void Start()
    {
        eventsystem = (EventSystem)FindObjectOfType(typeof(EventSystem));
        controller  = GetComponent <CharacterController>();
        animator    = GetComponent <Animator>();
        animator.runtimeAnimatorController = animatorOverrideController;
        clipOverrides = new AnimationClipOverrides(animatorOverrideController.overridesCount);
        animatorOverrideController.GetOverrides(clipOverrides);

        attacking  = false;
        emitParams = new ParticleSystem.EmitParams();

        if (horse)
        {
            horse.Equip(horse.equipedItem.type, true);
        }
        weapon.Equip(weapon.equipedItem.type, true);
        secondHand.Equip(secondHand.equipedItem.type, true);
        head.Equip(head.equipedItem.type, true);
        shield.Equip(shield.equipedItem.type, true);

        bool mounted = horse ? horse.equipedItem.type != HorseItem.Type.None : false;

        body.Equip(body.equipedItem.type, mounted, true);
        backpack.Equip(backpack.equipedItem.type, true);
        inventory.capacity = backpack.equipedItem.capacity;

        AnimationParameterRefresh();

        // HACK FOR DEBUG
        if (!initialized)
        {
            initialized = true;
            //interactionController.EquipInteraction(InteractionType.Type.pickableBackpack, Arsenal.Instance.Get(BackpackItem.Type.AdventureBackpack).gameObject);

            /*interactionController.inventory.AddItem(ResourceDictionary.instance.GetResourceItem("Wood"), 3);
             * interactionController.inventory.AddItem(ResourceDictionary.instance.GetResourceItem("Stone"), 3);
             * interactionController.inventory.AddItem(ResourceDictionary.instance.GetResourceItem("Iron"), 5);
             * interactionController.inventory.AddItem(ResourceDictionary.instance.GetResourceItem("Gold"), 5);
             * interactionController.inventory.AddItem(ResourceDictionary.instance.GetResourceItem("Crystal"), 5);
             * interactionController.inventory.AddItem(ResourceDictionary.instance.GetResourceItem("Wheat"), 6);*/

            interactionController.inventory.AddItem(Arsenal.Instance.Get(WeaponItem.Type.FireSword).Summarize(), 1);
            interactionController.inventory.AddItem(Arsenal.Instance.Get(WeaponItem.Type.ElectricSword).Summarize(), 1);
        }
    }