private void shootSheep() { if (pickupSheep.getSheepStack().Count == 0) { impulseAccel = InitialImpulseAccel; impulseStrenthSpeed = InitialImpulseSpeed; impulseStrenth = InitialImpulseStrenght; updateImpulseUI(); return; } orientPlayer(); pickupSheep.updateSheepRotation(); hideMira(); GameObject sheep = pickupSheep.prepareToShoot(); SheepMovement sheep_movement = sheep.GetComponentInChildren <SheepMovement>(); Animator sheep_animator = sheep.GetComponentInChildren <Animator>(); Rigidbody sheep_rb = sheep.GetComponent <Rigidbody>(); // set state to flying and anim state to shot sheep_movement.setFlying(); IAnimState animState = new Shot(ref sheep_animator); sheep_movement.SetAnimState(animState); sheep_rb.velocity = Vector3.zero; sheep_rb.useGravity = true; // sheepCollideWithBases(sheep); sheepCollideWithPlayers(sheep); sheep_movement.setPickedUpBy(""); SendShootSheepMessage(sheep.transform.name, sheep_movement.getState(), sheep_animator.GetInteger("Index"), impulseStrenth); resetImpulseAndUI(); }
public void processShootSheepMessage(ShootSheepMessage _msg) { GameObject sheep = GameObject.Find(_msg.sheepName); if (sheep != null) { SheepMovement sheep_movement = sheep.GetComponent <SheepMovement>(); Animator sheep_animator = sheep.GetComponentInChildren <Animator>(); Rigidbody sheep_rb = sheep.GetComponent <Rigidbody>(); // set state to flying and anim state to shot sheep_movement.setFlying(); IAnimState animState = new Shot(ref sheep_animator); sheep_movement.SetAnimState(animState); sheep_rb.velocity = Vector3.zero; sheep_rb.useGravity = true; // ignoreCollisionWithBases(sheep, false); ignoreCollisionWithPlayers(sheep, false); sheep_movement.setPickedUpBy(""); } }