コード例 #1
0
    public void Initialize(Vector3 startLoc_in, CitizenBehavior citizen_in)
    {
        citizen = citizen_in;

        gameObject.GetComponent <Renderer>().enabled = true;

        eradicating        = false;
        endpoint1          = startLoc_in;
        transform.position = INITIALLOC;
        endpoint2          = transform.position;

        Pivot(endpoint2);
    }
コード例 #2
0
    public void Initialize(Vector3 startLoc_in, CitizenBehavior citizen_in)
    {
        citizen = citizen_in;

        gameObject.GetComponent<Renderer>().enabled = true;

        eradicating = false;
        endpoint1 = startLoc_in;
        transform.position = INITIALLOC;
        endpoint2 = transform.position;

        Pivot (endpoint2);
    }
コード例 #3
0
    /* xAssign
     *  called by citizens (usually when dropped) to update task
     *  attributes and possibly start production
     *
     *  base class works for 1 citizen*/
    public virtual void Assign(GameObject citizen_in)
    {
        if (citizen1 == null)
        {
            citizen1       = citizen_in;
            citizen1Script = citizen1.GetComponent <CitizenBehavior>();
            citizen1.transform.position = slot1Loc;
        }
        else
        {
            //FIXFIX return to sender
        }

        //If possible, activate workstation
        Activate();
    }
コード例 #4
0
    public void Drop()
    {
        dragging = false;

        if (currentProspect != null)
        {
            CitizenBehavior citizen = currentProspect.GetComponent <CitizenBehavior>();
            citizen.FeedCaterpillar();

            GameObject.Find("CreatureManager").GetComponent <CreatureManager_Script>().DestroyCaterpillar(gameObject);
            //GameObject.Instantiate (caterpillarPrefab, new Vector3(0f, -.2f, 0f), Quaternion.identity);


            //Destroy (this.gameObject);
        }
        else
        {
            transform.position = oldLoc;
        }
    }
コード例 #5
0
    // Update is called once per frame
    void Update()
    {
        /*
         * if (selectedCitizen == null)
         * {
         *  if (gameController.selectedCitizen != null)
         *  {
         *      selectedCitizen = gameController.selectedCitizen;
         *      UpdateSelection();
         *  }
         * }
         * else if (selectedCitizen != gameController.selectedCitizen)
         * {
         *  selectedCitizen = gameController.selectedCitizen;
         *  UpdateSelection();
         * }*/

        if (selectedCitizen != gameController.selectedCitizen)
        {
            selectedCitizen = gameController.selectedCitizen;
            citizenScript   = selectedCitizen.GetComponent <CitizenBehavior>();

            if (attribute != Utilities.Attributes.Health && attribute != Utilities.Attributes.Happiness && attribute != Utilities.Attributes.Recovery)
            {
                icon.enabled = true;
            }

            UpdateSelection();
        }

        if (selectedCitizen != null)
        {
            UpdateIcon();

            if (currentValue != citizenScript.currentAttributes[attribute])
            {
                UpdateSelection();
            }
        }
    }
コード例 #6
0
    // Update is called once per frame
    void Update()
    {
        /*
        if (selectedCitizen == null)
        {
            if (gameController.selectedCitizen != null)
            {
                selectedCitizen = gameController.selectedCitizen;
                UpdateSelection();
            }
        }
        else if (selectedCitizen != gameController.selectedCitizen)
        {
            selectedCitizen = gameController.selectedCitizen;
            UpdateSelection();
        }*/

        if (selectedCitizen != gameController.selectedCitizen)
        {
            selectedCitizen = gameController.selectedCitizen;
            citizenScript = selectedCitizen.GetComponent<CitizenBehavior>();

            if (attribute != Utilities.Attributes.Health && attribute != Utilities.Attributes.Happiness && attribute != Utilities.Attributes.Recovery)
                icon.enabled = true;

            UpdateSelection();
        }

        if (selectedCitizen != null)
        {

            UpdateIcon();

            if (currentValue != citizenScript.currentAttributes[attribute])
            {
                UpdateSelection();
            }
        }
    }
コード例 #7
0
    /* xUnassign
     * called by citizens when they are attempting to be
     * assigned elsewhere - may stop production as well*/
    public virtual void Unassign(GameObject citizen_in)
    {
        if (citizen1 != null && citizen_in == citizen1)
        {
            citizen1       = null;
            citizen1Script = null;
        }
        else if (citizen2 != null && citizen_in == citizen2)
        {
            citizen2       = null;
            citizen2Script = null;
        }
        else
        {
            print("ERROR IN WORKSTATION UNASSIGN: CITIZEN NOT ASSIGNED TO THIS WORKSTATION");
        }

        if (citizen1 == null && citizen2 == null)
        {
            Deactivate();
        }
    }