// Use this for initialization void Start() { if (code == null) { code = gameObject.GetComponent <MainObject>().script; } Compiler.setCode(code); Compiler.compile(); _ip = new Interpretor(); _ip.setICode(Compiler.getICode()); _ip.init(); //-Debug.Log(code); //animation setup// anim = GetComponent <Animator>(); if (anim == null) { anim = GetComponentInChildren <Animator>(); } if (controller == null) { controller = GetComponent <CharacterController>(); } if (controller == null) { controller = GetComponentInChildren <CharacterController>(); } stats = gameObject.GetComponent <AnimalStats>(); //stats.setType(0); }
public Animal(Intelligence intel, AnimalStats stats, double width, double height) : base(intel, width, height) { Stats = stats; Stamina = Stats.MaxStamina; VisibleAnimal = new VisibleAnimal(this); }
private void GenerateRandomSpawn(AnimalStats currentAnimalStats) { GameObject animalCreated; Vector2 spawnPoint = GenerateRandomSpawnPoint(); animalCreated = Instantiate(_animalPrefab, spawnPoint, Quaternion.identity, _animalsParent); animalCreated.GetComponent <Animal>().stats = currentAnimalStats; }
// Use this for initialization void Start() { //player = Data. controller = gameObject.GetComponent <CharacterController>(); head = GameObject.Find(gameObject.name + "/head"); stats = this.GetComponent <AnimalStats>(); }
public StateBase(AnimalAIController controller, AnimalStats stats, Animator animator, NavMeshAgent navMeshAgent) { animalController = controller; animalStats = stats; currentAnimator = animator; currentNavAgent = navMeshAgent; CurrentStageEvent = Event.Enter; }
//end of editor launch functions// void loadAnimal(int index) { GameObject obj = Data.objects[index]; obj.AddComponent <AnimalAnimation>(); AnimalStats aStats = obj.AddComponent <AnimalStats>(); aStats.setType(obj.GetComponent <MainObject>().model); }
void animal() { string code = "while(1<3){walk 10 left 90;}"; //Data.currentCode = code; GameObject animal = GameObject.Instantiate(Data.files[0].file); AnimalAnimation _aa = animal.AddComponent <AnimalAnimation>(); AnimalStats __as = animal.AddComponent <AnimalStats>(); __as.setType(0); }
// Use this for initialization void Start() { controller = gameObject.GetComponent <CharacterController>(); animal = gameObject.ToString().Replace("(Clone)", "").Replace("UnityEngine.GameObject", ""); head = GameObject.Find(gameObject.name + "/head"); Debug.Log(head.name); stats = this.GetComponent <AnimalStats>(); }
public AnimalStatus(AnimalData data, AnimalStats stats, List <Need> needs, Transform self, SpriteRenderer mood, Transform body) { Technet99m.TickingMachine.EveryTick += OnTick; this.data = data; this.stats = stats; this.needs = needs; this.self = self; this.mood = mood; this.body = body; OnTick(); }
// Use this for initialization void Start() { if (code == null) { code = gameObject.GetComponent <MainObject>().script; } Compiler.setCode(code); Compiler.compile(); _ip = new Interpretor(); _ip.setICode(Compiler.getICode()); _ip.init(); //animation setup// anim = GetComponent <Animator>(); if (anim == null) { anim = GetComponentInChildren <Animator>(); } if (controller == null) { controller = GetComponent <CharacterController>(); } if (controller == null) { controller = GetComponentInChildren <CharacterController>(); } stats = gameObject.GetComponent <AnimalStats>(); _speed = stats.walk_speed; //stats.setType(0); //TMP fun animation// vision = gameObject.GetComponent <VisionScript2>(); if (vision == null) { vision = gameObject.AddComponent <VisionScript2>(); } vision.setSpeed(stats.walk_speed); vision.setTurnSpeed(stats.turn_speed); vision.enabled = false; //add libraries.// SensingLib sl = gameObject.AddComponent <SensingLib>(); sl.setInterpretor(_ip); //audio setup// audioSetup(); //tmp code tantest(); }
public void DisplayCurrentAnimalStats(AnimalStats currentStats, GameObject currentAnimalGameObject) { _currentAnimalStats = currentStats; _currentAnimalGameObject = currentAnimalGameObject; _needsGarden.text = (currentStats.HasGarden) ? ("Oui") : ("Non"); _goodWithChildren.text = (currentStats.HasChildren) ? ("Oui") : ("Non"); _bestHomeType.text = currentStats.HouseType.ToString(); _monthlyCost.text = currentStats.Cost.ToString(); _goodWithOtherAnimals.text = (currentStats.HasOtherAnimals) ? ("Oui") : ("Non"); _animalPersonality.text = currentStats.AnimalPersonality.ToString(); _canvasGroup.alpha = 1f; _buttonsCanvasGroup.alpha = 1f; }
public void ChooseAnimal(bool hasChosen, AnimalStats animalStats) { if (hasChosen) { _manager.placedAnimals.Add(animalStats, currentClient); } if (_manager.placedAnimals.Count == _manager.animals.Count) { EndGame(); } ChooseRandomClient(); _switchClientParc.Switch(); }
private void GenerateAnimalClientPair(int maxAnimals) { AnimalStats newAnimal; ClientStats newClient; for (int index = 0; index < maxAnimals; index += 1) { newAnimal = new AnimalStats(); newClient = new ClientStats(newAnimal.HouseType, newAnimal.HasGarden, newAnimal.HasChildren, newAnimal.HasOtherAnimals, Random.Range(newAnimal.Cost, 2000), newAnimal.AnimalPersonality); _manager.animals.Add(newAnimal); _manager.clients.Add(newClient); } GenerateOtherClients(maxAnimals); }
public static Animal NewAnimalOfKind(string kind, Transform parent, bool IgnoreName = false) { if (AnimalRef == null) { AnimalRef = Resources.Load <GameObject>("Animal"); } Animal animal = Object.Instantiate(AnimalRef, parent).GetComponent <Animal>(); AnimalStats tmp = Resources.Load <AnimalStats>($"Animals/{kind}/Stats"); animal.Initialize(tmp); animal.GetComponent <AnimalAnimationController>().sprites = Resources.Load <AnimalSprites>($"Animals/{kind}/Sprites"); if (IgnoreName) { return(animal); } PlayerPrefs.SetInt(nameKey + kind, PlayerPrefs.GetInt(nameKey + kind, 0) + 1); animal.data.name = kind + " #" + PlayerPrefs.GetInt(nameKey + kind); return(animal); }
public void SetUp(string kind) { AnimalStats stats = Resources.Load <AnimalStats>($"Animals/{kind}/Stats"); foreach (var f in stats.foods) { foods[(int)f].SetActive(true); } foreach (var s in stats.specials) { specials[(int)s].SetActive(true); } Name.text = stats.kind; Icon.sprite = Resources.Load <Sprite>($"Animals/{kind}/Icon"); Price.text = stats.price.ToString(); preg.text = Translator.TicksToTime(stats.TicksToBorn); grow.text = Translator.TicksToTime(stats.TicksToFullMate); children.text = stats.minChildren == stats.maxChildren ? $"{stats.minChildren}" : $"{stats.minChildren}-{stats.maxChildren}"; }
private int ComputeCurrentAnimalClientPairPrefectStats(AnimalStats animal, ClientStats client) { int numberPerfectStats = 0; if (client.ClientPersonality != ClientPersonality.Bad) { if (animal.HouseType == client.HouseType) { numberPerfectStats += 1; } if (animal.HasGarden == client.HasGarden) { numberPerfectStats += 1; } if (animal.HasChildren == client.HasChildren) { numberPerfectStats += 1; } if (animal.HasOtherAnimals == client.HasOtherAnimals) { numberPerfectStats += 1; } if (animal.Cost <= client.Income) { numberPerfectStats += 1; } if (animal.AnimalPersonality == client.AnimalPersonalityWanted) { numberPerfectStats += 1; } } else { numberPerfectStats = -1; } return(numberPerfectStats); }
public MoveToNextAreaState(AnimalAIController controller, AnimalStats animalStats, Animator animator, NavMeshAgent navMeshAgent) : base(controller, animalStats, animator, navMeshAgent) { CurrentStateName = States.MoveToNextArea; }
public IdleState(AnimalAIController controller, AnimalStats animalStats, Animator animator, NavMeshAgent navMeshAgent) : base(controller, animalStats, animator, navMeshAgent) { CurrentStateName = States.Idle; }
// Use this for initialization void Start() { animalStats = gameObject.GetComponent <AnimalStats>(); }
private void ApplyUpgrades(AnimalStats stats, int stage) { }
public WalkAroundState(AnimalAIController controller, AnimalStats animalStats, Animator animator, NavMeshAgent navMeshAgent) : base(controller, animalStats, animator, navMeshAgent) { CurrentStateName = States.WalkAround; }