コード例 #1
0
ファイル: Agent.cs プロジェクト: RecklessCoding/SubGame
    internal void StarNewWork(int workIndex)
    {
        try
        {
            if (workIndex == 3)
            {
                isNight = true;
            }
            else
            {
                isNight = false;
            }

            if ((gameObject != null) && (agentActionsHandler != null))
            {
                agentActionsHandler.StarNewWork(workIndex);
            }
            else
            {
                agentActionsHandler = new AgentActionsHandler(agentPathfinding, agentResources);
                agentActionsHandler.StarNewWork(workIndex);
            }
        }
        catch (System.Exception e) // REALLY BAD FIX!
        {
            Debug.LogError(e);
        }
    }
コード例 #2
0
ファイル: Agent.cs プロジェクト: RecklessCoding/SubGame
    void Update()
    {
        CheckIfAlive();

        if (agentActionsHandler != null)
        {
            agentActionsHandler.PerformActionSelection();
        }
        else
        {
            agentActionsHandler = new AgentActionsHandler(agentPathfinding, agentResources);
            agentActionsHandler.PerformActionSelection();
        }

        UpdateStamina();
    }
コード例 #3
0
ファイル: Agent.cs プロジェクト: RecklessCoding/SubGame
    void Start()
    {
        defaultColor = new Color(0, 1, 1, 1);
        GetComponent <SpriteRenderer>().color = defaultColor;

        agentPathfinding    = gameObject.GetComponent("NavMeshAgentPath") as NavMeshAgentPath;
        agentActionsHandler = new AgentActionsHandler(agentPathfinding, agentResources);

        agentsManager = transform.parent.gameObject;

        ResetToDefaultValues();

        dateBorn = (agentsManager.GetComponent("TimeDistribution") as TimeDistribution).DaysPassed;

        SetRandomAge();
    }