private void Awake() { perceptor = GetComponentInChildren <Perceptor>(); animalMovement = GetComponent <AnimalMovement>(); communicator = GetComponentInChildren <BehaviourCommunicator>(); sexuality = GetComponent <Sexuality>(); }
public void SetupVars() { rigid = GetComponent <Rigidbody2D>(); animalMovement = GetComponent <AnimalMovement>(); animalLife = GetComponent <AnimalLife>(); animalTooltip = GetComponent <AnimalTooltip>(); animalArt = GetComponent <AnimalArt>(); animalAudio = GetComponent <AnimalAudio>(); animalEffect = GetComponent <AnimalEffect>(); animalKnockback = GetComponent <AnimalKnockback>(); }
void CreateChildObject(Material main, Material second, GameObject parent1, GameObject parent2) { GameObject Child = new GameObject(); AnimalStatistics stats = Child.AddComponent <AnimalStatistics>(); AnimalMovement move = Child.AddComponent <AnimalMovement>(); BoxCollider coll = Child.AddComponent <BoxCollider>(); GameObject[] BodyParts = new GameObject[4]; for (int i = 0; i < 4; ++i) { BodyParts[i] = (Random.value < 0.5f ? parent1.transform.GetChild(i).gameObject : parent2.transform.GetChild(i).gameObject); } GameObject Body = Instantiate(BodyParts[0]); Body.transform.parent = Child.transform; GameObject NewPart; MeshRenderer TempMeshRend = Body.GetComponent <MeshRenderer>(); ApplyMaterial(main, second, TempMeshRend); for (int i = 1; i < 4; ++i) { NewPart = Instantiate(BodyParts[i]); NewPart.transform.parent = Child.transform; NewPart.transform.position = Body.transform.GetChild(i - 1).position; if (i == 2) { for (int j = 0; j < NewPart.transform.childCount; ++j) { TempMeshRend = NewPart.transform.GetChild(j).GetComponent <MeshRenderer>(); ApplyMaterial(main, second, TempMeshRend); } } else { TempMeshRend = NewPart.GetComponent <MeshRenderer>(); ApplyMaterial(main, second, TempMeshRend); } } PassInNewGeneralStats(ref stats, parent1.GetComponent <AnimalStatistics>(), parent2.GetComponent <AnimalStatistics>()); PassInNewCollider(ref coll, (Random.value < 0.5f ? parent1.GetComponent <BoxCollider>() : parent2.GetComponent <BoxCollider>())); PassInNewMoveVars(ref move, (Random.value < 0.5f ? parent1.GetComponent <AnimalMovement>() : parent2.GetComponent <AnimalMovement>())); Child.tag = (Random.value < 0.5f ? parent1.tag : parent2.tag); Child.transform.position = (parent1.transform.position + parent2.transform.position) / 2f; }
public async Task MoveAnimalAsync(AnimalMovement movement) { var animalState = AnimalStates[movement.AnimalName]; if (animalState.EnclosureName != movement.NewEnclosureName) { animalState.EnclosureName = movement.NewEnclosureName; await PublishEventAsync(new AnimalMovedEvent { AnimalName = movement.AnimalName, EnclosureName = movement.NewEnclosureName }); } }
public static Task MoveAnimal( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "game/{gameName}/move-animal")] MoveAnimalCommand command, [DurableClient] IDurableEntityClient client, string gameName) { var movement = new AnimalMovement { AnimalName = command.AnimalName, NewEnclosureName = command.EnclosureName }; var entityId = new EntityId(nameof(GameSession), gameName); return(client.SignalEntityAsync <IGameSession>(entityId, proxy => proxy.MoveAnimalAsync(movement))); }
void Start() { myRigidbody = GetComponent <Rigidbody>(); move = GetComponent <AnimalMovement>(); audioSource = GetComponent <AudioSource>(); }
private void Awake() { CurrentAnimalStatistics = gameObject.GetComponent <AnimalStatistics>(); AnimalMovement = gameObject.GetComponent <AnimalMovement>(); partner = null; }
void PassInNewMoveVars(ref AnimalMovement move, AnimalMovement parent) { move.SetVariables(parent.GetMoveDist(), parent.GetMoveSpeed(), parent.GetDegTurn(), parent.GetRotSpeed(), parent.GetMoveTimer()); }