Example #1
0
    void Start()
    {
        ResourceGather resource = GetComponent <ResourceGather>();

        if (resource)
        {
            mTasks.Add(new ResourceGatherTask(gameObject));
        }

        GameItem item = GetComponent <GameItem>();

        if (item)
        {
            mTasks.Add(new PickUpItemTask(gameObject));
        }

        Bed bed = GetComponent <Bed>();

        if (bed)
        {
            mTasks.Add(new SleepTask(gameObject));
        }

        GameBuilding building = GetComponent <GameBuilding>();

        if (building)
        {
            mTasks.Add(new DeconstructTask(gameObject));
        }

        mGameArea = GetComponent <GameArea>();
        mTasks.Add(new MoveTask(transform.position));
        mMoveActionIndex = mTasks.Count - 1;
    }
    public ResourceGatherTask(GameObject target) : base(Task.Action.ResourceGather)
    {
        this.target   = target;
        this.position = target.transform.position;
        this.hardness = 1f;

        mResource = target.GetComponent <ResourceGather>();
    }