예제 #1
0
    internal bool CanBuildHouse()
    {
        if (!agentBehaviours)
        {
            agentBehaviours = gameObject.GetComponent <AgentBehaviourLibrary>();
        }

        return(agentBehaviours.HasRock() && agentBehaviours.IsGoingHome);
    }
예제 #2
0
    internal bool CanBuildBridge()
    {
        if (!agentBehaviours)
        {
            agentBehaviours = gameObject.GetComponent <AgentBehaviourLibrary>();
        }

        return(agentBehaviours.HasRock() && agentBehaviours.IsBuildingBridge);
    }
예제 #3
0
    void Awake()
    {
        if (agentBehaviours == null)
        {
            agentBehaviours = gameObject.GetComponent <AgentBehaviourLibrary>();
        }

        if (timeDistribution = null)
        {
            timeDistribution = gameObject.transform.parent.GetComponent("TimeDistribution") as TimeDistribution;
        }
    }
예제 #4
0
    // Update is called once per frame
    void Update()
    {
        transform.rotation = Quaternion.Euler(90, 0, 0);

        if (agentBehaviours.Home == null)
        {
            FindHouse();
        }
        if (!agentBehaviours)
        {
            agentBehaviours = gameObject.GetComponent <AgentBehaviourLibrary>();
        }

        ChangeWorkIndex();
        CheckIfAlive();
        UpdateStamina();
        ActionSelection();
    }
예제 #5
0
    // Use this for initialization
    void Start()
    {
        numberOfBots = numberOfBots + 1;
        botNumber    = numberOfBots;

        agentsManager   = transform.parent.gameObject;
        agentBehaviours = gameObject.GetComponent <AgentBehaviourLibrary>();

        timeDistribution = gameObject.transform.parent.GetComponent("TimeDistribution") as TimeDistribution;
        dateBorn         = timeDistribution.DaysPassed;

        nextStaminaUpdate = timeDistribution.TimeInDay;
        staminaUpdateTime = timeDistribution.TimeInDay / 1.75f;

        SetRandomAge();
        defaultColor = new Color(0, 1, 1, 1);
        GetComponent <SpriteRenderer>().color = defaultColor;

        worksIndex = Random.Range(-2, 3) + 1;

        FindHouse();

        agentBehaviours.SetBotNumber(botNumber);
    }