Example #1
0
    void UpdateNight()
    {
        if (updateElapsed < updateGoal)
        {
            return;
        }

        updateElapsed -= UnityEngine.Random.Range(updateGoal * 0.5f, updateGoal * 2f);

        // Breeding and sacrificing

        // Checking to see if you are flagged for sacrifice
        if (isSacrificable)
        {
            GameObject house = BehaviourUtil.NearestObjectByTag(this.gameObject, "House", 10);
            if (house != null)
            {
                role = "Virginy";
                SetAppearance();
                // Set Destination for sacrifice tablet
                altar = GameObject.Find("Altar");
                navMe.SetDestination(altar.transform.position);
            }
        }
        else
        {
            // Checking to see if you are culty to go do culty stuffs
            if (culty > 0)
            {
                GameObject house = BehaviourUtil.NearestObjectByTag(this.gameObject, "House", 10);
                if (house != null)
                {
                    GameObject altar = GameObject.Find("Altar");
                    navMe.SetDestination(altar.transform.position);
                }
            }
            else
            {
                if (Count < 100)
                {
                    // Checking to see if opposite gender is close by (3-5) to breed
                    GameObject house = BehaviourUtil.NearestObjectByTag(this.gameObject, "House", 10);
                    if (house != null)
                    {
                        ArrayList entities = BehaviourUtil.SurroundingObjectsByTag(this.gameObject, "Entity", 5);
                        if (entities != null)
                        {
                            foreach (GameObject obj in entities)
                            {
                                EntityBehaviour ent = obj.GetComponent <EntityBehaviour>();
                                if (ent != null)
                                {
                                    if (ent.sex != sex)
                                    {
                                        if (!sex)
                                        {
                                            if (canBreed && Baby != null)
                                            {
                                                // Make baby
                                                canBreed = !canBreed;
                                                Instantiate(Baby, transform.position, new Quaternion());
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        updateElapsed += Time.deltaTime;

        if (DayNightCycle.Cycle.dayElapsed > DayNightCycle.Cycle.dayStart && DayNightCycle.Cycle.dayElapsed < DayNightCycle.Cycle.dayLength)
        {
            if (!isDay)
            {
                isDay = true;
                SetTarget();

                if (isBaby)
                {
                    ++daysAsChild;
                    UpdateChild();
                }
            }
            if (!isBaby)
            {
                UpdateDay();
            }
        }
        else
        {
            if (isDay)
            {
                isDay = false;
                SetTarget();
            }
            if (!isBaby)
            {
                UpdateNight();
            }

            if (isSacrificable)
            {
                // If at sacrifice sacrific, and gain faiths!
                Vector3 delta = transform.position - altar.transform.position;
                Debug.Log(delta.magnitude);
                if (delta.magnitude <= 10) // Ideally 20, but 170 is the weirdness we are suffering through
                {
                    Debug.Log("I want to sacrifice myself");
                    // Handle the sacrifice shit.
                    ArrayList cultists = BehaviourUtil.SurroundingObjectsByTag(this.gameObject, "Entity", 20);
                    // Reward faith based on number of cultists present
                    if (cultists.Count > 0)
                    {
                        Faith.CurrentFaith += Faith.sacrificeGain * cultists.Count;

                        AudioHandler.Instance.PlayVoiceOver(AudioHandler.VoiceOvers.WILHELMSCREAM);

                        --Count;
                        Destroy(this.gameObject);
                    }
                }
            }
        }

        if (target == null)
        {
            UpdateNodes();
            SetTarget();
        }
    }