public GameObject dropSheep() { if (sheepPickedup.Count == 0) { return(null); } GameObject droppedSheep = sheepPickedup.Pop(); SheepMovement droppedSheep_movement = droppedSheep.GetComponentInChildren <SheepMovement>(); Animator droppedSheep_animator = droppedSheep.GetComponentInChildren <Animator>(); Rigidbody droppedSheep_rb = droppedSheep.GetComponent <Rigidbody>(); // set state to available and anim state to iddle droppedSheep_movement.setAvailable(); IAnimState animState = new Iddle(ref droppedSheep_animator); droppedSheep_movement.SetAnimState(animState); sheepCollideWithBases(droppedSheep); changePlayerSpeed(); droppedSheep_rb.velocity = Vector3.zero; droppedSheep_rb.useGravity = true; SendDroppedSheepMessage(droppedSheep.transform.name, droppedSheep_movement.getState(), droppedSheep_animator.GetInteger("Index")); return(droppedSheep); }
public void processLandSheepMessage(LandSheepMessage _msg) { GameObject sheep = GameObject.Find(_msg.sheepName); if (sheep != null) { SheepMovement sheep_movement = sheep.GetComponent <SheepMovement>(); Animator sheep_animator = sheep.GetComponentInChildren <Animator>(); // set state to available and anim state to iddle sheep_movement.setAvailable(); IAnimState animState = new Iddle(ref sheep_animator); sheep_movement.SetAnimState(animState); // ignoreCollisionWithBases(sheep, true); ignoreCollisionWithPlayers(sheep, true); } }