コード例 #1
0
        public override void FrameFeed()
        {
            if (characterInventory == null)
            {
                characterInventory = agent.RequestComponent <CharacterInventoryComponent>();
                throwTrajectory    = agent.RequestComponent <TrajectoryGizmo>();
                return;
            }

            if (characterInventory.HasItem(arrow))
            {
                if (InputConfig.Aim())
                {
                    Aim();
                }
                else if (InputConfig.ActionUp())
                {
                    ThrowArrow();
                    characterInventory.UseItem(arrow);
                }
                else
                {
                    ResetAim();
                }
            }
            else
            {
                ResetAim();
            }
        }
コード例 #2
0
        public override void FrameFeed()
        {
            if (characterInventory == null)
            {
                characterInventory = agent.RequestComponent <CharacterInventoryComponent>();
                return;
            }

            ConsumableType smokeItem = ConsumableType.Bomb;

            if (InputConfig.SmokeBomb() && characterInventory.HasItem(smokeItem))
            {
                characterInventory.UseItem(smokeItem);
                Fire();
            }
        }
コード例 #3
0
        public override void FrameFeed()
        {
            if (characterInventory == null)
            {
                characterInventory = agent.RequestComponent <CharacterInventoryComponent>();
                return;
            }

            ConsumableAgent[] resources = Resources.FindObjectsOfTypeAll <ConsumableAgent>();

            foreach (ConsumableAgent ctb in resources)
            {
                float distance = Vector3.Distance(ctb.WorlPos, agent.WorlPos);
                if (ctb.gameObject.activeInHierarchy && distance < agent.collectorRange)
                {
                    if (characterInventory.HasSpace(ctb.Item))
                    {
                        ctb.Collect(this);
                    }
                    return;
                }
            }
        }