コード例 #1
0
ファイル: BaseCat.cs プロジェクト: kev-the-dev/CatSimulator
    // Load the cat from a previous save
    public void Load()
    {
        // Load personality, stats and style
        personality  = CatPersonality.Load();
        stats        = CatStats.Load();
        style        = CatStyle.Load();
        achievements = CatAchievements.Load();

        // Load cat pose
        Quaternion r = new Quaternion(PlayerPrefs.GetFloat("pose.r.x"),
                                      PlayerPrefs.GetFloat("pose.r.y"),
                                      PlayerPrefs.GetFloat("pose.r.z"),
                                      PlayerPrefs.GetFloat("pose.r.w"));
        Vector3 p = new Vector3(PlayerPrefs.GetFloat("pose.p.x"),
                                PlayerPrefs.GetFloat("pose.p.y"),
                                PlayerPrefs.GetFloat("pose.p.z"));

        gameObject.transform.SetPositionAndRotation(p, r);
        // TODO: color, other info

        Debug.Log("--- LOADED --");
        Debug.Log(personality);
        Debug.Log(stats);
        Debug.Log(style);
        Debug.Log("-------------");
    }
コード例 #2
0
 private void Awake()
 {
     catGen.GenerateCat();
     catStats = new CatStats();
     Danger.SetText("Danger");
     Hunger.SetText("Hunger");
     Dirty.SetText("Dirtiness");
     Sleep.SetText("Sleepiness");
 }
コード例 #3
0
ファイル: BaseCat.cs プロジェクト: kev-the-dev/CatSimulator
 // Called when there is no save to generate a new random cat
 public void CreateNew()
 {
     // Initialize stats for a completely content cat
     stats = new CatStats();
     // Initialize personality to random values
     personality = CatPersonality.RandomPersonality();
     // Initialize the style to random color
     style = CatStyle.RandomStyle();
     // Initialize no achievements
     achievements = new CatAchievements();
 }
コード例 #4
0
ファイル: StateController.cs プロジェクト: Amy-Liz/Cat_Game
    // Use this for initialization
    void Start()
    {
        navMeshAgent         = GetComponent <NavMeshAgent>();
        navMeshAgent.enabled = true;
        aiActive             = true;
        catStats             = new CatStats(catName, favToy);

        if (gameObject.tag == "Timid")
        {
            catStats.isDistressed = true;
        }
    }
コード例 #5
0
    public Context(GameObject _parentCat, ref CatPersonality _personality, ref CatStats _stats, ref CatActivity _activity)
    {
        parentCat   = _parentCat;
        personality = _personality;
        stats       = _stats;
        activity    = _activity;

        //Debug.Log("In Context constructor: ");
        //Debug.Log(personality);
        //Debug.Log(stats);
        //Debug.Log(activity);
        //Debug.Log("Exiting Context constructor.");
    }
コード例 #6
0
    private void UpdateBools(CatStats current)
    {
        Debug.Log("agent: " + current.name);

        current.isDistressed = true;

        if (current.hasToy)
        {
            current.hasToy = false;
        }

        if (current.hasFavToy)
        {
            current.hasFavToy = false;
        }

        if (current.hasTreat)
        {
            current.hasTreat = false;
        }
    }
コード例 #7
0
    // Should be called at each update loop. Update cat stats based on time passing
    public void UpdateStats(ref CatStats stats, CatActivity activity, float dt)
    {
        // Update bond
        stats.Bond += dt * bond_increase_per_second * stats.bond_buff.Value;
        // TODO: lower bond if cat is extreamly unhappy?
        stats.Bond += dt * bond_increase_per_happieness_per_second * stats.bond_buff.Value;

        if (CatActivityEnum.BeingPet == activity.current)
        {
            stats.Bond += dt * bond_increase_when_being_pet_per_second * stats.bond_buff.Value;
        }

        // Update fullness
        if (CatActivityEnum.Eating == activity.current)
        {
            stats.Fullness += dt * fullness_increase_when_eating_per_second * stats.fullness_buff.Value;
        }
        else
        {
            stats.Fullness -= dt * fullness_decrease_per_second * stats.fullness_debuff.Value;
        }

        // Update energy
        if (CatActivityEnum.Sleeping == activity.current)
        {
            stats.Energy += dt * energy_increase_when_sleeping_per_second * stats.energy_buff.Value;
        }
        else
        {
            stats.Energy -= dt * energy_decrease_per_second * stats.energy_debuff.Value;
        }

        // Update fun
        if (CatActivityEnum.Playing == activity.current)
        {
            stats.Fun  += dt * fun_increase_when_playing_with_yarn_per_second * stats.fun_buff.Value;
            agent.speed = 7F;
        }
        else if (CatActivityEnum.FollowingLaser == activity.current)
        {
            stats.Fun  += dt * fun_increase_when_following_laser_per_second * stats.fun_buff.Value;
            agent.speed = 7F;
        }
        else if (CatActivityEnum.OnCatnip == activity.current)
        {
            stats.Fun  += dt * fun_increase_when_on_catnip_per_second * stats.fun_buff.Value;
            agent.speed = 7F;
        }
        else
        {
            stats.Fun  -= dt * fun_decrease_per_second * stats.fun_debuff.Value;
            agent.speed = 3.5F;
        }

        // Update hygiene
        if (CatActivityEnum.BeingBrushed == activity.current)
        {
            stats.Hygiene += dt * hygiene_increase_when_being_brushed_per_second * stats.hygiene_buff.Value * 0.5f;            //Added in 0.2 multiplier for brushing for VR Conversion :) 6/12/19
        }
        else
        {
            // If cat is using the litterbox, its hygiene stat decays twice as fast
            if (CatActivityEnum.UsingLitterbox == activity.current)
            {
                stats.hygiene_debuff.Value = 2;
                stats.Hygiene -= dt * hygiene_decrease_per_second * stats.hygiene_debuff.Value;
            }
            else
            {
                stats.hygiene_debuff.Value = CatStats.DEFAULT_BUFF_VALUE;
                stats.Hygiene -= dt * hygiene_decrease_per_second * stats.hygiene_debuff.Value;
            }
        }

        // Update bladder
        if (CatActivityEnum.UsingLitterbox == activity.current)
        {
            stats.Bladder += dt * bladder_increase_when_using_litter_box_per_second * stats.bladder_buff.Value;
        }
        else
        {               // If cat is eating, its bladder stat decays twice as fast
            if (CatActivityEnum.Eating == activity.current)
            {
                stats.bladder_debuff.Value = 2;
                stats.Bladder -= dt * bladder_decrease_per_second * stats.bladder_debuff.Value;
            }
            else
            {
                stats.bladder_debuff.Value = CatStats.DEFAULT_BUFF_VALUE;
                stats.Bladder -= dt * bladder_decrease_per_second * stats.bladder_debuff.Value;
            }
        }
    }
コード例 #8
0
ファイル: CatUI.cs プロジェクト: claretan44/CS191Project
 void Start()
 {
     stats = GetComponent<CatStats>();
 }
コード例 #9
0
 void Start()
 {
     stats = GetComponent <CatStats>();
 }