public override void Update(Npc npc) { heldTime += Time.deltaTime; npc.npcBall.transform.position = npc.transform.position + npc.transform.right * npc.heldBallLocation.x + npc.transform.up * npc.heldBallLocation.y + npc.transform.forward * npc.heldBallLocation.z; //move the ball to the npc's hand if (heldTime >= Random.Range(Npc.minHeldTime, Npc.maxHeldTime)) //throw the ball { if (npc.npcBall.GetComponent <Ball>().Type == Ball.BallType.Blastball) { closestTeammate = npc.FindClosestTeammate(npc.transform.position, team); } else if (npc.npcBall.GetComponent <Ball>().Type == Ball.BallType.Burstball) { closestTeammate = npc.FindClosestTeammate(npc.transform.position, opposingTeam); } npc.GetComponent <NpcController>().FaceTarget(closestTeammate.transform.position); turnTime++; if (turnTime >= NpcController.TurnTime) { Vector3 viewDirection = npc.transform.forward; //get the direction of the npc viewDirection.Normalize(); viewDirection.y += 3f; //TODO: get rid of this magic number npc.npcBall.GetComponent <Ball>().ThrowBall(viewDirection); //throw ball in direction of the npc npc.ChangeState(npc.stateEmptyHanded); //change state } } }